File size: 55,679 Bytes
68d884a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1ba5fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68d884a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1ba5fbc
68d884a
 
 
 
 
 
 
 
 
 
 
1ba5fbc
68d884a
 
 
 
1ba5fbc
 
68d884a
 
1ba5fbc
68d884a
1ba5fbc
68d884a
 
 
 
 
 
 
 
 
 
1ba5fbc
68d884a
1ba5fbc
68d884a
 
 
1ba5fbc
68d884a
 
 
 
1ba5fbc
68d884a
 
1ba5fbc
68d884a
 
 
 
1ba5fbc
68d884a
 
 
 
1ba5fbc
68d884a
 
 
 
1ba5fbc
68d884a
 
 
 
1ba5fbc
68d884a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1ba5fbc
68d884a
 
1ba5fbc
68d884a
 
 
 
 
 
 
 
1ba5fbc
68d884a
 
1ba5fbc
68d884a
 
 
 
 
 
 
 
 
 
 
 
 
1ba5fbc
 
68d884a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1ba5fbc
 
68d884a
 
 
 
 
 
 
 
 
 
1ba5fbc
68d884a
 
1ba5fbc
68d884a
 
 
 
 
 
 
 
 
 
 
 
 
1ba5fbc
 
68d884a
 
 
 
 
 
 
 
 
 
1ba5fbc
68d884a
 
 
1ba5fbc
68d884a
 
 
1ba5fbc
68d884a
 
 
 
1ba5fbc
68d884a
 
 
1ba5fbc
68d884a
 
 
 
 
1ba5fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68d884a
 
 
1ba5fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68d884a
1ba5fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68d884a
1ba5fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68d884a
 
1ba5fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
68d884a
 
1ba5fbc
 
 
 
 
 
 
 
 
 
 
 
68d884a
1ba5fbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68d884a
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Skyai - AI-Powered Goal Achievement</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        @keyframes float {
            0% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
            100% { transform: translateY(0px); }
        }
        .floating {
            animation: float 3s ease-in-out infinite;
        }
        .progress-bar {
            transition: width 0.5s ease-in-out;
        }
        .task-card {
            transition: all 0.3s ease;
        }
        .task-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }
        .map-node {
            transition: all 0.3s ease;
        }
        .map-node.active {
            transform: scale(1.1);
            box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
        }
        .streak-pulse {
            animation: pulse 2s infinite;
        }
        @keyframes pulse {
            0% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.7); }
            70% { box-shadow: 0 0 0 10px rgba(234, 88, 12, 0); }
            100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0); }
        }
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }
        .modal-content {
            background-color: white;
            padding: 20px;
            border-radius: 10px;
            width: 90%;
            max-width: 400px;
            max-height: 80vh;
            overflow-y: auto;
        }
        .chat-message {
            max-width: 80%;
            margin-bottom: 10px;
            padding: 8px 12px;
            border-radius: 12px;
        }
        .user-message {
            background-color: #6366f1;
            color: white;
            margin-left: auto;
            border-bottom-right-radius: 4px;
        }
        .ai-message {
            background-color: #f3f4f6;
            color: #1f2937;
            margin-right: auto;
            border-bottom-left-radius: 4px;
        }
    </style>
</head>
<body class="bg-gray-50 font-sans">
    <!-- App Container -->
    <div class="max-w-md mx-auto bg-white min-h-screen shadow-lg overflow-hidden">
        <!-- Header -->
        <header class="bg-gradient-to-r from-indigo-500 to-purple-600 text-white p-4">
            <div class="flex justify-between items-center">
                <div class="flex items-center space-x-2">
                    <div class="w-8 h-8 bg-white rounded-full flex items-center justify-center">
                        <i class="fas fa-cloud text-indigo-500 text-lg"></i>
                    </div>
                    <h1 class="font-bold text-xl">Skyai</h1>
                </div>
                <div class="flex items-center space-x-3">
                    <div class="relative">
                        <div class="w-8 h-8 bg-yellow-400 rounded-full flex items-center justify-center streak-pulse">
                            <span class="font-bold text-orange-800" id="streak-count">7</span>
                        </div>
                        <div class="absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full w-4 h-4 flex items-center justify-center">🔥</div>
                    </div>
                    <div class="w-8 h-8 bg-white bg-opacity-20 rounded-full flex items-center justify-center">
                        <i class="fas fa-bell"></i>
                    </div>
                </div>
            </div>
        </header>

        <!-- Main Content -->
        <main class="p-4 pb-20" id="main-content">
            <!-- User Progress -->
            <div class="bg-white rounded-xl shadow-md p-4 mb-4">
                <div class="flex justify-between items-center mb-2">
                    <div>
                        <span class="text-sm text-gray-500">Level <span id="user-level">3</span> Explorer</span>
                        <h3 class="font-bold" id="username">Alex Founder</h3>
                    </div>
                    <div class="text-right">
                        <div class="text-xs text-gray-500">XP: <span id="current-xp">245</span>/<span id="max-xp">400</span></div>
                        <div class="w-full bg-gray-200 rounded-full h-2">
                            <div class="bg-indigo-500 h-2 rounded-full progress-bar" id="xp-bar" style="width: 61%"></div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Current Goal -->
            <div class="bg-gradient-to-r from-blue-50 to-indigo-50 rounded-xl shadow-md p-4 mb-6 border border-blue-100">
                <div class="flex justify-between items-start mb-2">
                    <div>
                        <span class="text-xs font-semibold bg-blue-100 text-blue-800 px-2 py-1 rounded-full">ACTIVE GOAL</span>
                        <h3 class="font-bold mt-2 text-lg" id="current-goal-title">Reach $10k MRR</h3>
                    </div>
                    <button class="text-blue-500" onclick="showEditGoalModal()">
                        <i class="fas fa-ellipsis-h"></i>
                    </button>
                </div>
                <p class="text-sm text-gray-600 mb-3" id="current-goal-description">Current: $3,200 MRR → Goal: $10,000 MRR</p>
                
                <!-- Progress Map -->
                <div class="relative h-24 mb-4">
                    <div class="absolute top-1/2 left-0 right-0 h-1 bg-gray-200 transform -translate-y-1/2"></div>
                    <div class="absolute top-1/2 left-0 h-1 bg-indigo-500 transform -translate-y-1/2" id="goal-progress-bar" style="width: 32%"></div>
                    
                    <div class="absolute top-1/2 left-0 transform -translate-y-1/2 -translate-x-1/2">
                        <div class="w-6 h-6 bg-indigo-500 rounded-full flex items-center justify-center text-white text-xs map-node active" onclick="selectMapNode(0)">1</div>
                        <div class="text-xs text-center mt-1">Start</div>
                    </div>
                    
                    <div class="absolute top-1/2 left-1/3 transform -translate-y-1/2 -translate-x-1/2">
                        <div class="w-6 h-6 bg-indigo-500 rounded-full flex items-center justify-center text-white text-xs map-node" onclick="selectMapNode(1)">2</div>
                        <div class="text-xs text-center mt-1">$5k</div>
                    </div>
                    
                    <div class="absolute top-1/2 left-2/3 transform -translate-y-1/2 -translate-x-1/2">
                        <div class="w-6 h-6 bg-gray-300 rounded-full flex items-center justify-center text-gray-600 text-xs map-node" onclick="selectMapNode(2)">3</div>
                        <div class="text-xs text-center mt-1">$7.5k</div>
                    </div>
                    
                    <div class="absolute top-1/2 right-0 transform -translate-y-1/2 translate-x-1/2">
                        <div class="w-6 h-6 bg-gray-300 rounded-full flex items-center justify-center text-gray-600 text-xs map-node" onclick="selectMapNode(3)">4</div>
                        <div class="text-xs text-center mt-1">Goal</div>
                    </div>
                </div>
                
                <button class="w-full bg-indigo-500 hover:bg-indigo-600 text-white py-2 px-4 rounded-lg font-medium transition duration-200" onclick="showFullJourney()">
                    See Full Journey
                </button>
            </div>

            <!-- AI Assistant -->
            <div class="bg-white rounded-xl shadow-md p-4 mb-6">
                <div class="flex items-center mb-3">
                    <div class="w-10 h-10 bg-purple-100 rounded-full flex items-center justify-center mr-3">
                        <i class="fas fa-robot text-purple-500 text-xl"></i>
                    </div>
                    <div>
                        <h3 class="font-bold">SkyAI Assistant</h3>
                        <p class="text-xs text-gray-500">Ready to help you progress</p>
                    </div>
                </div>
                
                <div class="bg-gray-50 rounded-lg p-3 mb-3">
                    <p class="text-sm" id="ai-recommendation">"Based on your current progress, I recommend focusing on these high-leverage tasks to move toward $10k MRR:"</p>
                </div>
                
                <button class="w-full bg-gradient-to-r from-purple-500 to-indigo-500 hover:from-purple-600 hover:to-indigo-600 text-white py-2 px-4 rounded-lg font-medium transition duration-200 flex items-center justify-center" onclick="showAIChatModal()">
                    <i class="fas fa-comment-dots mr-2"></i> Chat with AI
                </button>
            </div>

            <!-- Priority Tasks -->
            <div class="mb-6">
                <div class="flex justify-between items-center mb-3">
                    <h2 class="font-bold text-lg">Priority Tasks</h2>
                    <button class="text-sm text-indigo-500" onclick="showAllTasks('priority')">View All</button>
                </div>
                
                <div class="space-y-3" id="priority-tasks">
                    <!-- Task 1 -->
                    <div class="task-card bg-white rounded-lg shadow-md p-4 border-l-4 border-blue-500">
                        <div class="flex justify-between items-start mb-2">
                            <h3 class="font-medium">Optimize pricing page conversion</h3>
                            <span class="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded-full">HIGH IMPACT</span>
                        </div>
                        <p class="text-sm text-gray-600 mb-3">Current conversion: 2.1% → Target: 4.5%</p>
                        <div class="flex justify-between items-center">
                            <div class="flex space-x-2">
                                <span class="text-xs bg-green-100 text-green-800 px-2 py-1 rounded-full">DO</span>
                                <span class="text-xs bg-yellow-100 text-yellow-800 px-2 py-1 rounded-full">UX</span>
                            </div>
                            <div class="flex space-x-2">
                                <button class="text-blue-500 text-sm" onclick="shareTask('Optimize pricing page conversion')"><i class="fas fa-share-alt"></i></button>
                                <button class="text-green-500 text-sm" onclick="completeTask(this, 25)"><i class="fas fa-check-circle"></i></button>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Task 2 -->
                    <div class="task-card bg-white rounded-lg shadow-md p-4 border-l-4 border-orange-500">
                        <div class="flex justify-between items-start mb-2">
                            <h3 class="font-medium">Create case study for top customer</h3>
                            <span class="text-xs bg-orange-100 text-orange-800 px-2 py-1 rounded-full">MEDIUM IMPACT</span>
                        </div>
                        <p class="text-sm text-gray-600 mb-3">Will help with sales conversations</p>
                        <div class="flex justify-between items-center">
                            <div class="flex space-x-2">
                                <span class="text-xs bg-green-100 text-green-800 px-2 py-1 rounded-full">DO</span>
                                <span class="text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded-full">CONTENT</span>
                            </div>
                            <div class="flex space-x-2">
                                <button class="text-blue-500 text-sm" onclick="shareTask('Create case study for top customer')"><i class="fas fa-share-alt"></i></button>
                                <button class="text-green-500 text-sm" onclick="completeTask(this, 15)"><i class="fas fa-check-circle"></i></button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Delegation Tasks -->
            <div class="mb-6">
                <div class="flex justify-between items-center mb-3">
                    <h2 class="font-bold text-lg">Tasks to Delegate</h2>
                    <button class="text-sm text-indigo-500" onclick="showAllTasks('delegate')">View All</button>
                </div>
                
                <div class="space-y-3" id="delegate-tasks">
                    <!-- Task 1 -->
                    <div class="task-card bg-white rounded-lg shadow-md p-4 border-l-4 border-gray-400">
                        <div class="flex justify-between items-start mb-2">
                            <h3 class="font-medium">Update social media banners</h3>
                            <span class="text-xs bg-gray-100 text-gray-800 px-2 py-1 rounded-full">LOW IMPACT</span>
                        </div>
                        <p class="text-sm text-gray-600 mb-3">Consistent branding across platforms</p>
                        <div class="flex justify-between items-center">
                            <div class="flex space-x-2">
                                <span class="text-xs bg-red-100 text-red-800 px-2 py-1 rounded-full">DELEGATE</span>
                                <span class="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded-full">DESIGN</span>
                            </div>
                            <div class="flex space-x-2">
                                <button class="text-blue-500 text-sm" onclick="assignTask('Update social media banners')"><i class="fas fa-user-plus"></i></button>
                                <button class="text-blue-500 text-sm" onclick="sendTask('Update social media banners')"><i class="fas fa-paper-plane"></i></button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        <!-- Bottom Navigation -->
        <nav class="fixed bottom-0 left-0 right-0 bg-white shadow-lg border-t border-gray-200 max-w-md mx-auto">
            <div class="flex justify-around p-3">
                <a href="#" class="text-indigo-500 flex flex-col items-center" onclick="showHome()">
                    <i class="fas fa-home text-xl"></i>
                    <span class="text-xs mt-1">Home</span>
                </a>
                <a href="#" class="text-gray-500 flex flex-col items-center" onclick="showJourney()">
                    <i class="fas fa-map text-xl"></i>
                    <span class="text-xs mt-1">Journey</span>
                </a>
                <a href="#" class="text-gray-500 flex flex-col items-center" onclick="showAddTaskModal()">
                    <div class="relative">
                        <i class="fas fa-plus-circle text-3xl text-indigo-500 floating" style="margin-top: -20px;"></i>
                    </div>
                </a>
                <a href="#" class="text-gray-500 flex flex-col items-center" onclick="showCommunity()">
                    <i class="fas fa-users text-xl"></i>
                    <span class="text-xs mt-1">Community</span>
                </a>
                <a href="#" class="text-gray-500 flex flex-col items-center" onclick="showProfile()">
                    <i class="fas fa-user text-xl"></i>
                    <span class="text-xs mt-1">Profile</span>
                </a>
            </div>
        </nav>

        <!-- Modals -->
        <!-- Edit Goal Modal -->
        <div class="modal" id="edit-goal-modal">
            <div class="modal-content">
                <div class="flex justify-between items-center mb-4">
                    <h3 class="font-bold text-lg">Edit Goal</h3>
                    <button onclick="hideModal('edit-goal-modal')" class="text-gray-500"><i class="fas fa-times"></i></button>
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Goal Title</label>
                    <input type="text" id="edit-goal-title" class="w-full p-2 border border-gray-300 rounded-lg" value="Reach $10k MRR">
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Current Status</label>
                    <input type="text" id="edit-current-status" class="w-full p-2 border border-gray-300 rounded-lg" value="$3,200 MRR">
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Target Goal</label>
                    <input type="text" id="edit-target-goal" class="w-full p-2 border border-gray-300 rounded-lg" value="$10,000 MRR">
                </div>
                <div class="flex justify-end space-x-2">
                    <button onclick="deleteGoal()" class="px-4 py-2 bg-red-500 text-white rounded-lg">Delete</button>
                    <button onclick="saveGoal()" class="px-4 py-2 bg-indigo-500 text-white rounded-lg">Save</button>
                </div>
            </div>
        </div>

        <!-- AI Chat Modal -->
        <div class="modal" id="ai-chat-modal">
            <div class="modal-content">
                <div class="flex justify-between items-center mb-4">
                    <h3 class="font-bold text-lg">AI Assistant</h3>
                    <button onclick="hideModal('ai-chat-modal')" class="text-gray-500"><i class="fas fa-times"></i></button>
                </div>
                <div class="mb-4 h-64 overflow-y-auto" id="chat-messages">
                    <div class="chat-message ai-message">
                        Hi there! I'm your SkyAI assistant. How can I help you with your goal today?
                    </div>
                </div>
                <div class="flex">
                    <input type="text" id="chat-input" class="flex-1 p-2 border border-gray-300 rounded-l-lg" placeholder="Ask me anything...">
                    <button onclick="sendChatMessage()" class="px-4 py-2 bg-indigo-500 text-white rounded-r-lg"><i class="fas fa-paper-plane"></i></button>
                </div>
            </div>
        </div>

        <!-- Add Task Modal -->
        <div class="modal" id="add-task-modal">
            <div class="modal-content">
                <div class="flex justify-between items-center mb-4">
                    <h3 class="font-bold text-lg">Add New Task</h3>
                    <button onclick="hideModal('add-task-modal')" class="text-gray-500"><i class="fas fa-times"></i></button>
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Task Name</label>
                    <input type="text" id="task-name" class="w-full p-2 border border-gray-300 rounded-lg" placeholder="What needs to be done?">
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
                    <textarea id="task-description" class="w-full p-2 border border-gray-300 rounded-lg" placeholder="Details about the task"></textarea>
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Priority</label>
                    <select id="task-priority" class="w-full p-2 border border-gray-300 rounded-lg">
                        <option value="high">High Impact</option>
                        <option value="medium">Medium Impact</option>
                        <option value="low">Low Impact</option>
                    </select>
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Action</label>
                    <select id="task-action" class="w-full p-2 border border-gray-300 rounded-lg">
                        <option value="do">Do (High Priority)</option>
                        <option value="delegate">Delegate</option>
                    </select>
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Category</label>
                    <select id="task-category" class="w-full p-2 border border-gray-300 rounded-lg">
                        <option value="ux">UX</option>
                        <option value="content">Content</option>
                        <option value="design">Design</option>
                        <option value="marketing">Marketing</option>
                        <option value="development">Development</option>
                    </select>
                </div>
                <button onclick="addNewTask()" class="w-full py-2 bg-indigo-500 text-white rounded-lg">Add Task</button>
            </div>
        </div>

        <!-- Profile Modal -->
        <div class="modal" id="profile-modal">
            <div class="modal-content">
                <div class="flex justify-between items-center mb-4">
                    <h3 class="font-bold text-lg">Your Profile</h3>
                    <button onclick="hideModal('profile-modal')" class="text-gray-500"><i class="fas fa-times"></i></button>
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Name</label>
                    <input type="text" id="profile-name" class="w-full p-2 border border-gray-300 rounded-lg" value="Alex Founder">
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
                    <input type="email" id="profile-email" class="w-full p-2 border border-gray-300 rounded-lg" value="[email protected]">
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Deepseek API Key</label>
                    <input type="password" id="api-key" class="w-full p-2 border border-gray-300 rounded-lg" placeholder="Enter your Deepseek API key">
                    <p class="text-xs text-gray-500 mt-1">This key is stored locally in your browser only</p>
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Current Streak</label>
                    <input type="number" id="profile-streak" class="w-full p-2 border border-gray-300 rounded-lg" value="7">
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Current Level</label>
                    <input type="number" id="profile-level" class="w-full p-2 border border-gray-300 rounded-lg" value="3">
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Current XP</label>
                    <input type="number" id="profile-xp" class="w-full p-2 border border-gray-300 rounded-lg" value="245">
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Max XP</label>
                    <input type="number" id="profile-max-xp" class="w-full p-2 border border-gray-300 rounded-lg" value="400">
                </div>
                <button onclick="saveProfile()" class="w-full py-2 bg-indigo-500 text-white rounded-lg">Save Profile</button>
            </div>
        </div>

        <!-- Share Task Modal -->
        <div class="modal" id="share-task-modal">
            <div class="modal-content">
                <div class="flex justify-between items-center mb-4">
                    <h3 class="font-bold text-lg">Share Task</h3>
                    <button onclick="hideModal('share-task-modal')" class="text-gray-500"><i class="fas fa-times"></i></button>
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Task</label>
                    <input type="text" id="share-task-name" class="w-full p-2 border border-gray-300 rounded-lg" readonly>
                </div>
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Share Via</label>
                    <select id="share-method" class="w-full p-2 border border-gray-300 rounded-lg">
                        <option value="email">Email</option>
                        <option value="slack">Slack</option>
                        <option value="link">Copy Link</option>
                    </select>
                </div>
                <div class="mb-4" id="share-email-field">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Email Address</label>
                    <input type="email" id="share-email" class="w-full p-2 border border-gray-300 rounded-lg" placeholder="[email protected]">
                </div>
                <div class="mb-4" id="share-message-field">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Message</label>
                    <textarea id="share-message" class="w-full p-2 border border-gray-300 rounded-lg" placeholder="Optional message"></textarea>
                </div>
                <button onclick="confirmShareTask()" class="w-full py-2 bg-indigo-500 text-white rounded-lg">Share Task</button>
            </div>
        </div>

        <!-- Full Journey Modal -->
        <div class="modal" id="journey-modal">
            <div class="modal-content">
                <div class="flex justify-between items-center mb-4">
                    <h3 class="font-bold text-lg">Your Goal Journey</h3>
                    <button onclick="hideModal('journey-modal')" class="text-gray-500"><i class="fas fa-times"></i></button>
                </div>
                <div class="mb-4">
                    <h4 class="font-semibold mb-2" id="journey-goal-title">Reach $10k MRR</h4>
                    <div class="relative h-12 mb-6">
                        <div class="absolute top-1/2 left-0 right-0 h-2 bg-gray-200 transform -translate-y-1/2"></div>
                        <div class="absolute top-1/2 left-0 h-2 bg-indigo-500 transform -translate-y-1/2" style="width: 32%"></div>
                        
                        <div class="absolute top-1/2 left-0 transform -translate-y-1/2 -translate-x-1/2">
                            <div class="w-6 h-6 bg-indigo-500 rounded-full flex items-center justify-center text-white text-xs">1</div>
                            <div class="text-xs text-center mt-1">Start</div>
                        </div>
                        
                        <div class="absolute top-1/2 left-1/3 transform -translate-y-1/2 -translate-x-1/2">
                            <div class="w-6 h-6 bg-indigo-500 rounded-full flex items-center justify-center text-white text-xs">2</div>
                            <div class="text-xs text-center mt-1">$5k</div>
                        </div>
                        
                        <div class="absolute top-1/2 left-2/3 transform -translate-y-1/2 -translate-x-1/2">
                            <div class="w-6 h-6 bg-gray-300 rounded-full flex items-center justify-center text-gray-600 text-xs">3</div>
                            <div class="text-xs text-center mt-1">$7.5k</div>
                        </div>
                        
                        <div class="absolute top-1/2 right-0 transform -translate-y-1/2 translate-x-1/2">
                            <div class="w-6 h-6 bg-gray-300 rounded-full flex items-center justify-center text-gray-600 text-xs">4</div>
                            <div class="text-xs text-center mt-1">Goal</div>
                        </div>
                    </div>
                </div>
                <div class="mb-4">
                    <h4 class="font-semibold mb-2">Milestones</h4>
                    <div class="space-y-3">
                        <div class="flex items-start">
                            <div class="w-6 h-6 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-500 mr-2 mt-1">
                                <i class="fas fa-check text-xs"></i>
                            </div>
                            <div>
                                <h5 class="font-medium">Started the journey</h5>
                                <p class="text-sm text-gray-600">You set your goal to reach $10k MRR</p>
                                <p class="text-xs text-gray-500">3 days ago</p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <div class="w-6 h-6 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-500 mr-2 mt-1">
                                <i class="fas fa-check text-xs"></i>
                            </div>
                            <div>
                                <h5 class="font-medium">Reached $3k MRR</h5>
                                <p class="text-sm text-gray-600">You hit your first milestone</p>
                                <p class="text-xs text-gray-500">1 day ago</p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <div class="w-6 h-6 bg-gray-100 rounded-full flex items-center justify-center text-gray-400 mr-2 mt-1">
                                <i class="fas fa-lock text-xs"></i>
                            </div>
                            <div>
                                <h5 class="font-medium text-gray-500">Reach $5k MRR</h5>
                                <p class="text-sm text-gray-500">Next milestone</p>
                            </div>
                        </div>
                    </div>
                </div>
                <button onclick="hideModal('journey-modal')" class="w-full py-2 bg-indigo-500 text-white rounded-lg">Close</button>
            </div>
        </div>
    </div>

    <script>
        // App State
        const appState = {
            currentView: 'home',
            tasks: [
                {
                    id: 1,
                    name: "Optimize pricing page conversion",
                    description: "Current conversion: 2.1% → Target: 4.5%",
                    priority: "high",
                    action: "do",
                    category: "ux",
                    completed: false
                },
                {
                    id: 2,
                    name: "Create case study for top customer",
                    description: "Will help with sales conversations",
                    priority: "medium",
                    action: "do",
                    category: "content",
                    completed: false
                },
                {
                    id: 3,
                    name: "Update social media banners",
                    description: "Consistent branding across platforms",
                    priority: "low",
                    action: "delegate",
                    category: "design",
                    completed: false
                }
            ],
            goal: {
                title: "Reach $10k MRR",
                current: "$3,200 MRR",
                target: "$10,000 MRR",
                progress: 32
            },
            user: {
                name: "Alex Founder",
                email: "[email protected]",
                level: 3,
                xp: 245,
                maxXp: 400,
                streak: 7,
                apiKey: ""
            },
            chatMessages: [
                {
                    sender: "ai",
                    content: "Hi there! I'm your SkyAI assistant. How can I help you with your goal today?"
                }
            ],
            currentTaskToShare: null
        };

        // Initialize the app
        document.addEventListener('DOMContentLoaded', function() {
            loadStateFromLocalStorage();
            renderCurrentView();
            updateXPBar();
            
            // Set up event listeners for share method change
            document.getElementById('share-method').addEventListener('change', function() {
                const method = this.value;
                const emailField = document.getElementById('share-email-field');
                const messageField = document.getElementById('share-message-field');
                
                if (method === 'email') {
                    emailField.style.display = 'block';
                    messageField.style.display = 'block';
                } else if (method === 'slack') {
                    emailField.style.display = 'none';
                    messageField.style.display = 'block';
                } else {
                    emailField.style.display = 'none';
                    messageField.style.display = 'none';
                }
            });
        });

        // Load state from localStorage
        function loadStateFromLocalStorage() {
            const savedState = localStorage.getItem('skyaiState');
            if (savedState) {
                Object.assign(appState, JSON.parse(savedState));
            }
            updateUIFromState();
        }

        // Save state to localStorage
        function saveStateToLocalStorage() {
            localStorage.setItem('skyaiState', JSON.stringify(appState));
        }

        // Update UI from app state
        function updateUIFromState() {
            // Update user info
            document.getElementById('username').textContent = appState.user.name;
            document.getElementById('user-level').textContent = appState.user.level;
            document.getElementById('current-xp').textContent = appState.user.xp;
            document.getElementById('max-xp').textContent = appState.user.maxXp;
            document.getElementById('streak-count').textContent = appState.user.streak;
            
            // Update goal info
            document.getElementById('current-goal-title').textContent = appState.goal.title;
            document.getElementById('current-goal-description').textContent = `Current: ${appState.goal.current} → Goal: ${appState.goal.target}`;
            document.getElementById('goal-progress-bar').style.width = `${appState.goal.progress}%`;
            
            // Update profile form
            document.getElementById('profile-name').value = appState.user.name;
            document.getElementById('profile-email').value = appState.user.email;
            document.getElementById('api-key').value = appState.user.apiKey;
            document.getElementById('profile-streak').value = appState.user.streak;
            document.getElementById('profile-level').value = appState.user.level;
            document.getElementById('profile-xp').value = appState.user.xp;
            document.getElementById('profile-max-xp').value = appState.user.maxXp;
            
            // Update edit goal form
            document.getElementById('edit-goal-title').value = appState.goal.title;
            document.getElementById('edit-current-status').value = appState.goal.current;
            document.getElementById('edit-target-goal').value = appState.goal.target;
            
            // Update XP bar
            updateXPBar();
            
            // Update tasks
            renderTasks();
        }

        // Update XP bar
        function updateXPBar() {
            const percentage = (appState.user.xp / appState.user.maxXp) * 100;
            document.getElementById('xp-bar').style.width = `${percentage}%`;
        }

        // Render tasks
        function renderTasks() {
            const priorityTasksContainer = document.getElementById('priority-tasks');
            const delegateTasksContainer = document.getElementById('delegate-tasks');
            
            // Clear existing tasks
            priorityTasksContainer.innerHTML = '';
            delegateTasksContainer.innerHTML = '';
            
            // Filter and render tasks
            appState.tasks.filter(task => !task.completed).forEach(task => {
                const taskElement = createTaskElement(task);
                if (task.action === 'do') {
                    priorityTasksContainer.appendChild(taskElement);
                } else {
                    delegateTasksContainer.appendChild(taskElement);
                }
            });
        }

        // Create task element
        function createTaskElement(task) {
            const taskCard = document.createElement('div');
            taskCard.className = 'task-card bg-white rounded-lg shadow-md p-4 border-l-4';
            
            // Set border color based on priority
            if (task.priority === 'high') {
                taskCard.classList.add('border-blue-500');
            } else if (task.priority === 'medium') {
                taskCard.classList.add('border-orange-500');
            } else {
                taskCard.classList.add('border-gray-400');
            }
            
            // Priority badge text and color
            let priorityText, priorityBg;
            if (task.priority === 'high') {
                priorityText = 'HIGH IMPACT';
                priorityBg = 'bg-blue-100 text-blue-800';
            } else if (task.priority === 'medium') {
                priorityText = 'MEDIUM IMPACT';
                priorityBg = 'bg-orange-100 text-orange-800';
            } else {
                priorityText = 'LOW IMPACT';
                priorityBg = 'bg-gray-100 text-gray-800';
            }
            
            // Action badge text and color
            const actionText = task.action === 'do' ? 'DO' : 'DELEGATE';
            const actionBg = task.action === 'do' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800';
            
            // Category badge text and color
            let categoryText, categoryBg;
            switch(task.category) {
                case 'ux':
                    categoryText = 'UX';
                    categoryBg = 'bg-yellow-100 text-yellow-800';
                    break;
                case 'content':
                    categoryText = 'CONTENT';
                    categoryBg = 'bg-purple-100 text-purple-800';
                    break;
                case 'design':
                    categoryText = 'DESIGN';
                    categoryBg = 'bg-blue-100 text-blue-800';
                    break;
                case 'marketing':
                    categoryText = 'MARKETING';
                    categoryBg = 'bg-green-100 text-green-800';
                    break;
                case 'development':
                    categoryText = 'DEV';
                    categoryBg = 'bg-indigo-100 text-indigo-800';
                    break;
                default:
                    categoryText = task.category.toUpperCase();
                    categoryBg = 'bg-gray-100 text-gray-800';
            }
            
            // XP value for completing the task
            const xpValue = task.priority === 'high' ? 25 : task.priority === 'medium' ? 15 : 10;
            
            // Build task card HTML
            taskCard.innerHTML = `
                <div class="flex justify-between items-start mb-2">
                    <h3 class="font-medium">${task.name}</h3>
                    <span class="text-xs ${priorityBg} px-2 py-1 rounded-full">${priorityText}</span>
                </div>
                <p class="text-sm text-gray-600 mb-3">${task.description}</p>
                <div class="flex justify-between items-center">
                    <div class="flex space-x-2">
                        <span class="text-xs ${actionBg} px-2 py-1 rounded-full">${actionText}</span>
                        <span class="text-xs ${categoryBg} px-2 py-1 rounded-full">${categoryText}</span>
                    </div>
                    <div class="flex space-x-2">
                        <button class="text-blue-500 text-sm" onclick="shareTask('${task.name}')"><i class="fas fa-share-alt"></i></button>
                        ${task.action === 'do' ? 
                            `<button class="text-green-500 text-sm" onclick="completeTask(this, ${xpValue})"><i class="fas fa-check-circle"></i></button>` : 
                            `<button class="text-blue-500 text-sm" onclick="sendTask('${task.name}')"><i class="fas fa-paper-plane"></i></button>`
                        }
                    </div>
                </div>
            `;
            
            return taskCard;
        }

        // Modal functions
        function showModal(modalId) {
            document.getElementById(modalId).style.display = 'flex';
        }

        function hideModal(modalId) {
            document.getElementById(modalId).style.display = 'none';
        }

        // Navigation functions
        function showHome() {
            appState.currentView = 'home';
            renderCurrentView();
        }

        function showJourney() {
            showModal('journey-modal');
        }

        function showCommunity() {
            appState.currentView = 'community';
            renderCurrentView();
            // In a real app, we would fetch and display community content here
            alert('Community feature coming soon!');
            showHome(); // Fall back to home for now
        }

        function showProfile() {
            showModal('profile-modal');
        }

        function renderCurrentView() {
            // In a real app, we would render different views here
            // For this demo, we're mainly using modals, so we just ensure home is shown
            document.getElementById('main-content').style.display = 'block';
        }

        // Goal functions
        function showEditGoalModal() {
            showModal('edit-goal-modal');
        }

        function saveGoal() {
            appState.goal.title = document.getElementById('edit-goal-title').value;
            appState.goal.current = document.getElementById('edit-current-status').value;
            appState.goal.target = document.getElementById('edit-target-goal').value;
            
            // Calculate new progress (simplified for demo)
            const currentValue = parseFloat(appState.goal.current.replace(/[^0-9.]/g, ''));
            const targetValue = parseFloat(appState.goal.target.replace(/[^0-9.]/g, ''));
            appState.goal.progress = Math.min(100, Math.round((currentValue / targetValue) * 100));
            
            updateUIFromState();
            saveStateToLocalStorage();
            hideModal('edit-goal-modal');
            
            // Update AI recommendation
            updateAIRecommendation();
        }

        function deleteGoal() {
            if (confirm('Are you sure you want to delete this goal?')) {
                appState.goal = {
                    title: "New Goal",
                    current: "Current status",
                    target: "Target goal",
                    progress: 0
                };
                updateUIFromState();
                saveStateToLocalStorage();
                hideModal('edit-goal-modal');
            }
        }

        function showFullJourney() {
            document.getElementById('journey-goal-title').textContent = appState.goal.title;
            showModal('journey-modal');
        }

        function selectMapNode(index) {
            const nodes = document.querySelectorAll('.map-node');
            nodes.forEach(node => node.classList.remove('active'));
            nodes[index].classList.add('active');
            
            // In a real app, we might show details for this milestone
        }

        // Task functions
        function showAddTaskModal() {
            showModal('add-task-modal');
        }

        function addNewTask() {
            const name = document.getElementById('task-name').value;
            const description = document.getElementById('task-description').value;
            const priority = document.getElementById('task-priority').value;
            const action = document.getElementById('task-action').value;
            const category = document.getElementById('task-category').value;
            
            if (!name) {
                alert('Please enter a task name');
                return;
            }
            
            const newTask = {
                id: Date.now(), // Simple unique ID
                name,
                description: description || 'No description',
                priority,
                action,
                category,
                completed: false
            };
            
            appState.tasks.push(newTask);
            renderTasks();
            saveStateToLocalStorage();
            hideModal('add-task-modal');
            
            // Reset form
            document.getElementById('task-name').value = '';
            document.getElementById('task-description').value = '';
        }

        function completeTask(button, xp) {
            const taskCard = button.closest('.task-card');
            const taskName = taskCard.querySelector('h3').textContent;
            
            // Find and mark task as completed
            const task = appState.tasks.find(t => t.name === taskName);
            if (task) {
                task.completed = true;
            }
            
            // Add XP
            appState.user.xp += xp;
            
            // Check for level up
            if (appState.user.xp >= appState.user.maxXp) {
                appState.user.level += 1;
                appState.user.xp = appState.user.xp - appState.user.maxXp;
                appState.user.maxXp = Math.round(appState.user.maxXp * 1.5);
                alert(`Level Up! You're now level ${appState.user.level}`);
            }
            
            // Update streak (simplified for demo)
            appState.user.streak += 1;
            
            // Animate completion
            taskCard.classList.add('opacity-50');
            setTimeout(() => {
                renderTasks();
                updateUIFromState();
                saveStateToLocalStorage();
            }, 300);
        }

        function shareTask(taskName) {
            appState.currentTaskToShare = taskName;
            document.getElementById('share-task-name').value = taskName;
            showModal('share-task-modal');
        }

        function confirmShareTask() {
            const method = document.getElementById('share-method').value;
            const taskName = appState.currentTaskToShare;
            
            let message = `I'd like to share this task with you: ${taskName}`;
            if (method === 'email') {
                const email = document.getElementById('share-email').value;
                if (!email) {
                    alert('Please enter an email address');
                    return;
                }
                message += `\n\nSent to: ${email}`;
            }
            
            const userMessage = document.getElementById('share-message').value;
            if (userMessage) {
                message += `\n\nMessage: ${userMessage}`;
            }
            
            alert(`Task shared via ${method}!\n\n${message}`);
            hideModal('share-task-modal');
            
            // In a real app, we would actually send the email or Slack message here
        }

        function assignTask(taskName) {
            alert(`Task "${taskName}" assigned to a team member!`);
            // In a real app, we would have a proper assignment flow
        }

        function sendTask(taskName) {
            alert(`Task "${taskName}" sent to external tool!`);
            // In a real app, we would integrate with actual tools
        }

        function showAllTasks(type) {
            alert(`Showing all ${type} tasks`);
            // In a real app, we would navigate to a task list view
        }

        // Profile functions
        function saveProfile() {
            appState.user.name = document.getElementById('profile-name').value;
            appState.user.email = document.getElementById('profile-email').value;
            appState.user.apiKey = document.getElementById('api-key').value;
            appState.user.streak = parseInt(document.getElementById('profile-streak').value);
            appState.user.level = parseInt(document.getElementById('profile-level').value);
            appState.user.xp = parseInt(document.getElementById('profile-xp').value);
            appState.user.maxXp = parseInt(document.getElementById('profile-max-xp').value);
            
            updateUIFromState();
            saveStateToLocalStorage();
            hideModal('profile-modal');
        }

        // AI functions
        function showAIChatModal() {
            // Render chat messages
            const chatContainer = document.getElementById('chat-messages');
            chatContainer.innerHTML = '';
            
            appState.chatMessages.forEach(message => {
                const messageDiv = document.createElement('div');
                messageDiv.className = `chat-message ${message.sender === 'user' ? 'user-message' : 'ai-message'}`;
                messageDiv.textContent = message.content;
                chatContainer.appendChild(messageDiv);
            });
            
            showModal('ai-chat-modal');
            document.getElementById('chat-input').focus();
        }

        function sendChatMessage() {
            const input = document.getElementById('chat-input');
            const message = input.value.trim();
            
            if (!message) return;
            
            // Add user message to chat
            appState.chatMessages.push({
                sender: 'user',
                content: message
            });
            
            // Clear input
            input.value = '';
            
            // Show "AI is typing" indicator
            const chatContainer = document.getElementById('chat-messages');
            const typingIndicator = document.createElement('div');
            typingIndicator.className = 'chat-message ai-message';
            typingIndicator.textContent = 'AI is typing...';
            chatContainer.appendChild(typingIndicator);
            chatContainer.scrollTop = chatContainer.scrollHeight;
            
            // Process message with AI (simulated for demo)
            setTimeout(() => {
                // Remove typing indicator
                chatContainer.removeChild(typingIndicator);
                
                // Add AI response
                const aiResponse = getAIResponse(message);
                appState.chatMessages.push({
                    sender: 'ai',
                    content: aiResponse
                });
                
                // Update chat UI
                const messageDiv = document.createElement('div');
                messageDiv.className = 'chat-message ai-message';
                messageDiv.textContent = aiResponse;
                chatContainer.appendChild(messageDiv);
                chatContainer.scrollTop = chatContainer.scrollHeight;
                
                saveStateToLocalStorage();
            }, 1000);
        }

        function getAIResponse(message) {
            // In a real app, this would call the Deepseek API
            // For demo purposes, we're using simple pattern matching
            
            // Check if API key is set
            if (!appState.user.apiKey) {
                return "Please set your Deepseek API key in your profile to use the full AI capabilities. For now, I can only provide basic responses.";
            }
            
            // Simple pattern matching for demo purposes
            const lowerMessage = message.toLowerCase();
            
            if (lowerMessage.includes('hello') || lowerMessage.includes('hi')) {
                return "Hello! How can I assist you with your business goals today?";
            } else if (lowerMessage.includes('goal') || lowerMessage.includes('target')) {
                return `Based on your current goal to ${appState.goal.title}, I recommend focusing on high-impact activities that directly contribute to this outcome. Have you considered optimizing your conversion funnel?`;
            } else if (lowerMessage.includes('task') || lowerMessage.includes('prioritize')) {
                return "For maximum impact, prioritize tasks that directly affect your revenue or customer acquisition. Delegate or automate lower-impact tasks when possible.";
            } else if (lowerMessage.includes('help') || lowerMessage.includes('advice')) {
                return "I'd be happy to help! Could you provide more details about what you're working on? For example, are you looking for marketing, product, or operational advice?";
            } else if (lowerMessage.includes('mrr') || lowerMessage.includes('revenue')) {
                return "To increase your MRR, focus on: 1) Improving conversion rates, 2) Reducing churn, and 3) Expanding your offerings. Would you like me to generate specific tactics for any of these areas?";
            } else {
                return "I'm here to help you achieve your business goals. Could you clarify or provide more details about your question?";
            }
        }

        function updateAIRecommendation() {
            // In a real app, this would call the Deepseek API with the current goal
            // For demo, we're using a simple template
            document.getElementById('ai-recommendation').textContent = 
                `"Based on your current progress toward ${appState.goal.title}, I recommend focusing on high-leverage activities that will move you from ${appState.goal.current} to ${appState.goal.target}."`;
        }

        // Handle Enter key in chat
        document.getElementById('chat-input').addEventListener('keypress', function(e) {
            if (e.key === 'Enter') {
                sendChatMessage();
            }
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=JayStormX8/sky-ai-goals-game" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>