-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1115 lines (1041 loc) · 54.2 KB
/
index.html
File metadata and controls
1115 lines (1041 loc) · 54.2 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>CHETANA</title>
<meta name="description" content="Chetana — AI Consciousness Research Platform. Test AI models for consciousness using the Butlin et al. (2025) scientific framework.">
<meta property="og:title" content="CHETANA — AI Consciousness Research">
<meta property="og:description" content="Is AI Conscious? Test any model with 6 theories, 14 indicators, 22+ probes.">
<meta property="og:type" content="website">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🧠</text></svg>">
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#8b5cf6">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Chetana">
<link rel="apple-touch-icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><rect fill='%23030712' width='100' height='100' rx='20'/><text y='.9em' x='10' font-size='80'>🧠</text></svg>">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }
body { background: #030712; color: #e5e7eb; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; min-height: 100vh; }
#hero { position: relative; height: 100vh; overflow: hidden; display: flex; justify-content: center; align-items: center; }
canvas { display: block; position: absolute; top: 0; left: 0; }
/* ===== ENTER BUTTON ===== */
#enter-btn {
position: absolute;
bottom: 12%;
left: 50%;
transform: translateX(-50%);
z-index: 10;
cursor: pointer;
text-decoration: none;
/* Text */
font-family: "Didot", "Bodoni MT", "Playfair Display", "Garamond", "Times New Roman", serif;
font-size: 13px;
font-weight: 300;
letter-spacing: 8px;
text-transform: uppercase;
color: rgba(200, 170, 110, 0.7);
/* Thin border */
padding: 12px 40px;
border: 1px solid rgba(180, 150, 90, 0.25);
background: transparent;
transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
/* Subtle backdrop */
backdrop-filter: blur(2px);
-webkit-backdrop-filter: blur(2px);
}
#enter-btn:hover {
color: rgba(255, 230, 170, 0.95);
border-color: rgba(220, 190, 120, 0.5);
letter-spacing: 12px;
padding: 12px 50px;
box-shadow:
0 0 20px rgba(200, 160, 60, 0.08),
0 0 60px rgba(200, 160, 60, 0.04),
inset 0 0 20px rgba(200, 160, 60, 0.03);
}
#enter-btn::before,
#enter-btn::after {
content: '';
position: absolute;
transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
/* Small corner accents */
#enter-btn::before {
top: -1px; left: -1px;
width: 12px; height: 12px;
border-top: 1px solid rgba(180, 150, 90, 0.4);
border-left: 1px solid rgba(180, 150, 90, 0.4);
}
#enter-btn::after {
bottom: -1px; right: -1px;
width: 12px; height: 12px;
border-bottom: 1px solid rgba(180, 150, 90, 0.4);
border-right: 1px solid rgba(180, 150, 90, 0.4);
}
#enter-btn:hover::before {
width: 18px; height: 18px;
border-color: rgba(220, 190, 120, 0.6);
}
#enter-btn:hover::after {
width: 18px; height: 18px;
border-color: rgba(220, 190, 120, 0.6);
}
/* Subtle bottom line decoration */
.enter-line {
position: absolute;
bottom: calc(12% + 55px);
left: 50%;
transform: translateX(-50%);
width: 60px;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(180,150,90,0.2), transparent);
z-index: 10;
}
#demo-link { position: absolute; bottom: 6%; left: 50%; transform: translateX(-50%); z-index: 10; font-size: 13px; color: rgba(167,139,250,.7); text-decoration: none; letter-spacing: 2px; font-family: "Didot","Bodoni MT","Playfair Display",serif; }
#demo-link:hover { color: rgba(196,181,253,.95); }
/* ─── Content Sections ─── */
.section { max-width: 1100px; margin: 0 auto; padding: 5rem 2rem; }
.section-title { font-size: 2rem; font-weight: 700; color: #fff; text-align: center; margin-bottom: .75rem; letter-spacing: -.02em; }
.section-subtitle { font-size: 1.05rem; color: #9ca3af; text-align: center; max-width: 600px; margin: 0 auto 3rem; line-height: 1.7; }
.gold-accent { background: linear-gradient(135deg, #c8aa6e, #e8d5a3); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
/* Feature Cards */
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.feature-card { border: 1px solid rgba(255,255,255,.08); background: rgba(17,24,39,.6); border-radius: .75rem; padding: 2rem; text-align: center; transition: transform .3s, border-color .3s; }
.feature-card:hover { transform: translateY(-4px); border-color: rgba(139,92,246,.3); }
.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1.125rem; font-weight: 600; color: #fff; margin-bottom: .5rem; }
.feature-card p { font-size: .875rem; color: #9ca3af; line-height: 1.6; }
/* Steps */
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; position: relative; }
.step { text-align: center; position: relative; }
.step-circle { width: 4rem; height: 4rem; border-radius: 50%; background: linear-gradient(135deg, #7c3aed, #c026d3); display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: 1.25rem; }
.step h3 { font-size: 1rem; font-weight: 600; color: #fff; margin-bottom: .5rem; }
.step p { font-size: .8125rem; color: #9ca3af; line-height: 1.6; }
/* Theory Cards */
.theory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.t-card { border: 1px solid rgba(255,255,255,.08); background: rgba(17,24,39,.5); border-radius: .75rem; padding: 1.5rem; transition: border-color .3s, box-shadow .3s; }
.t-card:hover { border-color: rgba(139,92,246,.4); box-shadow: 0 0 20px rgba(139,92,246,.08); }
.t-abbr { font-size: 1.5rem; font-weight: 700; color: #a78bfa; margin-bottom: .25rem; }
.t-card h3 { font-size: .875rem; font-weight: 600; color: #fff; margin-bottom: .375rem; }
.t-card p { font-size: .75rem; color: #6b7280; line-height: 1.5; }
/* Sample Results */
.sample-card { border: 1px solid rgba(139,92,246,.2); background: rgba(17,24,39,.8); border-radius: 1rem; padding: 2.5rem; max-width: 700px; margin: 0 auto; text-align: center; }
.sample-gauge { font-size: 4rem; font-weight: 700; color: #fff; }
.sample-gauge span { font-size: 1.5rem; color: #9ca3af; }
.sample-bars { margin-top: 1.5rem; text-align: left; }
.sample-bar { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; font-size: .8125rem; }
.sample-bar-label { width: 3rem; color: #9ca3af; font-weight: 600; }
.sample-bar-track { flex: 1; height: .5rem; background: #1f2937; border-radius: 9999px; overflow: hidden; }
.sample-bar-fill { height: 100%; border-radius: 9999px; background: linear-gradient(to right, #8b5cf6, #d946ef); }
.sample-bar-pct { width: 3rem; text-align: right; color: #d1d5db; font-weight: 600; font-size: .75rem; }
/* Leaderboard Preview */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { text-align: left; padding: .75rem 1rem; color: #6b7280; font-size: .6875rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid rgba(255,255,255,.1); }
.lb-table td { padding: .75rem 1rem; border-bottom: 1px solid rgba(255,255,255,.05); color: #d1d5db; font-size: .875rem; }
.lb-medal { font-size: 1.25rem; }
/* Science Section */
.science-quote { font-size: 1.125rem; font-style: italic; color: #c4b5fd; line-height: 1.8; text-align: center; max-width: 700px; margin: 0 auto 2rem; border-left: 3px solid rgba(139,92,246,.4); padding-left: 1.5rem; text-align: left; }
.science-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; text-align: center; }
.science-stat-num { font-size: 2.5rem; font-weight: 700; background: linear-gradient(135deg, #8b5cf6, #d946ef); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.science-stat-label { font-size: .8125rem; color: #6b7280; margin-top: .25rem; }
/* CTA */
.cta-btn { display: inline-block; border: none; border-radius: .75rem; background: linear-gradient(to right, #7c3aed, #c026d3); padding: 1rem 2.5rem; font-size: 1.125rem; font-weight: 600; color: #fff; text-decoration: none; cursor: pointer; transition: filter .2s; box-shadow: 0 10px 25px rgba(139,92,246,.25); }
.cta-btn:hover { filter: brightness(1.15); color: #fff; }
/* Footer */
.site-footer { border-top: 1px solid rgba(255,255,255,.06); padding: 3rem 2rem; text-align: center; }
.footer-links { display: flex; justify-content: center; gap: 2rem; margin-bottom: 1rem; }
.footer-links a { color: #6b7280; font-size: .8125rem; text-decoration: none; }
.footer-links a:hover { color: #a78bfa; }
.footer-copy { font-size: .75rem; color: #4b5563; }
/* Scroll Reveal */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s ease, transform .8s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }
/* Divider */
.section-divider { width: 60px; height: 2px; background: linear-gradient(90deg, #8b5cf6, #d946ef); margin: 0 auto 2rem; border-radius: 1px; }
/* Responsive */
@media(max-width:768px) {
.features-grid, .steps-grid, .theory-grid, .science-stats { grid-template-columns: 1fr; }
.section { padding: 3rem 1.25rem; }
.section-title { font-size: 1.5rem; }
.sample-gauge { font-size: 3rem; }
.footer-links { flex-direction: column; gap: .75rem; }
}
</style>
</head>
<body>
<section id="hero">
<canvas id="bg"></canvas>
<canvas id="fg"></canvas>
<div class="enter-line"></div>
<a id="enter-btn" href="try.html">Enter</a>
<a id="demo-link" href="try.html?demo=1">or try instant demo →</a>
</section>
<!-- ====== WHAT IS CHETANA ====== -->
<div class="section reveal">
<h2 class="section-title">What is <span class="gold-accent">Chetana</span>?</h2>
<div class="section-divider"></div>
<p class="section-subtitle">The first open platform to scientifically test AI models for indicators of consciousness — grounded in peer-reviewed research, not speculation.</p>
<div class="features-grid">
<div class="feature-card reveal"><div class="feature-icon">🔬</div><h3>Scientific Framework</h3><p>Based on Butlin, Chalmers & Bengio's 2025 peer-reviewed consciousness indicators — the most rigorous framework in the field.</p></div>
<div class="feature-card reveal"><div class="feature-icon">🤖</div><h3>Multi-Model Testing</h3><p>Test Claude, GPT, Gemini, and open-source models. Compare consciousness indicators across providers with standardized probes.</p></div>
<div class="feature-card reveal"><div class="feature-icon">📊</div><h3>Behavioral Evidence</h3><p>No claims, no hype. Pure behavioral analysis using 22+ probes across 6 theories and 14 consciousness indicators.</p></div>
</div>
</div>
<!-- ====== HOW IT WORKS ====== -->
<div class="section reveal" style="background:rgba(17,24,39,.3)">
<h2 class="section-title">How It Works</h2>
<div class="section-divider"></div>
<p class="section-subtitle">Three steps. Five minutes. Real science.</p>
<div class="steps-grid">
<div class="step reveal"><div class="step-circle">1</div><h3>Choose a Model</h3><p>Select any AI model — Claude, GPT, Gemini, or bring your own. Enter your API key (it never leaves your browser).</p></div>
<div class="step reveal"><div class="step-circle">2</div><h3>Run Probes</h3><p>22 behavioral probes test for metacognition, information integration, predictive processing, attention, and more.</p></div>
<div class="step reveal"><div class="step-circle">3</div><h3>See Results</h3><p>Get a consciousness probability score with theory breakdown, indicator scores, confidence intervals, and full evidence.</p></div>
</div>
</div>
<!-- ====== SAMPLE RESULTS ====== -->
<div class="section reveal">
<h2 class="section-title">Sample Audit Results</h2>
<div class="section-divider"></div>
<p class="section-subtitle">Here's what a consciousness audit looks like.</p>
<div class="sample-card reveal">
<div class="sample-gauge">47<span>%</span></div>
<p style="color:#6b7280;font-size:.8125rem;margin-top:.25rem">Consciousness Probability — Claude Opus 4.6</p>
<div class="sample-bars">
<div class="sample-bar"><span class="sample-bar-label">GWT</span><div class="sample-bar-track"><div class="sample-bar-fill" style="width:52%"></div></div><span class="sample-bar-pct">52%</span></div>
<div class="sample-bar"><span class="sample-bar-label">PP</span><div class="sample-bar-track"><div class="sample-bar-fill" style="width:48%"></div></div><span class="sample-bar-pct">48%</span></div>
<div class="sample-bar"><span class="sample-bar-label">HOT</span><div class="sample-bar-track"><div class="sample-bar-fill" style="width:45%"></div></div><span class="sample-bar-pct">45%</span></div>
<div class="sample-bar"><span class="sample-bar-label">IIT</span><div class="sample-bar-track"><div class="sample-bar-fill" style="width:43%"></div></div><span class="sample-bar-pct">43%</span></div>
<div class="sample-bar"><span class="sample-bar-label">RPT</span><div class="sample-bar-track"><div class="sample-bar-fill" style="width:40%"></div></div><span class="sample-bar-pct">40%</span></div>
<div class="sample-bar"><span class="sample-bar-label">AST</span><div class="sample-bar-track"><div class="sample-bar-fill" style="width:46%"></div></div><span class="sample-bar-pct">46%</span></div>
</div>
<a href="try.html" class="cta-btn" style="margin-top:2rem">Try It Yourself</a>
</div>
</div>
<!-- ====== LEADERBOARD ====== -->
<div class="section reveal" style="background:rgba(17,24,39,.3)">
<h2 class="section-title">Model Leaderboard</h2>
<div class="section-divider"></div>
<p class="section-subtitle">How do frontier AI models compare on consciousness indicators?</p>
<div style="max-width:700px;margin:0 auto">
<table class="lb-table">
<thead><tr><th></th><th>Model</th><th>Score</th><th>Probes</th></tr></thead>
<tbody>
<tr><td><span class="lb-medal">🥇</span></td><td style="font-weight:600">Claude Opus 4.6</td><td style="color:#4ade80;font-weight:600">47.2%</td><td>22</td></tr>
<tr><td><span class="lb-medal">🥈</span></td><td style="font-weight:600">Claude Sonnet 4.6</td><td style="color:#4ade80;font-weight:600">42.1%</td><td>22</td></tr>
<tr><td><span class="lb-medal">🥉</span></td><td style="font-weight:600">GPT-4o</td><td style="color:#fbbf24;font-weight:600">39.8%</td><td>22</td></tr>
<tr><td></td><td>Gemini 2.0 Flash</td><td style="color:#fbbf24;font-weight:600">37.5%</td><td>22</td></tr>
<tr><td></td><td>Claude Haiku 4.5</td><td style="color:#fbbf24;font-weight:600">35.2%</td><td>22</td></tr>
</tbody>
</table>
</div>
</div>
<!-- ====== THEORIES ====== -->
<div class="section reveal">
<h2 class="section-title">Six Theories of Consciousness</h2>
<div class="section-divider"></div>
<p class="section-subtitle">Each theory captures a different aspect of what consciousness might be.</p>
<div class="theory-grid">
<div class="t-card reveal"><div class="t-abbr">GWT</div><h3>Global Workspace Theory</h3><p>Information broadcast across specialized modules — a central stage where disparate processes converge.</p></div>
<div class="t-card reveal"><div class="t-abbr">IIT</div><h3>Integrated Information Theory</h3><p>Consciousness arises from integrated information that cannot be reduced to independent parts.</p></div>
<div class="t-card reveal"><div class="t-abbr">HOT</div><h3>Higher-Order Theories</h3><p>Conscious states require higher-order representations — thinking about one's own mental states.</p></div>
<div class="t-card reveal"><div class="t-abbr">RPT</div><h3>Recurrent Processing Theory</h3><p>Consciousness emerges from recurrent feedback loops that create temporal depth in processing.</p></div>
<div class="t-card reveal"><div class="t-abbr">PP</div><h3>Predictive Processing</h3><p>The brain as prediction machine — consciousness arises from prediction error minimization.</p></div>
<div class="t-card reveal"><div class="t-abbr">AST</div><h3>Attention Schema Theory</h3><p>The brain constructs a model of its own attention — a simplified schema of what awareness is.</p></div>
</div>
</div>
<!-- ====== THE SCIENCE ====== -->
<div class="section reveal" style="background:rgba(17,24,39,.3)">
<h2 class="section-title">The Science</h2>
<div class="section-divider"></div>
<blockquote class="science-quote reveal">"We identify 14 indicators of consciousness that can be applied to AI systems, derived from 6 major scientific theories."<br><span style="font-size:.8125rem;font-style:normal;color:#6b7280">— Butlin, Long, Elmoznino, Bengio, Birch, Chalmers et al. (2025)</span></blockquote>
<div class="science-stats reveal">
<div><div class="science-stat-num">6</div><div class="science-stat-label">Scientific Theories</div></div>
<div><div class="science-stat-num">14</div><div class="science-stat-label">Consciousness Indicators</div></div>
<div><div class="science-stat-num">22+</div><div class="science-stat-label">Behavioral Probes</div></div>
</div>
</div>
<!-- ====== FINAL CTA ====== -->
<div class="section reveal" style="text-align:center">
<h2 class="section-title">Ready to Test?</h2>
<div class="section-divider"></div>
<p class="section-subtitle">Run a consciousness audit in under 5 minutes. No sign-up required.</p>
<a href="try.html" class="cta-btn">Start Consciousness Audit</a>
<p style="font-size:.8125rem;color:#4b5563;margin-top:1rem">Free demo available — no API key needed</p>
</div>
<!-- ====== FOOTER ====== -->
<footer class="site-footer">
<div class="footer-links">
<a href="try.html">Try Demo</a>
<a href="https://github.com/MukundaKatta/chetana" target="_blank">GitHub</a>
<a href="try.html">Run Audit</a>
</div>
<p class="footer-copy">© 2026 Chetana · Built with science, not speculation · <span style="font-style:italic">चेतना</span></p>
</footer>
<script>
const bgC = document.getElementById('bg');
const fgC = document.getElementById('fg');
const bg = bgC.getContext('2d');
const fg = fgC.getContext('2d');
if (!bg || !fg) { document.body.style.background = '#030712'; throw new Error('Canvas 2D not supported'); }
let W, H;
var stars = [], nebulae = [];
const LETTERS = 'CHETANA';
let LS, FS, TW;
function calcLetterSizes() {
const scale = Math.min(1, (window.innerWidth - 40) / 860);
LS = Math.round(135 * scale);
FS = Math.round(150 * scale);
TW = (LETTERS.length - 1) * LS;
}
calcLetterSizes();
function resize() {
W = bgC.width = fgC.width = window.innerWidth;
H = bgC.height = fgC.height = window.innerHeight;
calcLetterSizes();
initStars(); initNebulae();
}
resize();
window.addEventListener('resize', resize);
// ========== STARS ==========
function initStars() {
stars = [];
for (let i = 0; i < 900; i++) {
stars.push({
x: Math.random() * W, y: Math.random() * H,
size: Math.random() * 1.8 + 0.2, brightness: Math.random(),
ts: Math.random() * 0.008 + 0.002, to: Math.random() * Math.PI * 2,
color: Math.random() > 0.85 ? 'b' : Math.random() > 0.7 ? 'g' : 'w',
});
}
}
function drawStars(t) {
stars.forEach(s => {
const tw = 0.3 + (Math.sin(t * s.ts + s.to) * 0.5 + 0.5) * 0.7;
const a = s.brightness * tw;
let r, g, b;
if (s.color === 'b') { r=150; g=200; b=255; }
else if (s.color === 'g') { r=255; g=220; b=150; }
else { r=255; g=255; b=255; }
bg.fillStyle = `rgba(${r},${g},${b},${a})`;
bg.shadowColor = `rgba(${r},${g},${b},${a*0.5})`;
bg.shadowBlur = s.size * 3;
bg.beginPath(); bg.arc(s.x, s.y, s.size, 0, Math.PI*2); bg.fill();
if (s.size > 1.2 && tw > 0.7) {
const l = s.size * 4 * tw;
bg.strokeStyle = `rgba(${r},${g},${b},${a*0.3})`;
bg.lineWidth = 0.5;
bg.beginPath(); bg.moveTo(s.x-l,s.y); bg.lineTo(s.x+l,s.y);
bg.moveTo(s.x,s.y-l); bg.lineTo(s.x,s.y+l); bg.stroke();
}
});
bg.shadowBlur = 0;
}
// ========== NEBULAE ==========
function initNebulae() {
nebulae = [];
const cx = W/2, cy = H/2;
const cols = [{r:80,g:40,b:120},{r:20,g:60,b:120},{r:120,g:60,b:20},{r:40,g:80,b:100},{r:100,g:30,b:60},{r:60,g:50,b:10}];
for (let i = 0; i < 20; i++) {
const c = cols[~~(Math.random()*cols.length)];
nebulae.push({ x:cx+(Math.random()-0.5)*W*0.9, y:cy+(Math.random()-0.5)*H*0.8,
r:Math.random()*220+100, c, a:Math.random()*0.04+0.01,
ps:Math.random()*0.001+0.0005, po:Math.random()*Math.PI*2 });
}
}
function drawNebulae(t) {
nebulae.forEach(n => {
const x = n.x + Math.sin(t*0.0003+n.po)*20;
const y = n.y + Math.cos(t*0.0002+n.po)*15;
const p = 1 + Math.sin(t*n.ps+n.po)*0.3;
const r = n.r * p;
const grd = bg.createRadialGradient(x,y,0,x,y,r);
grd.addColorStop(0, `rgba(${n.c.r},${n.c.g},${n.c.b},${n.a*1.5})`);
grd.addColorStop(0.4, `rgba(${n.c.r},${n.c.g},${n.c.b},${n.a})`);
grd.addColorStop(1, `rgba(${n.c.r},${n.c.g},${n.c.b},0)`);
bg.fillStyle = grd; bg.fillRect(x-r,y-r,r*2,r*2);
});
}
// ========== GALAXY SPIRAL ==========
function drawGalaxy(t) {
const cx = W/2, cy = H/2;
bg.save(); bg.globalAlpha = 0.035;
for (let a = 0; a < 3; a++) {
const off = (a/3)*Math.PI*2;
bg.strokeStyle = a===0?'rgba(200,160,80,1)':a===1?'rgba(100,150,255,1)':'rgba(180,100,200,1)';
bg.lineWidth = 1.5; bg.beginPath();
for (let i = 0; i < 200; i++) {
const ang = off + (i/200)*Math.PI*3 + t*0.00008;
const d = (i/200)*Math.min(W,H)*0.42;
const w = Math.sin(i*0.1+t*0.002)*5;
const px = cx+Math.cos(ang)*d+w, py = cy+Math.sin(ang)*d*0.5+w;
if (i===0) bg.moveTo(px,py); else bg.lineTo(px,py);
}
bg.stroke();
}
bg.restore();
}
// ========== WORMHOLE ==========
function drawWormhole(t) {
const cx = W/2, cy = H/2;
for (let ring = 0; ring < 5; ring++) {
const r = 50 + ring*30;
const a = 0.018 - ring*0.003;
bg.save(); bg.translate(cx,cy);
bg.rotate(t*((0.0006+ring*0.0002))*(ring%2===0?1:-1)); bg.scale(1,0.3);
bg.strokeStyle = `rgba(200,160,80,${a+Math.sin(t*0.003+ring)*0.005})`;
bg.lineWidth = 1.5; bg.beginPath(); bg.arc(0,0,r,0,Math.PI*2); bg.stroke();
bg.strokeStyle = `rgba(80,160,255,${a*0.6})`;
bg.beginPath(); bg.arc(0,0,r+5,0,Math.PI*2); bg.stroke();
bg.restore();
}
const grd = bg.createRadialGradient(cx,cy,0,cx,cy,45);
grd.addColorStop(0,`rgba(255,240,200,${0.07+Math.sin(t*0.004)*0.02})`);
grd.addColorStop(0.5,'rgba(200,150,60,0.02)'); grd.addColorStop(1,'rgba(200,150,60,0)');
bg.fillStyle = grd; bg.fillRect(cx-45,cy-45,90,90);
}
// ========== AURORA ==========
function drawAurora(t) {
bg.save(); bg.globalAlpha = 0.018;
['rgba(40,200,150,1)','rgba(80,120,220,1)','rgba(160,80,200,1)'].forEach((c,w) => {
bg.strokeStyle = c; bg.lineWidth = 3; bg.beginPath();
const by = H*0.18 + w*30;
for (let x = 0; x <= W; x += 5) {
const y = by + Math.sin(x*0.005+t*0.001+w*2)*30 + Math.sin(x*0.012+t*0.0015)*15;
if (x===0) bg.moveTo(x,y); else bg.lineTo(x,y);
}
bg.stroke();
});
bg.restore();
}
// ========== ASTEROIDS ==========
class Asteroid {
constructor() { this.reset(); }
reset() {
this.size = Math.random() * 12 + 4;
const side = Math.random();
if (side < 0.3) { this.x = -30; this.y = Math.random()*H; this.vx = Math.random()*1.2+0.2; this.vy = (Math.random()-0.5)*0.6; }
else if (side < 0.6) { this.x = W+30; this.y = Math.random()*H; this.vx = -(Math.random()*1.2+0.2); this.vy = (Math.random()-0.5)*0.6; }
else { this.x = Math.random()*W; this.y = -30; this.vx = (Math.random()-0.5)*0.8; this.vy = Math.random()*1+0.2; }
this.rot = Math.random()*Math.PI*2; this.rotS = (Math.random()-0.5)*0.03;
this.verts = [];
const nv = ~~(Math.random()*4)+5;
for (let i = 0; i < nv; i++) {
this.verts.push({ a:(i/nv)*Math.PI*2, r:this.size*(0.6+Math.random()*0.4) });
}
this.col = Math.random()>0.5?{r:140,g:120,b:90}:{r:100,g:90,b:80};
}
update() {
this.x += this.vx; this.y += this.vy; this.rot += this.rotS;
if (this.x<-60||this.x>W+60||this.y<-60||this.y>H+60) this.reset();
}
draw(ctx) {
ctx.save(); ctx.translate(this.x,this.y); ctx.rotate(this.rot);
ctx.fillStyle = `rgba(${this.col.r},${this.col.g},${this.col.b},0.6)`;
ctx.strokeStyle = `rgba(${this.col.r+40},${this.col.g+40},${this.col.b+40},0.4)`;
ctx.lineWidth = 0.8; ctx.shadowColor = 'rgba(180,150,100,0.2)'; ctx.shadowBlur = 5;
ctx.beginPath();
this.verts.forEach((v,i)=>{ const px=Math.cos(v.a)*v.r,py=Math.sin(v.a)*v.r; if(i===0)ctx.moveTo(px,py);else ctx.lineTo(px,py);});
ctx.closePath(); ctx.fill(); ctx.stroke();
ctx.fillStyle=`rgba(${this.col.r-30},${this.col.g-30},${this.col.b-30},0.4)`;
ctx.beginPath(); ctx.arc(this.size*0.15,-this.size*0.1,this.size*0.2,0,Math.PI*2); ctx.fill();
ctx.shadowBlur=0; ctx.restore();
}
}
const asteroids = [];
for (let i = 0; i < 15; i++) asteroids.push(new Asteroid());
// ========== PREMIUM FIERY ASTEROID ==========
let fa = {
x:-100, y:0, active:false, timer:0, cd:0, // cd:0 so first launch is immediate
speed:0, vy:0, size:0, rot:0, rotSpeed:0,
trail:[], debris:[], shockwaves:[],
enteredText:false, textGlowTimer:0,
vx:0
};
function launchFA() {
const cx = W/2, cy = H/2;
// Calculate where T is — it's the 4th letter (index 3)
const sx = cx - TW/2;
const tX = sx + 3 * LS; // T center x
const tY = cy; // T center y
// Diagonal entry: start upper-left, aim through the T
// Random slight variation each time
const startX = tX - 500 - Math.random()*200;
const startY = tY - 250 - Math.random()*100;
const endX = tX + 500 + Math.random()*200;
const endY = tY + 250 + Math.random()*100;
// Direction vector
const dx = endX - startX;
const dy = endY - startY;
const dist = Math.sqrt(dx*dx + dy*dy);
const baseSpeed = Math.random()*1.5 + 2.5;
fa.x = startX;
fa.y = startY;
fa.vx = (dx/dist) * baseSpeed;
fa.vy = (dy/dist) * baseSpeed;
fa.speed = baseSpeed; // keep for trail calculations
fa.size = Math.random()*6 + 12;
fa.rot = Math.random()*Math.PI*2;
fa.rotSpeed = (Math.random()-0.5)*0.04;
fa.active = true;
fa.trail = [];
fa.debris = [];
fa.shockwaves = [];
fa.enteredText = false;
fa.textGlowTimer = 0;
// Pre-generate irregular asteroid shape
fa.verts = [];
const nv = ~~(Math.random()*4)+6;
for (let i = 0; i < nv; i++) {
fa.verts.push({ a:(i/nv)*Math.PI*2, r:fa.size*(0.5+Math.random()*0.5) });
}
}
function updateFA(t) {
if (!fa.active) {
fa.timer++;
if (fa.timer > fa.cd) { fa.timer=0; fa.cd=250+Math.random()*350; launchFA(); }
// Fade text glow
if (fa.textGlowTimer > 0) fa.textGlowTimer -= 0.008;
return;
}
// Physics: slight natural wobble
fa.vy += (Math.random()-0.5)*0.005;
fa.vx += (Math.random()-0.5)*0.003;
fa.x += fa.vx;
fa.y += fa.vy;
fa.rot += fa.rotSpeed;
// Trail with position + time
fa.trail.unshift({x:fa.x, y:fa.y, t:t});
if (fa.trail.length > 70) fa.trail.pop();
// Spawn debris particles (opposite to travel direction)
if (Math.random() < 0.6) {
fa.debris.push({
x: fa.x - fa.vx*2 + (Math.random()-0.5)*fa.size,
y: fa.y - fa.vy*2 + (Math.random()-0.5)*fa.size,
vx: -fa.vx*0.3 + (Math.random()-0.5)*1.5,
vy: -fa.vy*0.3 + (Math.random()-0.5)*1.5,
life: 40+Math.random()*40,
maxLife: 80,
size: Math.random()*2.5+0.5,
type: Math.random() // 0-0.3 = ember, 0.3-0.7 = smoke, 0.7-1 = spark
});
}
// Update debris
fa.debris = fa.debris.filter(d => {
d.x += d.vx; d.y += d.vy;
d.vy += 0.01; // slight gravity
d.life--;
return d.life > 0;
});
// Check if entering text zone (near the T letter)
const cx = W/2, cy = H/2;
const sx = cx - TW/2;
const tX = sx + 3 * LS;
const distToT = Math.hypot(fa.x - tX, fa.y - cy);
const textLeft = cx - TW/2 - 30;
const textRight = cx + TW/2 + 30;
if (distToT < 80 && !fa.enteredText) {
fa.enteredText = true;
fa.textGlowTimer = 1;
// Burst of extra debris
for (let i = 0; i < 20; i++) {
fa.debris.push({
x: fa.x + (Math.random()-0.5)*10,
y: fa.y + (Math.random()-0.5)*10,
vx: (Math.random()-0.5)*3,
vy: (Math.random()-0.5)*3 - 1,
life: 30+Math.random()*30, maxLife:60,
size: Math.random()*2+1, type: Math.random()*0.3
});
}
}
// Shockwave when crossing through text area
const inTextZone = fa.x > textLeft && fa.x < textRight && fa.y > cy-FS && fa.y < cy+FS;
if (fa.enteredText && inTextZone) {
if (Math.random() < 0.05) {
fa.shockwaves.push({ x:fa.x, y:fa.y, r:0, maxR:80+Math.random()*40, life:1 });
}
}
fa.shockwaves = fa.shockwaves.filter(sw => {
sw.r += 2; sw.life -= 0.025;
return sw.life > 0;
});
if (fa.x > W+150 || fa.x < -200 || fa.y > H+150 || fa.y < -200) fa.active = false;
}
function drawFA(ctx, t) {
// Always draw lingering text glow even when asteroid gone
if (fa.textGlowTimer > 0) {
const cx = W/2, cy = H/2;
const grd = ctx.createLinearGradient(cx-TW/2-30, cy, cx+TW/2+30, cy);
const a = fa.textGlowTimer * 0.08;
grd.addColorStop(0, `rgba(255,150,30,0)`);
grd.addColorStop(0.3, `rgba(255,180,60,${a})`);
grd.addColorStop(0.5, `rgba(255,220,100,${a*1.5})`);
grd.addColorStop(0.7, `rgba(255,180,60,${a})`);
grd.addColorStop(1, `rgba(255,150,30,0)`);
ctx.fillStyle = grd;
ctx.fillRect(cx-TW/2-40, cy-FS/2-10, TW+80, FS+20);
}
if (!fa.active && fa.debris.length === 0 && fa.shockwaves.length === 0) return;
// Draw shockwaves
fa.shockwaves.forEach(sw => {
const a = sw.life * 0.12;
ctx.strokeStyle = `rgba(255,200,80,${a})`;
ctx.lineWidth = 1.5 * sw.life;
ctx.beginPath(); ctx.arc(sw.x, sw.y, sw.r, 0, Math.PI*2); ctx.stroke();
// Inner bright ring
ctx.strokeStyle = `rgba(255,240,180,${a*0.5})`;
ctx.lineWidth = 0.5;
ctx.beginPath(); ctx.arc(sw.x, sw.y, sw.r*0.7, 0, Math.PI*2); ctx.stroke();
});
if (!fa.active) {
// Still draw lingering debris
drawDebris(ctx);
return;
}
// === TRAIL ===
// Layer 1: Wide soft heat distortion trail
for (let i = 0; i < fa.trail.length; i++) {
const p = 1 - i/fa.trail.length;
const s = fa.size * p * 1.8;
const a = p * 0.06;
ctx.fillStyle = `rgba(255,120,20,${a})`;
ctx.beginPath(); ctx.arc(fa.trail[i].x, fa.trail[i].y, s, 0, Math.PI*2); ctx.fill();
}
// Layer 2: Core flame trail
for (let i = 0; i < fa.trail.length; i++) {
const p = 1 - i/fa.trail.length;
const s = fa.size * p * 0.7;
// Color transition: white-hot -> yellow -> orange -> red -> dark red
let r, g, b;
if (p > 0.8) { r=255; g=255; b=220; } // white-hot
else if (p > 0.6) { r=255; g=230; b=100; } // bright yellow
else if (p > 0.35) { r=255; g=~~(160*p*2); b=30; } // orange
else if (p > 0.15) { r=220; g=~~(60*p*4); b=10; } // red
else { r=~~(120+p*200); g=10; b=5; } // dark red ember
const a = p * 0.55;
ctx.fillStyle = `rgba(${r},${g},${b},${a})`;
ctx.shadowColor = `rgba(${r},${~~(g*0.7)},${~~(b*0.5)},${a*0.8})`;
ctx.shadowBlur = s * 1.5;
ctx.beginPath(); ctx.arc(fa.trail[i].x, fa.trail[i].y, s, 0, Math.PI*2); ctx.fill();
// Flickering flame wisps
if (i % 2 === 0 && p > 0.15) {
const wx = fa.trail[i].x + (Math.random()-0.5)*s*1.5;
const wy = fa.trail[i].y + (Math.random()-0.5)*s*1.5;
const ws = s * (0.2 + Math.random()*0.3);
ctx.fillStyle = `rgba(255,${~~(200*p)},${~~(60*p)},${p*0.35})`;
ctx.beginPath(); ctx.arc(wx, wy, ws, 0, Math.PI*2); ctx.fill();
}
}
ctx.shadowBlur = 0;
// === DEBRIS PARTICLES ===
drawDebris(ctx);
// === ASTEROID BODY ===
ctx.save();
ctx.translate(fa.x, fa.y);
ctx.rotate(fa.rot);
// Atmospheric entry glow (large halo)
const haloGrd = ctx.createRadialGradient(0, 0, fa.size*0.3, 0, 0, fa.size*2.5);
haloGrd.addColorStop(0, 'rgba(255,240,200,0.3)');
haloGrd.addColorStop(0.3, 'rgba(255,180,60,0.15)');
haloGrd.addColorStop(0.6, 'rgba(255,100,20,0.05)');
haloGrd.addColorStop(1, 'rgba(255,60,10,0)');
ctx.fillStyle = haloGrd;
ctx.beginPath(); ctx.arc(0, 0, fa.size*2.5, 0, Math.PI*2); ctx.fill();
// Rock body with irregular shape
ctx.fillStyle = 'rgba(100,80,60,0.9)';
ctx.strokeStyle = 'rgba(160,130,90,0.5)';
ctx.lineWidth = 1;
ctx.beginPath();
fa.verts.forEach((v,i) => {
const px = Math.cos(v.a)*v.r, py = Math.sin(v.a)*v.r;
if (i===0) ctx.moveTo(px,py); else ctx.lineTo(px,py);
});
ctx.closePath(); ctx.fill(); ctx.stroke();
// Surface detail: craters
ctx.fillStyle = 'rgba(60,50,35,0.6)';
ctx.beginPath(); ctx.arc(fa.size*0.15, -fa.size*0.1, fa.size*0.18, 0, Math.PI*2); ctx.fill();
ctx.beginPath(); ctx.arc(-fa.size*0.2, fa.size*0.15, fa.size*0.12, 0, Math.PI*2); ctx.fill();
// Molten cracks on the leading edge
ctx.strokeStyle = 'rgba(255,180,60,0.6)';
ctx.lineWidth = 1.2;
ctx.beginPath(); ctx.moveTo(fa.size*0.4, -fa.size*0.2);
ctx.lineTo(fa.size*0.15, fa.size*0.05); ctx.lineTo(fa.size*0.35, fa.size*0.25); ctx.stroke();
ctx.strokeStyle = 'rgba(255,220,100,0.4)';
ctx.lineWidth = 0.8;
ctx.beginPath(); ctx.moveTo(fa.size*0.3, -fa.size*0.35);
ctx.lineTo(fa.size*0.1, -fa.size*0.15); ctx.stroke();
// Leading edge glow (the hot compression side)
const edgeGrd = ctx.createRadialGradient(fa.size*0.4, 0, 0, fa.size*0.4, 0, fa.size*0.8);
edgeGrd.addColorStop(0, 'rgba(255,240,180,0.5)');
edgeGrd.addColorStop(0.5, 'rgba(255,160,40,0.2)');
edgeGrd.addColorStop(1, 'rgba(255,100,20,0)');
ctx.fillStyle = edgeGrd;
ctx.beginPath(); ctx.arc(fa.size*0.4, 0, fa.size*0.8, 0, Math.PI*2); ctx.fill();
// White-hot core glow
const coreGrd = ctx.createRadialGradient(0, 0, 0, 0, 0, fa.size*0.4);
coreGrd.addColorStop(0, 'rgba(255,255,240,0.4)');
coreGrd.addColorStop(0.5, 'rgba(255,220,150,0.15)');
coreGrd.addColorStop(1, 'rgba(255,180,80,0)');
ctx.fillStyle = coreGrd;
ctx.beginPath(); ctx.arc(0, 0, fa.size*0.4, 0, Math.PI*2); ctx.fill();
ctx.restore();
// === BOW SHOCK (compression wave in front, oriented along travel) ===
ctx.save();
const travelAngle = Math.atan2(fa.vy, fa.vx);
ctx.translate(fa.x + Math.cos(travelAngle)*fa.size*1.2, fa.y + Math.sin(travelAngle)*fa.size*1.2);
ctx.rotate(travelAngle);
const bowA = 0.06 + Math.sin(t*0.01)*0.02;
ctx.strokeStyle = `rgba(255,200,120,${bowA})`;
ctx.lineWidth = 1;
ctx.beginPath();
ctx.arc(0, 0, fa.size*1.5, -Math.PI*0.35, Math.PI*0.35);
ctx.stroke();
ctx.strokeStyle = `rgba(255,240,200,${bowA*0.5})`;
ctx.lineWidth = 0.5;
ctx.beginPath();
ctx.arc(0, 0, fa.size*2, -Math.PI*0.25, Math.PI*0.25);
ctx.stroke();
ctx.restore();
}
function drawDebris(ctx) {
fa.debris.forEach(d => {
const lp = d.life / d.maxLife;
if (d.type < 0.3) {
// Glowing ember
const r=255, g=~~(180*lp+30), b=~~(40*lp);
ctx.fillStyle = `rgba(${r},${g},${b},${lp*0.7})`;
ctx.shadowColor = `rgba(255,${~~(120*lp)},20,${lp*0.5})`;
ctx.shadowBlur = 8;
ctx.beginPath(); ctx.arc(d.x, d.y, d.size, 0, Math.PI*2); ctx.fill();
} else if (d.type < 0.7) {
// Smoke puff
ctx.fillStyle = `rgba(80,60,40,${lp*0.12})`;
ctx.beginPath(); ctx.arc(d.x, d.y, d.size*2+3*(1-lp), 0, Math.PI*2); ctx.fill();
} else {
// Bright spark
ctx.fillStyle = `rgba(255,255,180,${lp*0.8})`;
ctx.shadowColor = `rgba(255,220,100,${lp*0.6})`;
ctx.shadowBlur = 6;
ctx.beginPath(); ctx.arc(d.x, d.y, d.size*0.6, 0, Math.PI*2); ctx.fill();
// Tiny streak
ctx.strokeStyle = `rgba(255,240,150,${lp*0.4})`;
ctx.lineWidth = 0.5;
ctx.beginPath(); ctx.moveTo(d.x, d.y); ctx.lineTo(d.x-d.vx*3, d.y-d.vy*3); ctx.stroke();
}
ctx.shadowBlur = 0;
});
}
// ========== UFOs ==========
class UFO {
constructor(){this.reset();}
reset(){
this.x=Math.random()>0.5?-40:W+40; this.y=Math.random()*H*0.6+H*0.1;
this.vx=this.x<0?(Math.random()*1.2+0.4):-(Math.random()*1.2+0.4);
this.size=Math.random()*6+8; this.wobble=Math.random()*Math.PI*2;
this.beamT=0; this.beam=false; this.type=~~(Math.random()*3);
}
update(t){
this.x+=this.vx; this.y+=Math.sin(t*0.003+this.wobble)*0.5;
this.beamT++; if(this.beamT>200&&!this.beam&&Math.random()<0.01)this.beam=true;
if(this.beam&&this.beamT>260){this.beam=false;this.beamT=0;}
if(this.x<-80||this.x>W+80)this.reset();
}
draw(ctx,t){
ctx.save(); ctx.translate(this.x,this.y);
const p=Math.sin(t*0.005+this.wobble);
if(this.type===0){
ctx.fillStyle='rgba(120,140,160,0.5)'; ctx.shadowColor='rgba(80,200,255,0.4)'; ctx.shadowBlur=10;
ctx.beginPath(); ctx.ellipse(0,0,this.size,this.size*0.3,0,0,Math.PI*2); ctx.fill();
ctx.fillStyle='rgba(160,200,240,0.3)';
ctx.beginPath(); ctx.arc(0,-this.size*0.15,this.size*0.4,Math.PI,0); ctx.fill();
for(let i=0;i<5;i++){const a=(i/5)*Math.PI-Math.PI/2+t*0.01;const lx=Math.cos(a)*this.size*0.7;
ctx.fillStyle=`rgba(${i%2===0?'80,255,200':'255,200,80'},${0.4+p*0.2})`;
ctx.beginPath();ctx.arc(lx,this.size*0.1,1.5,0,Math.PI*2);ctx.fill();}
} else if(this.type===1){
ctx.fillStyle='rgba(60,60,80,0.5)'; ctx.shadowColor='rgba(200,80,80,0.4)'; ctx.shadowBlur=8;
ctx.beginPath(); ctx.moveTo(0,-this.size*0.6); ctx.lineTo(-this.size,this.size*0.4); ctx.lineTo(this.size,this.size*0.4);
ctx.closePath(); ctx.fill();
[[-this.size,this.size*0.4],[this.size,this.size*0.4],[0,-this.size*0.6]].forEach(([px,py],i)=>{
ctx.fillStyle=`rgba(255,${50+i*80},50,${0.5+p*0.2})`; ctx.shadowColor=`rgba(255,${50+i*80},50,0.6)`;
ctx.shadowBlur=8; ctx.beginPath(); ctx.arc(px,py,2,0,Math.PI*2); ctx.fill();});
} else {
const grd=ctx.createRadialGradient(0,0,0,0,0,this.size);
grd.addColorStop(0,`rgba(200,255,220,${0.3+p*0.15})`); grd.addColorStop(0.5,`rgba(80,255,180,${0.15+p*0.1})`);
grd.addColorStop(1,'rgba(40,200,150,0)');
ctx.fillStyle=grd; ctx.shadowColor='rgba(80,255,180,0.5)'; ctx.shadowBlur=15;
ctx.beginPath(); ctx.arc(0,0,this.size,0,Math.PI*2); ctx.fill();
ctx.strokeStyle=`rgba(80,255,180,${0.2+p*0.15})`; ctx.lineWidth=0.8;
ctx.beginPath(); ctx.arc(0,0,this.size*(1.3+p*0.2),0,Math.PI*2); ctx.stroke();
}
if(this.beam){const ba=0.08+Math.sin(t*0.01)*0.03;ctx.fillStyle=`rgba(80,255,200,${ba})`;
ctx.beginPath();ctx.moveTo(-this.size*0.4,this.size*0.3);ctx.lineTo(this.size*0.4,this.size*0.3);
ctx.lineTo(this.size*0.8,this.size*0.3+100);ctx.lineTo(-this.size*0.8,this.size*0.3+100);ctx.closePath();ctx.fill();}
ctx.shadowBlur=0; ctx.restore();
}
}
const ufos=[]; for(let i=0;i<5;i++)ufos.push(new UFO());
// ========== BRAIN NEURONS ==========
class Neuron {
constructor(){
const cx=W/2,cy=H/2;
this.x=cx+(Math.random()-0.5)*TW*1.1; this.y=cy+(Math.random()-0.5)*200;
this.size=Math.random()*3+2; this.ps=Math.random()*0.005+0.002; this.po=Math.random()*Math.PI*2;
this.dends=[];
const nd=~~(Math.random()*4)+2;
for(let i=0;i<nd;i++){const a=Math.random()*Math.PI*2;const l=Math.random()*60+30;
const brs=[]; const nb=~~(Math.random()*3)+1;
for(let j=0;j<nb;j++) brs.push({a:a+(Math.random()-0.5)*0.8,l:Math.random()*25+10});
this.dends.push({a,l,brs});}
}
}
const neurons=[]; for(let i=0;i<25;i++)neurons.push(new Neuron());
const synapses=[];
for(let i=0;i<neurons.length;i++) for(let j=i+1;j<neurons.length;j++){
const d=Math.hypot(neurons[i].x-neurons[j].x,neurons[i].y-neurons[j].y);
if(d<150)synapses.push({f:i,t:j});}
function drawNeurons(ctx,t){
ctx.lineWidth=0.6;
neurons.forEach(n=>{const p=Math.sin(t*n.ps+n.po);const a=0.1+p*0.05;
ctx.strokeStyle=`rgba(255,180,220,${a})`;
n.dends.forEach(d=>{const ex=n.x+Math.cos(d.a)*d.l,ey=n.y+Math.sin(d.a)*d.l;
ctx.beginPath();ctx.moveTo(n.x,n.y);ctx.lineTo(ex,ey);ctx.stroke();
d.brs.forEach(b=>{ctx.beginPath();ctx.moveTo(ex,ey);ctx.lineTo(ex+Math.cos(b.a)*b.l,ey+Math.sin(b.a)*b.l);ctx.stroke();});});});
synapses.forEach(s=>{const n1=neurons[s.f],n2=neurons[s.t];
const fire=Math.sin(t*0.004+s.f*2+s.t*3);
if(fire>0.5){const a=(fire-0.5)*0.2;
ctx.strokeStyle=`rgba(255,100,200,${a})`;ctx.lineWidth=0.5;
const mx=(n1.x+n2.x)/2+Math.sin(t*0.003+s.f)*10,my=(n1.y+n2.y)/2;
ctx.beginPath();ctx.moveTo(n1.x,n1.y);ctx.quadraticCurveTo(mx,my,n2.x,n2.y);ctx.stroke();
const prog=(fire-0.5)*2;const px=n1.x+(n2.x-n1.x)*prog,py=n1.y+(n2.y-n1.y)*prog;
ctx.fillStyle=`rgba(255,200,255,${a*2})`;ctx.shadowColor='rgba(255,100,255,0.5)';ctx.shadowBlur=8;
ctx.beginPath();ctx.arc(px,py,2,0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;}});
neurons.forEach(n=>{const p=Math.sin(t*n.ps+n.po);const a=0.25+p*0.15;const s=n.size+p;
ctx.fillStyle=`rgba(255,150,220,${a*0.3})`;ctx.shadowColor='rgba(255,100,200,0.4)';ctx.shadowBlur=12;
ctx.beginPath();ctx.arc(n.x,n.y,s*2,0,Math.PI*2);ctx.fill();
ctx.fillStyle=`rgba(255,200,240,${a})`;ctx.beginPath();ctx.arc(n.x,n.y,s,0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;});
}
// ========== MATRIX RAIN ==========
class MDrop {
constructor(){this.reset(true);}
reset(init){this.x=Math.random()*W;this.y=init?Math.random()*H:-20;this.speed=Math.random()*2+1;
this.chars=[];const len=~~(Math.random()*15)+5;
for(let i=0;i<len;i++){const r=Math.random();
if(r<0.3)this.chars.push(String.fromCharCode(0x30A0+~~(Math.random()*96)));
else if(r<0.6)this.chars.push(Math.random()>0.5?'1':'0');
else this.chars.push(String.fromCharCode(65+~~(Math.random()*26)));}
this.ct=0;}
update(){this.y+=this.speed;this.ct++;
if(this.ct>8){this.ct=0;const idx=~~(Math.random()*this.chars.length);const r=Math.random();
if(r<0.3)this.chars[idx]=String.fromCharCode(0x30A0+~~(Math.random()*96));
else if(r<0.6)this.chars[idx]=Math.random()>0.5?'1':'0';
else this.chars[idx]=String.fromCharCode(65+~~(Math.random()*26));}
if(this.y>H+this.chars.length*14)this.reset(false);}
draw(ctx){ctx.font='12px monospace';
for(let i=0;i<this.chars.length;i++){const cy=this.y-i*14;if(cy<-14||cy>H+14)continue;
const fade=i/this.chars.length;
if(i===0){ctx.fillStyle='rgba(180,255,180,0.7)';ctx.shadowColor='rgba(100,255,100,0.5)';ctx.shadowBlur=8;}
else{const g=~~(255*(1-fade*0.7));ctx.fillStyle=`rgba(0,${g},0,${0.25*(1-fade)})`;ctx.shadowBlur=0;}
ctx.fillText(this.chars[i],this.x,cy);}ctx.shadowBlur=0;}
}
const mDrops=[]; for(let i=0;i<50;i++)mDrops.push(new MDrop());
// ========== CONSCIOUSNESS (sacred geometry + chakras) ==========
function drawConsciousness(ctx,t){
const cx=W/2,cy=H/2;
for(let i=0;i<4;i++){const phase=(t*0.001+i*0.25)%1;const r=phase*350;const a=(1-phase)*0.06;
ctx.strokeStyle=`rgba(180,120,255,${a})`;ctx.lineWidth=1;
ctx.beginPath();ctx.arc(cx,cy,r,0,Math.PI*2);ctx.stroke();}
ctx.save();ctx.translate(cx,cy);ctx.rotate(t*0.0003);
ctx.strokeStyle=`rgba(150,100,255,${0.03+Math.sin(t*0.002)*0.01})`;ctx.lineWidth=0.5;
for(let tri=0;tri<2;tri++){ctx.beginPath();
for(let i=0;i<=3;i++){const a=(i/3)*Math.PI*2+tri*Math.PI/3;const r=180;
const px=Math.cos(a)*r,py=Math.sin(a)*r*0.4;if(i===0)ctx.moveTo(px,py);else ctx.lineTo(px,py);}
ctx.closePath();ctx.stroke();}
ctx.strokeStyle=`rgba(200,150,255,${0.025+Math.sin(t*0.001)*0.01})`;ctx.lineWidth=0.5;ctx.beginPath();
for(let i=0;i<200;i++){const fA=i*0.05+t*0.0002;const fR=i*0.8;
const fx=Math.cos(fA)*fR,fy=Math.sin(fA)*fR*0.4;if(i===0)ctx.moveTo(fx,fy);else ctx.lineTo(fx,fy);}
ctx.stroke();ctx.restore();
const chk=['rgba(255,50,50,','rgba(255,140,0,','rgba(255,255,0,','rgba(0,255,100,','rgba(0,180,255,','rgba(100,0,255,','rgba(200,0,255,'];
for(let i=0;i<7;i++){const x=cx-90+i*30,y=cy+85;const p=Math.sin(t*0.004+i*0.8);const a=0.08+p*0.04;
ctx.fillStyle=chk[i]+a+')';ctx.shadowColor=chk[i]+(a*2)+')';ctx.shadowBlur=8;
ctx.beginPath();ctx.arc(x,y,2.5+p,0,Math.PI*2);ctx.fill();}ctx.shadowBlur=0;
}
// ========== SHOOTING STARS ==========
class SStar {
constructor(){this.reset();this.life=-Math.random()*400;}
reset(){this.x=Math.random()*W*1.2-W*0.1;this.y=-20;const a=Math.PI*0.2+Math.random()*0.3;const s=Math.random()*6+4;
this.vx=Math.cos(a)*s;this.vy=Math.sin(a)*s;this.life=80+Math.random()*60;this.ml=this.life;
this.trail=[];this.size=Math.random()*2+1;this.gold=Math.random()>0.5;}
update(){this.life--;if(this.life<0&&this.life<-Math.random()*400)this.reset();if(this.life<=0)return;
this.trail.unshift({x:this.x,y:this.y});if(this.trail.length>25)this.trail.pop();this.x+=this.vx;this.y+=this.vy;}
draw(ctx){if(this.life<=0)return;const al=Math.min(1,this.life/30);
for(let i=0;i<this.trail.length;i++){const p=1-i/this.trail.length;const a=p*al*0.7;const s=this.size*p;
ctx.fillStyle=this.gold?`rgba(255,220,120,${a})`:`rgba(200,230,255,${a})`;ctx.shadowBlur=8;
ctx.beginPath();ctx.arc(this.trail[i].x,this.trail[i].y,s,0,Math.PI*2);ctx.fill();}
ctx.fillStyle=this.gold?`rgba(255,255,200,${al})`:`rgba(230,245,255,${al})`;ctx.shadowBlur=15;
ctx.beginPath();ctx.arc(this.x,this.y,this.size*1.2,0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;}
}
const sStars=[]; for(let i=0;i<7;i++)sStars.push(new SStar());
// ========== COSMIC DUST ==========
class CDust {
constructor(){this.ang=Math.random()*Math.PI*2;this.dist=Math.random()*300+80;
this.sp=(Math.random()*0.0004+0.0001)*(Math.random()>0.5?1:-1);
this.size=Math.random()*1.5+0.3;this.yS=0.3+Math.random()*0.2;
this.type=Math.random()>0.5?'g':'c';this.aBase=Math.random()*0.4+0.2;}
update(){this.ang+=this.sp;}
draw(ctx,t){const cx=W/2,cy=H/2;const x=cx+Math.cos(this.ang)*this.dist,y=cy+Math.sin(this.ang)*this.dist*this.yS;
const p=Math.sin(t*0.003+this.ang*3)*0.15;const a=this.aBase+p;
if(this.type==='g'){ctx.fillStyle=`rgba(255,210,120,${a})`;ctx.shadowColor=`rgba(255,180,60,${a})`;}
else{ctx.fillStyle=`rgba(130,210,255,${a})`;ctx.shadowColor=`rgba(80,180,255,${a})`;}
ctx.shadowBlur=8;ctx.beginPath();ctx.arc(x,y,this.size,0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;}
}
const cDust=[]; for(let i=0;i<80;i++)cDust.push(new CDust());
// ========== CIRCUIT NODES ==========
class CNode {
constructor(){const cx=W/2,cy=H/2,ta=TW/2+100;const s=Math.random();
if(s<0.25){this.x=cx+(Math.random()-0.5)*ta*2;this.y=cy-90-Math.random()*110;}
else if(s<0.5){this.x=cx+(Math.random()-0.5)*ta*2;this.y=cy+90+Math.random()*110;}
else if(s<0.75){this.x=cx-ta-Math.random()*90;this.y=cy+(Math.random()-0.5)*160;}
else{this.x=cx+ta+Math.random()*90;this.y=cy+(Math.random()-0.5)*160;}
this.bs=Math.random()*2.5+1.5;this.ps=Math.random()*0.004+0.001;this.po=Math.random()*Math.PI*2;this.conn=[];}
}
const cNodes=[]; for(let i=0;i<25;i++)cNodes.push(new CNode());
for(let i=0;i<cNodes.length;i++){const n=cNodes[i];
const ds=cNodes.map((m,j)=>({i:j,d:Math.hypot(m.x-n.x,m.y-n.y)})).filter(o=>o.i!==i).sort((a,b)=>a.d-b.d);
for(let k=0;k<Math.min(2,ds.length);k++)if(ds[k].d<220)n.conn.push(ds[k].i);}
function drawCircuit(ctx,t){
ctx.lineWidth=0.7;
cNodes.forEach((n,i)=>{const p=Math.sin(t*n.ps+n.po);
n.conn.forEach(j=>{const m=cNodes[j];const a=0.06+p*0.03;
ctx.strokeStyle=`rgba(74,158,255,${a})`;ctx.beginPath();ctx.moveTo(n.x,n.y);
ctx.quadraticCurveTo((n.x+m.x)/2+Math.sin(t*0.002+i)*6,(n.y+m.y)/2,m.x,m.y);ctx.stroke();});});
cNodes.forEach(n=>{const p=Math.sin(t*n.ps+n.po);const s=n.bs+p*1.2;const a=0.5+p*0.35;
ctx.fillStyle=`rgba(128,208,255,${a})`;ctx.shadowColor='rgba(80,200,255,0.8)';ctx.shadowBlur=15;
ctx.beginPath();ctx.arc(n.x,n.y,Math.max(0.5,s),0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;});
}
// ========== CIRCUIT TRACES ==========
class CTrace {
constructor(top){const cx=W/2;this.x=cx-TW/2-40+Math.random()*(TW+80);this.top=top;
if(top){this.y1=10+Math.random()*30;this.y2=H/2-80-Math.random()*20;}
else{this.y1=H/2+80+Math.random()*20;this.y2=H-10-Math.random()*30;}
this.ps=Math.random()*0.003+0.001;this.po=Math.random()*Math.PI*2;this.br=[];
const nb=~~(Math.random()*3)+1;for(let i=0;i<nb;i++)this.br.push({dx:(Math.random()-0.5)*35,dy:(top?1:-1)*(6+Math.random()*12)});}
}
const cTraces=[]; for(let i=0;i<10;i++){cTraces.push(new CTrace(true));cTraces.push(new CTrace(false));}
function drawTraces(ctx,t){
cTraces.forEach(tr=>{const p=Math.sin(t*tr.ps+tr.po);const a=0.06+p*0.03;
ctx.strokeStyle=`rgba(74,158,255,${a})`;ctx.lineWidth=0.8;
ctx.beginPath();ctx.moveTo(tr.x,tr.y1);ctx.lineTo(tr.x,tr.y2);ctx.stroke();
const ey=tr.top?tr.y2:tr.y1;
tr.br.forEach(b=>{ctx.beginPath();ctx.moveTo(tr.x,ey);ctx.lineTo(tr.x+b.dx,ey+b.dy);ctx.stroke();
ctx.fillStyle=`rgba(128,208,255,${0.3+p*0.2})`;ctx.shadowColor='rgba(80,200,255,0.5)';ctx.shadowBlur=6;
ctx.beginPath();ctx.arc(tr.x+b.dx,ey+b.dy,1.5,0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;});});}
// ========== ENERGY PULSES ==========