-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
3036 lines (2950 loc) · 162 KB
/
Copy pathindex.html
File metadata and controls
3036 lines (2950 loc) · 162 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>Local Project Whiteboard</title>
<style>
:root {
--bg-color: #f4f4f9;
--card-bg: #ffffff;
--primary: #4a90e2;
--text: #333333;
--text-muted: #666666;
--toolbar-bg: #ffffff;
--border-color: #e0e0e0;
--canvas-bg: #e5e5f7;
--canvas-grid: radial-gradient(#444cf7 0.8px, transparent 0.8px), radial-gradient(#444cf7 0.8px, #e5e5f7 0.8px);
--shadow: 0 4px 12px rgba(0,0,0,0.1);
--text-primary: #1f2937;
--text-secondary: #374151;
--button-blur: 0px;
--button-blur-size: 0px;
--project-primary: var(--primary);
--project-bg: var(--canvas-bg);
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text); overflow: hidden; height: 100vh; transition: background-color 0.3s, color 0.3s; }
/* --- Backgrounds --- */
.bg-dot { background-color: var(--project-bg); background-image: var(--canvas-grid); background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.bg-graph { background-color: var(--project-bg); background-image: linear-gradient(var(--border-color) 1px, transparent 1px), linear-gradient(90deg, var(--border-color) 1px, transparent 1px); background-size: 20px 20px; }
.bg-blank { background-color: var(--project-bg); background-image: none; }
.bg-live { background: linear-gradient(-45deg, #e5e5f7, #a1c4fd, #c2e9fb, #e5e5f7); background-size: 400% 400%; animation: gradientBG 15s ease infinite; }
@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.bg-falling-stars { background-color: #000030; overflow: hidden; }
.starfall { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.falling-star { width: 8px; height: 8px; background: #00d1b2; position: absolute; border-radius: 50%; opacity: 0.5; animation: starfall-anim linear infinite; }
@keyframes starfall-anim { 0% { transform: translateY(-10vh); opacity: 0; } 10% { opacity: 0.8; box-shadow: 0 0 5px #fff; } 90% { opacity: 0.8; } 100% { transform: translateY(110vh); opacity: 0; } }
.bg-shooting-stars { background: #000000; overflow: hidden; position: relative; }
.bg-shooting-stars canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; }
.bg-matrix { background: #000; overflow: hidden; }
.bg-matrix canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; }
.bg-aurora { background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%); background-size: 400% 400%; animation: auroraBG 20s ease infinite; }
@keyframes auroraBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.bg-cyberpunk { background-color: #0a0015; background-image: linear-gradient(rgba(255, 0, 255, 0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px), radial-gradient(ellipse at top, rgba(255, 0, 255, 0.15), transparent 50%), radial-gradient(ellipse at bottom, rgba(0, 255, 255, 0.15), transparent 50%); background-size: 40px 40px, 40px 40px, 100% 100%, 100% 100%; }
.bg-paper { background-color: #faf8f3; background-image: radial-gradient(circle at 20% 30%, rgba(139, 115, 85, 0.03) 0%, transparent 50%), radial-gradient(circle at 80% 70%, rgba(139, 115, 85, 0.03) 0%, transparent 50%); }
.bg-neon { background-color: #0a0a1a; background-image: linear-gradient(rgba(0, 255, 170, 0.15) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 0, 200, 0.15) 1px, transparent 1px); background-size: 50px 50px; }
.bg-pastel { background-color: #fdf6f0; background-image: radial-gradient(circle at 10% 20%, rgba(255, 182, 193, 0.3) 0%, transparent 40%), radial-gradient(circle at 90% 80%, rgba(173, 216, 230, 0.3) 0%, transparent 40%), radial-gradient(circle at 50% 50%, rgba(221, 190, 255, 0.2) 0%, transparent 50%); }
/* --- Dashboard --- */
#dashboard { padding: 40px; height: 100vh; overflow-y: auto; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 15px; flex-wrap: wrap; }
.header h1 { color: var(--text-primary); }
.global-search { display: flex; gap: 10px; align-items: center; flex: 1; max-width: 400px; position: relative; }
.global-search input { flex: 1; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 14px; background: var(--card-bg); color: var(--text); outline: none; }
.global-search input:focus { border-color: var(--primary); }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 6px; max-height: 300px; overflow-y: auto; box-shadow: var(--shadow); z-index: 100; margin-top: 4px; display: none; }
.search-results.active { display: block; }
.search-result-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-color); font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.search-result-item:hover { background: var(--bg-color); }
.search-result-type { font-size: 10px; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; background: var(--primary); color: white; margin-left: 8px; }
.sort-controls { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.sort-btn, .filter-btn { padding: 8px 16px; background: var(--card-bg); color: var(--text); border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.sort-btn:hover, .filter-btn:hover { background: var(--border-color); }
.sort-btn.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 0 var(--button-blur-size) var(--button-blur) var(--primary); }
.project-countdown { margin-top: 12px; padding: 10px; background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 6px; color: white; font-size: 12px; }
.project-countdown.urgent { background: linear-gradient(135deg, #f093fb, #f5576c); }
.project-countdown.expired { background: linear-gradient(135deg, #dc3545, #c82333); }
.countdown-label-small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.9; margin-bottom: 4px; }
.countdown-time { font-size: 16px; font-weight: bold; display: flex; gap: 8px; flex-wrap: wrap; }
.countdown-unit { display: flex; flex-direction: column; align-items: center; }
.countdown-value-small { font-size: 18px; line-height: 1; color: white; }
.countdown-label-tiny { font-size: 9px; opacity: 0.8; margin-top: 2px; }
.btn:not(.btn-secondary) { padding: 10px 20px; background: var(--primary) !important; color: white !important; border: none !important; border-radius: 6px; cursor: pointer; font-size: 14px; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 0 var(--button-blur-size) var(--button-blur) var(--primary); }
.btn:not(.btn-secondary):hover { opacity: 0.9; }
.btn-secondary { background: var(--toolbar-bg) !important; color: var(--text) !important; border: 1px solid var(--border-color) !important; }
.btn-secondary:hover { background: var(--border-color) !important; }
.btn-icon { padding: 8px; border-radius: 6px; }
.btn-small { padding: 6px 12px; font-size: 12px; }
.toolbar .btn-secondary, .toolbar-right .btn-secondary { background: rgba(255, 255, 255, 0.15) !important; color: var(--text) !important; border: 1px solid rgba(255, 255, 255, 0.2) !important; }
.toolbar .btn-secondary:hover, .toolbar-right .btn-secondary:hover { background: rgba(255, 255, 255, 0.25) !important; }
#connect-btn.active, #gantt-toggle-btn.active, #snap-btn.active, #focus-btn.active, #dep-btn.active, #select-btn.active { background: var(--primary) !important; color: white !important; border-color: var(--primary) !important; box-shadow: 0 0 var(--button-blur-size) var(--button-blur) var(--primary); }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.project-card { background: var(--card-bg); padding: 20px; border-radius: 8px; box-shadow: var(--shadow); cursor: pointer; position: relative; transition: transform 0.2s; border: 1px solid var(--border-color); }
.project-card:hover { transform: translateY(-3px); }
.project-card h3 { margin-bottom: 8px; font-size: 18px; color: var(--text-primary); }
.project-card p { color: var(--text-muted); font-size: 14px; line-height: 1.4; }
.edit-icon { position: absolute; top: 15px; right: 15px; cursor: pointer; color: var(--text-muted); padding: 5px; border-radius: 4px; }
.edit-icon:hover { color: var(--primary); background: rgba(0,0,0,0.05); }
.project-tags { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.project-tag { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--primary); color: white; }
/* --- Whiteboard --- */
#whiteboard { display: none; width: 100vw; height: 100vh; position: fixed; top: 0; left: 0; overflow: hidden; z-index: 100; }
#whiteboard.active { display: block; }
#whiteboard.panning { cursor: grabbing !important; }
#whiteboard.panning * { cursor: grabbing !important; }
#whiteboard.selecting { cursor: crosshair !important; }
.toolbar { position: fixed; top: 20px; left: 20px; z-index: 1000; background: var(--toolbar-bg); padding: 8px; border-radius: 8px; box-shadow: var(--shadow); display: flex; gap: 8px; border: 1px solid var(--border-color); flex-wrap: wrap; max-width: calc(100vw - 400px); }
.toolbar-right { position: fixed; top: 20px; right: 20px; z-index: 1000; background: var(--toolbar-bg); padding: 8px; border-radius: 8px; box-shadow: var(--shadow); display: flex; gap: 8px; border: 1px solid var(--border-color); }
.toolbar-bottom { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; background: var(--toolbar-bg); padding: 8px; border-radius: 8px; box-shadow: var(--shadow); display: flex; gap: 8px; border: 1px solid var(--border-color); }
/* Note templates submenu */
.note-menu-wrapper { position: relative; display: inline-block; }
.note-menu { position: absolute; top: 100%; left: 0; margin-top: 4px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 6px; box-shadow: var(--shadow); padding: 4px; min-width: 160px; display: none; z-index: 1001; }
.note-menu.active { display: block; }
.note-menu-item { padding: 8px 12px; cursor: pointer; border-radius: 4px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.note-menu-item:hover { background: var(--bg-color); }
/* --- World Info Widget --- */
.world-widget { position: fixed; bottom: 20px; left: 20px; z-index: 999; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 14px; min-width: 220px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.world-widget-row { display: flex; align-items: center; gap: 8px; }
.world-widget-icon { font-size: 18px; }
.world-widget-main { display: flex; align-items: center; gap: 10px; }
.world-weather-temp { font-size: 22px; font-weight: bold; color: var(--text-primary); }
.world-weather-desc { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.world-location { font-size: 10px; color: var(--text-muted); }
.world-time { font-size: 14px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.world-date { font-size: 11px; color: var(--text-muted); }
.world-quote { font-size: 11px; font-style: italic; color: var(--text-muted); border-top: 1px solid var(--border-color); padding-top: 6px; margin-top: 2px; line-height: 1.4; }
/* --- Stats Bar --- */
.stats-bar { position: fixed; top: 80px; right: 20px; z-index: 999; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 12px; font-size: 11px; display: flex; gap: 12px; color: var(--text-muted); }
.stat-item { display: flex; align-items: center; gap: 4px; }
.stat-value { font-weight: 600; color: var(--text-primary); }
/* --- Save indicator --- */
.save-indicator { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 20px; padding: 4px 12px; font-size: 11px; z-index: 1001; opacity: 0; transition: opacity 0.3s; pointer-events: none; box-shadow: var(--shadow); }
.save-indicator.show { opacity: 1; }
.save-indicator.saving { color: #f59e0b; }
.save-indicator.saved { color: #10b981; }
/* --- Pomodoro --- */
.pomodoro-widget { position: fixed; bottom: 20px; right: 320px; z-index: 999; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 14px; display: none; align-items: center; gap: 10px; font-size: 12px; }
.pomodoro-widget.active { display: flex; }
.pomodoro-time { font-size: 20px; font-weight: bold; color: var(--text-primary); font-variant-numeric: tabular-nums; min-width: 60px; text-align: center; }
.pomodoro-mode { font-size: 10px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.pomodoro-btn { background: var(--primary); color: white; border: none; border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 11px; }
.pomodoro-btn:hover { opacity: 0.9; }
.pomodoro-btn.secondary { background: var(--border-color); color: var(--text); }
/* --- Minimap --- */
.minimap { position: fixed; bottom: 20px; right: 20px; width: 200px; height: 150px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: var(--shadow); z-index: 999; overflow: hidden; cursor: pointer; }
.minimap.hidden { display: none; }
.minimap-canvas { width: 100%; height: 100%; display: block; }
.minimap-viewport { position: absolute; border: 2px solid var(--primary); background: rgba(74, 144, 226, 0.15); pointer-events: none; }
.minimap-toggle { position: fixed; bottom: 180px; right: 20px; z-index: 1000; background: var(--toolbar-bg); border: 1px solid var(--border-color); border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 12px; box-shadow: var(--shadow); }
.project-countdown-widget { position: fixed; bottom: 20px; left: 260px; z-index: 1000; background: var(--toolbar-bg); padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow); border: 1px solid var(--border-color); min-width: 200px; }
.project-countdown-widget .countdown-title { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.project-countdown-widget .countdown-display { display: flex; gap: 12px; align-items: center; }
.project-countdown-widget .time-unit { display: flex; flex-direction: column; align-items: center; }
.project-countdown-widget .time-value { font-size: 24px; font-weight: bold; color: var(--text-primary); line-height: 1; }
.project-countdown-widget .time-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; margin-top: 2px; }
.project-countdown-widget.urgent .time-value { color: #f5576c; }
.project-countdown-widget.expired { background: linear-gradient(135deg, #dc3545, #c82333); color: white; }
.project-countdown-widget.expired .time-value, .project-countdown-widget.expired .time-label, .project-countdown-widget.expired .countdown-title { color: white; }
#canvas-wrapper { width: 3000px; height: 3000px; position: relative; transform-origin: 0 0; transition: transform 0.05s ease-out; }
#svg-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
#svg-layer line { stroke: var(--text-muted); stroke-width: 2; pointer-events: auto; cursor: pointer; transition: stroke 0.2s; }
#svg-layer line:hover { stroke: #dc3545; stroke-width: 3; }
#svg-layer line.dependency { stroke: #f59e0b; stroke-dasharray: 5,5; }
#svg-layer line.dependency:hover { stroke: #dc2626; }
#svg-layer polygon { fill: var(--text-muted); pointer-events: none; }
#svg-layer text.conn-label { fill: var(--text); font-size: 11px; pointer-events: auto; cursor: pointer; }
.align-guide { position: absolute; background: #f59e0b; z-index: 50; pointer-events: none; }
.align-guide.horizontal { height: 1px; width: 100%; left: 0; }
.align-guide.vertical { width: 1px; height: 100%; top: 0; }
.select-box { position: absolute; border: 2px dashed var(--primary); background: rgba(74, 144, 226, 0.1); pointer-events: none; z-index: 100; }
/* --- Gantt --- */
.gantt-container { position: absolute; background: transparent; overflow: visible; }
.gantt-header { display: flex; position: sticky; top: 0; z-index: 20; }
.gantt-header.horizontal { flex-direction: column; position: sticky; left: 0; }
.gantt-day-header { padding: 10px 8px; border-right: 2px solid var(--project-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; position: relative; user-select: none; background: var(--card-bg); color: var(--text-primary); }
.gantt-day-header.horizontal { border-right: none; border-bottom: 2px solid var(--project-primary); flex-direction: row; justify-content: flex-start; padding: 8px 12px; gap: 10px; }
.gantt-day-header .day-name { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; color: var(--text-muted); }
.gantt-day-header .day-number { font-size: 20px; font-weight: bold; line-height: 1; margin: 2px 0; color: var(--text-primary); }
.gantt-day-header .day-month { font-size: 10px; opacity: 0.8; color: var(--text-muted); }
.gantt-day-header.today { background: rgba(74, 144, 226, 0.15); }
.gantt-day-header.today .day-number { color: var(--project-primary); }
.gantt-day-header.weekend { background: rgba(74, 144, 226, 0.05); }
.gantt-add-btn { position: absolute; bottom: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--project-primary); color: white; border: none; cursor: pointer; font-size: 16px; font-weight: bold; line-height: 1; display: flex; align-items: center; justify-content: center; opacity: 0.6; transition: opacity 0.2s, transform 0.1s; z-index: 5; padding: 0; }
.gantt-add-btn:hover { opacity: 1; transform: scale(1.15); }
.gantt-day-header.horizontal .gantt-add-btn { bottom: 50%; transform: translateY(50%); right: 8px; }
.gantt-body { display: flex; position: relative; }
.gantt-body.horizontal { flex-direction: column; }
.gantt-column { border-right: 2px solid var(--project-primary); position: relative; min-height: 600px; background: transparent; transition: background 0.2s; }
.gantt-column:last-child { border-right: none; }
.gantt-column:hover { background: rgba(74, 144, 226, 0.04); }
.gantt-column.weekend { background: rgba(74, 144, 226, 0.06); }
.gantt-row { border-bottom: 2px solid var(--project-primary); position: relative; min-width: 800px; background: transparent; display: flex; align-items: stretch; transition: background 0.2s; }
.gantt-row:last-child { border-bottom: none; }
.gantt-row:hover { background: rgba(74, 144, 226, 0.04); }
.gantt-row.weekend { background: rgba(74, 144, 226, 0.06); }
.gantt-resize-handle { position: absolute; background: transparent; z-index: 25; transition: background 0.2s; }
.gantt-resize-handle:hover, .gantt-resize-handle.active { background: var(--project-primary); opacity: 0.5; }
.gantt-resize-handle.vertical { top: 0; width: 6px; height: 100%; cursor: col-resize; }
.gantt-resize-handle.horizontal-handle { left: 0; height: 6px; width: 100%; cursor: row-resize; }
/* --- Elements --- */
.wb-element { position: absolute; cursor: grab; user-select: none; }
.wb-element:active { cursor: grabbing; }
.wb-element.selected { outline: 2px dashed var(--primary); outline-offset: 4px; }
.wb-element.pinned::before { content: '📌'; position: absolute; top: -12px; left: -8px; font-size: 14px; z-index: 12; }
.wb-element.locked { cursor: not-allowed; opacity: 0.95; }
.wb-element.locked::after { content: '🔒'; position: absolute; top: -12px; right: -8px; font-size: 12px; z-index: 12; }
.wb-element.search-match { outline: 3px solid #f59e0b !important; outline-offset: 4px; animation: pulse-match 1s ease-in-out infinite; }
@keyframes pulse-match { 0%, 100% { outline-offset: 4px; } 50% { outline-offset: 8px; } }
.wb-element.dimmed { opacity: 0.2; filter: grayscale(0.5); }
.wb-element.idea-spawn { animation: idea-pop 0.5s ease-out; }
@keyframes idea-pop { 0% { transform: scale(0) rotate(-180deg); opacity: 0; } 70% { transform: scale(1.1) rotate(10deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.group-box { z-index: 5; background: rgba(74, 144, 226, 0.1); border: 2px dashed var(--primary); border-radius: 12px; min-width: 200px; min-height: 150px; padding: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.sticky-note, .image-el { z-index: 10; }
.sticky-note { min-height: 140px; min-width: 150px; border-radius: 4px; padding: 12px; box-shadow: 2px 4px 8px rgba(0,0,0,0.15); display: flex; flex-direction: column; border: 1px solid rgba(0,0,0,0.1); position: relative; }
.sticky-note textarea { flex: 1; background: transparent; border: none; resize: none; outline: none; font-family: inherit; font-size: 14px; width: 100%; color: #222 !important; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.sticky-note textarea::-webkit-scrollbar { display: none; }
.note-yellow { background: #fef3c7; }
.note-blue { background: #dbeafe; }
.note-green { background: #d1fae5; }
.note-pink { background: #fce7f3; }
.note-red { background: #fee2e2; }
.sticky-note.urgent-glow { box-shadow: 0 0 12px 2px rgba(239, 68, 68, 0.6), 2px 4px 8px rgba(0,0,0,0.15); }
.color-picker { display: flex; gap: 6px; margin-top: 8px; justify-content: center; opacity: 0; transition: opacity 0.2s; }
.wb-element:hover .color-picker { opacity: 1; }
.color-dot { width: 16px; height: 16px; border-radius: 50%; cursor: pointer; border: 2px solid rgba(0,0,0,0.1); transition: transform 0.1s; }
.color-dot:hover { transform: scale(1.2); }
.color-dot.c-yellow { background: #fef3c7; }
.color-dot.c-blue { background: #dbeafe; }
.color-dot.c-green { background: #d1fae5; }
.color-dot.c-pink { background: #fce7f3; }
.color-dot.c-red { background: #fee2e2; }
.note-tags { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 6px; }
.note-tag { font-size: 9px; padding: 1px 6px; border-radius: 8px; background: rgba(0,0,0,0.15); color: #222; cursor: pointer; }
.note-tag:hover { background: rgba(0,0,0,0.25); }
.progress-bar { height: 4px; background: rgba(0,0,0,0.1); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); transition: width 0.3s; }
.progress-label { font-size: 9px; color: #555; margin-top: 2px; text-align: right; }
.note-checkbox { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.note-checkbox input { width: 16px; height: 16px; cursor: pointer; }
.note-checkbox.done textarea { text-decoration: line-through; opacity: 0.6; }
.delete-el { position: absolute; top: -8px; right: -8px; background: #dc3545; color: white; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 14px; display: none; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.2); z-index: 11; }
.wb-element:hover .delete-el { display: flex; }
.pin-el { position: absolute; top: -8px; left: -8px; background: #f59e0b; color: white; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 12px; display: none; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.2); z-index: 11; }
.lock-el { position: absolute; top: -8px; left: 16px; background: #6b7280; color: white; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 12px; display: none; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.2); z-index: 11; }
.wb-element:hover .pin-el, .wb-element:hover .lock-el { display: flex; }
.wb-element.pinned .pin-el { display: flex; background: #d97706; }
.wb-element.locked .lock-el { display: flex; background: #4b5563; }
.image-el { max-width: 300px; border-radius: 4px; box-shadow: 2px 4px 8px rgba(0,0,0,0.2); background: white; }
.image-el img { width: 100%; height: auto; display: block; border-radius: 4px; pointer-events: none; }
.group-title { font-weight: bold; font-size: 14px; margin-bottom: 8px; padding: 4px 8px; background: rgba(74, 144, 226, 0.2); border-radius: 4px; text-align: center; }
.group-title-input { background: transparent; border: none; outline: none; font-weight: bold; font-size: 14px; color: #fff !important; text-shadow: 0 1px 2px rgba(0,0,0,0.5); width: 100%; text-align: center; cursor: text; }
.resize-handle { position: absolute; bottom: 0; right: 0; width: 20px; height: 20px; cursor: se-resize; background: linear-gradient(135deg, transparent 50%, var(--primary) 50%); border-bottom-right-radius: 8px; opacity: 0.6; z-index: 6; }
.resize-handle:hover { opacity: 1; }
.connect-mode-hint { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: #333; color: white; padding: 10px 20px; border-radius: 20px; font-size: 14px; display: none; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.pan-hint { position: fixed; bottom: 30px; right: 320px; background: rgba(0,0,0,0.7); color: white; padding: 6px 12px; border-radius: 12px; font-size: 11px; z-index: 999; pointer-events: none; opacity: 0.7; }
.context-menu { position: fixed; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 6px; box-shadow: var(--shadow); padding: 4px; z-index: 2000; min-width: 180px; display: none; }
.context-menu.active { display: block; }
.context-menu-item { padding: 8px 12px; cursor: pointer; border-radius: 4px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.context-menu-item:hover { background: var(--bg-color); }
.context-menu-divider { height: 1px; background: var(--border-color); margin: 4px 0; }
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 2000; justify-content: center; align-items: center; backdrop-filter: blur(2px); }
.modal-overlay.active { display: flex; }
.modal { background: var(--card-bg); padding: 30px; border-radius: 12px; width: 500px; max-height: 80vh; overflow-y: auto; box-shadow: 0 10px 25px rgba(0,0,0,0.3); border: 1px solid var(--border-color); }
.modal.wide { width: 700px; }
.modal h2 { margin-bottom: 20px; font-size: 20px; color: var(--text-primary); }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--text); }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 14px; background: var(--bg-color); color: var(--text); }
.form-group textarea { height: 80px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.deadline-section { background: var(--bg-color); padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); margin-bottom: 15px; }
.deadline-toggle { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.deadline-toggle input[type="checkbox"] { width: auto; }
.deadline-dates { display: none; gap: 10px; margin-top: 10px; }
.deadline-dates.show { display: grid; grid-template-columns: 1fr 1fr; }
.setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.setting-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.setting-row label { color: var(--text); }
.blur-slider-group { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.blur-slider-label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.blur-slider-value { font-weight: 600; color: var(--primary); }
.tags-input-container { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-color); min-height: 40px; align-items: center; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--primary); color: white; border-radius: 12px; font-size: 12px; }
.tag-chip-remove { cursor: pointer; font-weight: bold; opacity: 0.8; }
.tag-chip-remove:hover { opacity: 1; }
.tags-input { border: none; outline: none; background: transparent; flex: 1; min-width: 80px; font-size: 13px; padding: 4px; }
.templates-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.template-card { padding: 15px; border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.template-card:hover { border-color: var(--primary); background: rgba(74, 144, 226, 0.05); transform: translateY(-2px); }
.template-card h4 { margin-bottom: 4px; color: var(--text-primary); }
.template-card p { font-size: 12px; color: var(--text-muted); }
.trash-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 6px; }
.trash-item { padding: 10px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.trash-item:last-child { border-bottom: none; }
.trash-item-actions { display: flex; gap: 6px; }
.filter-sidebar { position: fixed; top: 0; right: -300px; width: 300px; height: 100vh; background: var(--card-bg); border-left: 1px solid var(--border-color); box-shadow: var(--shadow); z-index: 1500; padding: 20px; transition: right 0.3s; overflow-y: auto; }
.filter-sidebar.active { right: 0; }
.filter-sidebar h3 { margin-bottom: 15px; }
.filter-section { margin-bottom: 20px; }
.filter-section h4 { font-size: 13px; margin-bottom: 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-option { display: flex; align-items: center; gap: 8px; padding: 6px; cursor: pointer; border-radius: 4px; font-size: 13px; }
.filter-option:hover { background: var(--bg-color); }
.filter-option input { width: auto; }
.idea-banner { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, #f093fb, #f5576c); color: white; padding: 12px 24px; border-radius: 24px; box-shadow: var(--shadow); z-index: 1001; display: none; align-items: center; gap: 12px; font-size: 14px; animation: idea-slide 0.5s ease-out; }
.idea-banner.active { display: flex; }
@keyframes idea-slide { from { transform: translate(-50%, -50px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: #333; color: white; padding: 10px 20px; border-radius: 20px; font-size: 13px; z-index: 3000; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.toast.show { opacity: 1; }
.theme-presets-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.theme-preset { padding: 12px; border: 2px solid var(--border-color); border-radius: 8px; cursor: pointer; transition: all 0.2s; text-align: center; font-size: 12px; font-weight: 600; }
.theme-preset:hover { transform: translateY(-2px); }
.theme-preset.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.theme-preset.cyberpunk { background: linear-gradient(135deg, #0a0015, #2d004d); color: #ff00ff; }
.theme-preset.paper { background: #faf8f3; color: #6b5d4a; }
.theme-preset.neon { background: linear-gradient(135deg, #0a0a1a, #1a1a2e); color: #00ffaa; }
.theme-preset.pastel { background: linear-gradient(135deg, #fdf6f0, #fce7f3); color: #9d6b8a; }
.theme-preset.default { background: linear-gradient(135deg, #e5e5f7, #f4f4f9); color: #4a90e2; }
.keybinds-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.keybind-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: var(--bg-color); border-radius: 6px; border: 1px solid var(--border-color); }
.keybind-desc { font-size: 14px; color: var(--text); }
.keybind-keys { display: flex; gap: 4px; }
.key { display: inline-block; padding: 4px 8px; background: var(--toolbar-bg); border: 1px solid var(--border-color); border-radius: 4px; font-family: monospace; font-size: 12px; font-weight: bold; color: var(--primary); box-shadow: 0 2px 0 var(--border-color); }
#image-input, #import-input { display: none; }
/* --- Radio Player --- */
.radio-player { position: fixed; bottom: 20px; right: 20px; z-index: 1500; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: var(--shadow); display: flex; align-items: center; padding: 8px; gap: 12px; width: 52px; transition: width 0.3s ease; overflow: hidden; }
.radio-player.expanded { width: 280px; padding: 12px 16px; }
.radio-eq { width: 36px; height: 36px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; cursor: pointer; flex-shrink: 0; background: rgba(128, 128, 128, 0.1); border-radius: 8px; padding: 6px 0; }
.radio-eq-bar { width: 4px; background: var(--text-muted); border-radius: 2px; height: 4px; transition: height 0.2s, background 0.2s; }
.radio-player.playing .radio-eq-bar { background: var(--primary); }
.radio-player.playing .radio-eq-bar:nth-child(1) { animation: eq 0.8s infinite ease-in-out; }
.radio-player.playing .radio-eq-bar:nth-child(2) { animation: eq 0.6s infinite ease-in-out 0.1s; }
.radio-player.playing .radio-eq-bar:nth-child(3) { animation: eq 0.9s infinite ease-in-out 0.2s; }
.radio-player.playing .radio-eq-bar:nth-child(4) { animation: eq 0.7s infinite ease-in-out 0.3s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 20px; } }
.radio-controls { display: none; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.radio-player.expanded .radio-controls { display: flex; }
.radio-station-name { font-size: 13px; font-weight: 600; color: var(--text); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-buttons { display: flex; justify-content: center; align-items: center; gap: 16px; }
.radio-btn { background: none; border: none; cursor: pointer; color: var(--text); transition: transform 0.1s, color 0.1s; padding: 4px; display: flex; align-items: center; justify-content: center; }
.radio-btn:hover { transform: scale(1.15); color: var(--primary); }
.radio-btn.play-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--border-color); color: var(--text); transition: background 0.2s, color 0.2s, transform 0.1s; }
.radio-btn.play-btn:hover { transform: scale(1.05); }
.radio-player.playing .radio-btn.play-btn { background: var(--primary); color: #ffffff; }
#radio-volume { width: 100%; cursor: pointer; accent-color: var(--primary); height: 4px; }
</style>
</head>
<body>
<div id="dashboard">
<div class="header">
<h1>My Projects</h1>
<div class="global-search">
<input type="text" id="dashboard-search" placeholder="🔍 Search projects..." oninput="searchProjects(this.value)" onfocus="showSearchResults()" onblur="setTimeout(hideSearchResults, 200)">
<div class="search-results" id="dashboard-search-results"></div>
</div>
<button class="btn" onclick="document.getElementById('import-input').click()">📥 Import</button>
<input type="file" id="import-input" accept=".json" onchange="handleImportFile(event)">
<button class="btn" onclick="openTemplateModal()">📋 Templates</button>
<button class="btn" onclick="openModal()">+ New Project</button>
</div>
<div class="sort-controls">
<button class="sort-btn active" onclick="sortProjects('default')" id="sort-default">Default</button>
<button class="sort-btn" onclick="sortProjects('deadline')" id="sort-deadline">By Due Date</button>
<button class="sort-btn" onclick="sortProjects('time-remaining')" id="sort-time">By Time Remaining</button>
<button class="filter-btn" onclick="toggleFilterSidebar()">🔍 Filter</button>
</div>
<div class="project-grid" id="project-list"></div>
<div style="text-align: center; margin-top: 40px; color: var(--text-muted); font-size: 13px;">100% Local & Offline • Data saved in your browser</div>
</div>
<div class="filter-sidebar" id="filter-sidebar">
<h3>Filter Projects</h3>
<div class="filter-section"><h4>Tags</h4><div id="filter-tags-list"></div></div>
<div class="filter-section">
<h4>Status</h4>
<label class="filter-option"><input type="checkbox" id="filter-has-deadline"> Has Deadline</label>
<label class="filter-option"><input type="checkbox" id="filter-overdue"> Overdue</label>
<label class="filter-option"><input type="checkbox" id="filter-urgent"> Urgent (<24h)</label>
</div>
<div class="modal-actions">
<button class="btn btn-secondary" onclick="clearFilters()">Clear</button>
<button class="btn" onclick="applyFilters(); toggleFilterSidebar()">Apply</button>
</div>
</div>
<div id="whiteboard" class="bg-dot">
<div class="toolbar">
<button class="btn btn-icon" onclick="closeWhiteboard()" title="Back">←</button>
<div class="note-menu-wrapper">
<button class="btn" onclick="toggleNoteMenu(event)">+ Note ▾</button>
<div class="note-menu" id="note-menu">
<div class="note-menu-item" onclick="addStickyNote('blank')">📝 Blank Note</div>
<div class="note-menu-item" onclick="addStickyNote('todo')">☑️ Todo</div>
<div class="note-menu-item" onclick="addStickyNote('idea')">💡 Idea</div>
<div class="note-menu-item" onclick="addStickyNote('question')">❓ Question</div>
<div class="note-menu-item" onclick="addStickyNote('meeting')">👥 Meeting Notes</div>
<div class="note-menu-item" onclick="addStickyNote('bug')">🐛 Bug Report</div>
</div>
</div>
<button class="btn" onclick="addGroupBox()">+ Group</button>
<button class="btn" onclick="document.getElementById('image-input').click()">🖼️</button>
<input type="file" id="image-input" accept="image/*" onchange="handleImageSelect(event)">
<button class="btn" id="connect-btn" onclick="toggleConnectMode()">🔗 Connect</button>
<button class="btn" id="dep-btn" onclick="toggleDependencyMode()">⛓️ Dep</button>
<button class="btn" id="select-btn" onclick="toggleSelectMode()" title="Drag Select">⬚ Select</button>
<div style="width: 1px; background: var(--border-color); margin: 0 4px;"></div>
<button class="btn" id="gantt-toggle-btn" onclick="toggleGanttView()">📊 Gantt</button>
<button class="btn" id="gantt-orientation-btn" onclick="toggleGanttOrientation()" style="display:none;">↕</button>
<div style="width: 1px; background: var(--border-color); margin: 0 4px;"></div>
<button class="btn" id="snap-btn" onclick="toggleSnap()">🧲 Snap</button>
<button class="btn" id="focus-btn" onclick="toggleFocusMode()">🎯 Focus</button>
<button class="btn" onclick="openIdeaMode()">💡 Ideas</button>
<button class="btn" onclick="togglePomodoro()">🍅 Pomodoro</button>
<button class="btn btn-icon" onclick="openTrash()">🗑️</button>
<button class="btn btn-icon" onclick="clearCanvas()">🧹</button>
</div>
<div class="toolbar-right">
<button class="btn btn-icon" onclick="adjustZoom(-0.1)">−</button>
<span id="zoom-level" style="display: flex; align-items: center; font-size: 13px; min-width: 40px; justify-content: center;">100%</span>
<button class="btn btn-icon" onclick="adjustZoom(0.1)">+</button>
<button class="btn btn-icon" onclick="resetView()">⟲</button>
<button class="btn btn-icon" onclick="zoomToFit()" title="Zoom to fit">⊞</button>
<div style="width: 1px; background: var(--border-color); margin: 0 4px;"></div>
<button class="btn btn-icon" onclick="exportAsImage()" title="PNG">🖼️</button>
<button class="btn btn-icon" onclick="exportAsMarkdown()" title="Markdown">📄</button>
<button class="btn btn-icon" onclick="exportProject()" title="JSON">💾</button>
<button class="btn btn-icon" onclick="document.getElementById('import-input').click()" title="Import">📥</button>
<button class="btn btn-icon" onclick="openSettings()">⚙️</button>
<button class="btn btn-icon" onclick="openKeybinds()">⌨️</button>
</div>
<div class="toolbar-bottom" id="align-toolbar" style="display:none;">
<button class="btn btn-icon" onclick="alignSelected('left')">⇤</button>
<button class="btn btn-icon" onclick="alignSelected('center')">⇔</button>
<button class="btn btn-icon" onclick="alignSelected('right')">⇥</button>
<button class="btn btn-icon" onclick="alignSelected('top')">⤒</button>
<button class="btn btn-icon" onclick="alignSelected('middle')">⇕</button>
<button class="btn btn-icon" onclick="distributeSelected('horizontal')">⋯</button>
<button class="btn btn-icon" onclick="distributeSelected('vertical')">⋮</button>
</div>
<!-- World Info Widget -->
<div class="world-widget" id="world-widget">
<div class="world-widget-main">
<span class="world-widget-icon" id="world-weather-icon">🌤️</span>
<div>
<div class="world-weather-temp" id="world-weather-temp">--°</div>
<div class="world-weather-desc" id="world-weather-desc">Loading...</div>
</div>
</div>
<div class="world-location" id="world-location">Detecting location...</div>
<div class="world-widget-row">
<span class="world-widget-icon">🕐</span>
<div>
<div class="world-time" id="world-time">--:--</div>
<div class="world-date" id="world-date">---</div>
</div>
</div>
<div class="world-quote" id="world-quote">Loading inspiration...</div>
</div>
<!-- Stats Bar -->
<div class="stats-bar" id="stats-bar">
<div class="stat-item">📝 <span class="stat-value" id="stat-notes">0</span></div>
<div class="stat-item">📦 <span class="stat-value" id="stat-groups">0</span></div>
<div class="stat-item">🖼️ <span class="stat-value" id="stat-images">0</span></div>
<div class="stat-item">🔗 <span class="stat-value" id="stat-connections">0</span></div>
</div>
<!-- Save Indicator -->
<div class="save-indicator" id="save-indicator">💾 Saved</div>
<!-- Pomodoro -->
<div class="pomodoro-widget" id="pomodoro-widget">
<div>
<div class="pomodoro-mode" id="pomodoro-mode">Focus</div>
<div class="pomodoro-time" id="pomodoro-time">25:00</div>
</div>
<button class="pomodoro-btn" id="pomodoro-toggle" onclick="togglePomodoroTimer()">▶</button>
<button class="pomodoro-btn secondary" onclick="resetPomodoro()">↺</button>
</div>
<div class="project-countdown-widget" id="project-countdown-widget" style="display: none;">
<div class="countdown-title">Time Remaining</div>
<div class="countdown-display">
<div class="time-unit"><span class="time-value" id="wb-days">00</span><span class="time-label">Days</span></div>
<div class="time-unit"><span class="time-value" id="wb-hours">00</span><span class="time-label">Hours</span></div>
<div class="time-unit"><span class="time-value" id="wb-minutes">00</span><span class="time-label">Mins</span></div>
<div class="time-unit"><span class="time-value" id="wb-seconds">00</span><span class="time-label">Secs</span></div>
</div>
</div>
<div class="minimap" id="minimap">
<canvas class="minimap-canvas" id="minimap-canvas"></canvas>
<div class="minimap-viewport" id="minimap-viewport"></div>
</div>
<button class="minimap-toggle" onclick="toggleMinimap()">🗺️</button>
<div class="idea-banner" id="idea-banner">
<span id="idea-prompt">💡 What if everything was simpler?</span>
<button class="btn btn-secondary btn-small" onclick="spawnIdeaNote()">Spawn</button>
<button class="btn btn-secondary btn-small" onclick="nextIdeaPrompt()">Next</button>
<button class="btn btn-secondary btn-small" onclick="closeIdeaMode()">✕</button>
</div>
<div class="pan-hint">🖱️ Middle-click + drag to pan</div>
<div class="connect-mode-hint" id="connect-hint">Click two elements to connect them. Press ESC to cancel.</div>
<div id="canvas-wrapper" onpaste="handlePaste(event)">
<svg id="svg-layer"></svg>
</div>
</div>
<div class="context-menu" id="context-menu">
<div class="context-menu-item" onclick="contextAction('duplicate')">📋 Duplicate</div>
<div class="context-menu-item" onclick="contextAction('pin')">📌 Toggle Pin</div>
<div class="context-menu-item" onclick="contextAction('lock')">🔒 Toggle Lock</div>
<div class="context-menu-divider"></div>
<div class="context-menu-item" onclick="contextAction('tags')">🏷️ Edit Tags</div>
<div class="context-menu-item" onclick="contextAction('progress')">📈 Set Progress</div>
<div class="context-menu-divider"></div>
<div class="context-menu-item" onclick="contextAction('forward')">⬆️ Bring Forward</div>
<div class="context-menu-item" onclick="contextAction('back')">⬇️ Send Back</div>
<div class="context-menu-divider"></div>
<div class="context-menu-item" onclick="contextAction('delete')" style="color: #dc3545;">🗑️ Delete</div>
</div>
<div class="modal-overlay" id="project-modal">
<div class="modal">
<h2 id="modal-title">New Project</h2>
<div class="form-group"><label>Project Name</label><input type="text" id="proj-name" placeholder="Enter name..."></div>
<div class="form-group"><label>Description</label><textarea id="proj-desc" placeholder="Enter description..."></textarea></div>
<div class="form-group"><label>Tags (press Enter to add)</label><div class="tags-input-container" id="proj-tags-container"><input type="text" class="tags-input" id="proj-tags-input" placeholder="Add tag..." onkeydown="handleTagInput(event, 'proj')"></div></div>
<div class="deadline-section">
<div class="deadline-toggle"><input type="checkbox" id="deadline-enabled" onchange="toggleDeadlineDates()"><label for="deadline-enabled" style="margin: 0; cursor: pointer;">Set Deadline (enables Gantt view)</label></div>
<div class="deadline-dates" id="deadline-dates">
<div class="form-group" style="margin: 0;"><label>Start Date</label><input type="datetime-local" id="proj-start-date"></div>
<div class="form-group" style="margin: 0;"><label>End Date</label><input type="datetime-local" id="proj-end-date"></div>
</div>
</div>
<div class="modal-actions"><button class="btn btn-secondary" onclick="closeModal('project-modal')">Cancel</button><button class="btn" onclick="saveProject()">Save</button></div>
</div>
</div>
<div class="modal-overlay" id="template-modal">
<div class="modal wide">
<h2>Start from Template</h2>
<div class="templates-grid" id="templates-grid"></div>
<div class="modal-actions"><button class="btn btn-secondary" onclick="closeModal('template-modal')">Cancel</button></div>
</div>
</div>
<div class="modal-overlay" id="trash-modal">
<div class="modal">
<h2>🗑️ Trash</h2>
<p style="font-size: 13px; color: var(--text-muted); margin-bottom: 15px;">Deleted items kept temporarily.</p>
<div class="trash-list" id="trash-list"></div>
<div class="modal-actions"><button class="btn btn-secondary" onclick="clearTrash()">Empty Trash</button><button class="btn" onclick="closeModal('trash-modal')">Close</button></div>
</div>
</div>
<div class="modal-overlay" id="tags-modal">
<div class="modal">
<h2>Edit Tags</h2>
<div class="form-group"><div class="tags-input-container" id="edit-tags-container"><input type="text" class="tags-input" id="edit-tags-input" placeholder="Add tag..." onkeydown="handleTagInput(event, 'edit')"></div></div>
<div class="modal-actions"><button class="btn" onclick="saveEditTags()">Save</button></div>
</div>
</div>
<div class="modal-overlay" id="progress-modal">
<div class="modal">
<h2>Set Progress</h2>
<div class="form-group"><label>Progress: <span id="progress-value-label">0</span>%</label><input type="range" id="progress-slider" min="0" max="100" value="0" oninput="document.getElementById('progress-value-label').textContent = this.value"></div>
<div class="modal-actions"><button class="btn" onclick="saveProgress()">Save</button></div>
</div>
</div>
<div class="modal-overlay" id="settings-modal">
<div class="modal">
<h2>App Settings</h2>
<div class="setting-row">
<label>Background Style</label>
<select id="setting-bg" onchange="applySettings()">
<option value="bg-dot">Dot Grid</option>
<option value="bg-graph">Graph Paper</option>
<option value="bg-blank">Blank</option>
<option value="bg-falling-stars">✨ Falling Stars</option>
<option value="bg-shooting-stars">✨ Star Field</option>
<option value="bg-aurora">🌈 Aurora</option>
<option value="bg-cyberpunk">🌃 Cyberpunk</option>
<option value="bg-paper">📜 Minimal Paper</option>
<option value="bg-neon">💠 Dark Neon Grid</option>
<option value="bg-pastel">🌸 Soft Pastel</option>
</select>
</div>
<div class="setting-row">
<label>Theme Preset</label>
<div style="flex: 1;">
<div class="theme-presets-grid">
<div class="theme-preset default active" onclick="applyThemePreset('default')">Default</div>
<div class="theme-preset cyberpunk" onclick="applyThemePreset('cyberpunk')">Cyberpunk</div>
<div class="theme-preset paper" onclick="applyThemePreset('paper')">Minimal Paper</div>
<div class="theme-preset neon" onclick="applyThemePreset('neon')">Dark Neon</div>
<div class="theme-preset pastel" onclick="applyThemePreset('pastel')">Soft Pastel</div>
</div>
</div>
</div>
<div class="setting-row"><label>Snap Grid Size</label><input type="number" id="setting-grid-size" value="20" min="5" max="100" style="width: 100px;" onchange="saveGridSize()"></div>
<div class="setting-row"><label>Urgent notes glow red</label><input type="checkbox" id="setting-urgent-glow" onchange="saveUrgentGlow()" style="width:auto;"></div>
<div class="modal-actions">
<button class="btn" onclick="openColours()">🎨 Colours</button>
<button class="btn" onclick="openProjectTheme()">🖼️ Project Theme</button>
<button class="btn" onclick="closeModal('settings-modal')">Done</button>
</div>
</div>
</div>
<div class="modal-overlay" id="theme-modal">
<div class="modal">
<h2>Project Theme</h2>
<p style="font-size: 13px; color: var(--text-muted); margin-bottom: 15px;">Override colours for this project only.</p>
<div class="setting-row"><label>Use project theme</label><input type="checkbox" id="theme-enabled" onchange="toggleProjectTheme()"></div>
<div class="setting-row"><label>Primary Colour</label><input type="color" id="theme-primary" value="#4a90e2" onchange="applyProjectTheme()"></div>
<div class="setting-row"><label>Background</label><input type="color" id="theme-bg" value="#e5e5f7" onchange="applyProjectTheme()"></div>
<div class="modal-actions"><button class="btn btn-secondary" onclick="resetProjectTheme()">Reset</button><button class="btn" onclick="closeModal('theme-modal')">Done</button></div>
</div>
</div>
<div class="modal-overlay" id="colours-modal">
<div class="modal">
<h2>Customise Colours</h2>
<div class="setting-row"><label>Global Text</label><input type="color" id="colour-text" value="#1f2937" onchange="updateCustomColours()"></div>
<div class="setting-row"><label>Primary Button</label><input type="color" id="colour-primary" value="#4a90e2" onchange="updateCustomColours()"></div>
<div class="setting-row"><label>Toolbar BG</label><input type="color" id="colour-toolbar" value="#ffffff" onchange="updateCustomColours()"></div>
<div class="setting-row"><label>Card BG</label><input type="color" id="colour-card" value="#ffffff" onchange="updateCustomColours()"></div>
<div class="setting-row"><label>Canvas BG</label><input type="color" id="colour-canvas" value="#e5e5f7" onchange="updateCustomColours()"></div>
<div class="setting-row"><div class="blur-slider-group"><div class="blur-slider-label"><label>Blur Intensity</label><span class="blur-slider-value" id="blur-value">0px</span></div><input type="range" id="blur-slider" min="0" max="20" value="0" step="1" oninput="updateBlurSettings()"></div></div>
<div class="setting-row"><div class="blur-slider-group"><div class="blur-slider-label"><label>Blur Size</label><span class="blur-slider-value" id="blur-size-value">0px</span></div><input type="range" id="blur-size-slider" min="0" max="30" value="0" step="1" oninput="updateBlurSettings()"></div></div>
<div class="modal-actions"><button class="btn btn-secondary" onclick="resetCustomColours()">Reset</button><button class="btn" onclick="closeModal('colours-modal')">Done</button></div>
</div>
</div>
<div class="modal-overlay" id="keybinds-modal">
<div class="modal">
<h2>Keyboard Shortcuts</h2>
<div class="keybinds-grid">
<div class="keybind-item"><span class="keybind-desc">New Note</span><div class="keybind-keys"><span class="key">N</span></div></div>
<div class="keybind-item"><span class="keybind-desc">New Group</span><div class="keybind-keys"><span class="key">G</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Connect</span><div class="keybind-keys"><span class="key">C</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Dependency</span><div class="keybind-keys"><span class="key">D</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Drag Select</span><div class="keybind-keys"><span class="key">Q</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Gantt</span><div class="keybind-keys"><span class="key">Tab</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Snap</span><div class="keybind-keys"><span class="key">S</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Focus</span><div class="keybind-keys"><span class="key">F</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Search</span><div class="keybind-keys"><span class="key">Ctrl</span><span class="key">F</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Undo</span><div class="keybind-keys"><span class="key">Ctrl</span><span class="key">Z</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Redo</span><div class="keybind-keys"><span class="key">Ctrl</span><span class="key">Y</span></div></div>
<div class="keybind-item"><span class="keybind-desc">PNG</span><div class="keybind-keys"><span class="key">Ctrl</span><span class="key">E</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Markdown</span><div class="keybind-keys"><span class="key">Ctrl</span><span class="key">M</span></div></div>
<div class="keybind-item"><span class="keybind-desc">JSON</span><div class="keybind-keys"><span class="key">Ctrl</span><span class="key">S</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Zoom</span><div class="keybind-keys"><span class="key">Ctrl</span><span class="key">+/-</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Fit View</span><div class="keybind-keys"><span class="key">Ctrl</span><span class="key">1</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Pan</span><div class="keybind-keys"><span class="key">Middle</span><span class="key">Drag</span></div></div>
<div class="keybind-item"><span class="keybind-desc">Cancel</span><div class="keybind-keys"><span class="key">Esc</span></div></div>
</div>
<div class="modal-actions"><button class="btn" onclick="closeModal('keybinds-modal')">Close</button></div>
</div>
</div>
<div class="toast" id="toast"></div>
<div id="radio-player" class="radio-player">
<div class="radio-eq" onclick="toggleRadioExpand()"><div class="radio-eq-bar"></div><div class="radio-eq-bar"></div><div class="radio-eq-bar"></div><div class="radio-eq-bar"></div></div>
<div class="radio-controls">
<div class="radio-station-name" id="radio-station-name">Lofi Cafe</div>
<div class="radio-buttons">
<button class="radio-btn" onclick="prevStation()"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M6 6h2v12H6zm3.5 6l8.5 6V6z"/></svg></button>
<button class="radio-btn play-btn" id="radio-play-btn" onclick="togglePlay()"><svg id="play-icon" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></button>
<button class="radio-btn" onclick="nextStation()"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z"/></svg></button>
</div>
<input type="range" id="radio-volume" min="0" max="1" step="0.05" value="0.5" oninput="changeVolume(this.value)">
</div>
</div>
<audio id="radio-audio"></audio>
<script>
// ============================================
// DATABASE & STATE
// ============================================
const DB_NAME = 'LocalWhiteboardDB';
const DB_VERSION = 1;
let db;
let currentProject = null;
let editingProjectId = null;
let isConnectMode = false, isDependencyMode = false, isSelectMode = false;
let connectSource = null;
let dragItem = null, dragOffsetX = 0, dragOffsetY = 0;
let currentZoom = 1, panX = 0, panY = 0;
let isPanning = false, panStartX = 0, panStartY = 0, panStartPanX = 0, panStartPanY = 0;
let isResizing = false, resizeItem = null;
let currentSort = 'default';
let selectedElements = [];
let isGanttResizing = false, ganttResizeIndex = -1, ganttResizeOrientation = 'vertical', ganttResizeStart = 0, ganttResizeOriginalSize = 0;
let snapEnabled = false, gridSize = 20;
let focusMode = false, contextTarget = null, minimapVisible = true, ideaMode = false;
let konamiProgress = 0;
const KONAMI = ['ArrowUp','ArrowUp','ArrowDown','ArrowDown','ArrowLeft','ArrowRight','ArrowLeft','ArrowRight','b','a'];
let history = [], historyIndex = -1;
const MAX_HISTORY = 100;
let trash = [];
let currentTagEditId = null, currentEditTags = [];
let urgentGlowEnabled = false;
let isDragSelecting = false, dragSelectStart = null, dragSelectBox = null;
let pomodoroActive = false, pomodoroRunning = false, pomodoroTime = 25 * 60, pomodoroMode = 'focus', pomodoroInterval = null;
const IDEA_PROMPTS = ["💡 What if everything was simpler?","💡 What would you build with unlimited time?","💡 What problem keeps coming back?","💡 What's the smallest version of this idea?","💡 Who would benefit most from this?","💡 What's the opposite approach?","💡 What would you remove first?","💡 What's the most fun version?","💡 What assumption are you making?","💡 What's the real problem underneath?","💡 If you had 1 day, what would you ship?","💡 What would make this delightful?"];
let currentIdeaIndex = 0;
const TEMPLATES = [
{ name: "Brainstorm", description: "Central idea with radiating thoughts", elements: [
{ type: 'note', x: 1400, y: 1400, width: 240, height: 180, content: '🎯 Main Idea', color: 'note-yellow' },
{ type: 'note', x: 1100, y: 1200, width: 200, height: 140, content: 'Thought 1', color: 'note-blue' },
{ type: 'note', x: 1700, y: 1200, width: 200, height: 140, content: 'Thought 2', color: 'note-green' },
{ type: 'note', x: 1100, y: 1600, width: 200, height: 140, content: 'Thought 3', color: 'note-pink' },
{ type: 'note', x: 1700, y: 1600, width: 200, height: 140, content: 'Thought 4', color: 'note-red' }
]},
{ name: "Sprint Planning", description: "To Do / Doing / Done columns", elements: [
{ type: 'group', x: 200, y: 200, width: 400, height: 600, title: '📋 To Do' },
{ type: 'group', x: 700, y: 200, width: 400, height: 600, title: '⚡ Doing' },
{ type: 'group', x: 1200, y: 200, width: 400, height: 600, title: '✅ Done' }
]},
{ name: "Story Mapping", description: "User activities → tasks flow", elements: [
{ type: 'note', x: 200, y: 200, width: 200, height: 100, content: '👤 Activity 1', color: 'note-yellow' },
{ type: 'note', x: 450, y: 200, width: 200, height: 100, content: '👤 Activity 2', color: 'note-yellow' },
{ type: 'note', x: 200, y: 350, width: 180, height: 100, content: 'Task 1.1', color: 'note-blue' },
{ type: 'note', x: 400, y: 350, width: 180, height: 100, content: 'Task 1.2', color: 'note-blue' }
]},
{ name: "Personal Task Board", description: "Today / Week / Goals", elements: [
{ type: 'group', x: 200, y: 200, width: 500, height: 700, title: '🌅 Today' },
{ type: 'group', x: 800, y: 200, width: 500, height: 700, title: '📅 This Week' },
{ type: 'group', x: 1400, y: 200, width: 500, height: 700, title: '🎯 Goals' }
]},
{ name: "Blank Canvas", description: "Start fresh", elements: [] }
];
const THEME_PRESETS = {
default: { text: '#1f2937', primary: '#4a90e2', toolbar: '#ffffff', card: '#ffffff', canvas: '#e5e5f7' },
cyberpunk: { text: '#e0e0ff', primary: '#ff00ff', toolbar: '#1a0030', card: '#2d004d', canvas: '#0a0015' },
paper: { text: '#3d3426', primary: '#8b7355', toolbar: '#faf8f3', card: '#ffffff', canvas: '#faf8f3' },
neon: { text: '#e0ffe0', primary: '#00ffaa', toolbar: '#1a1a2e', card: '#16213e', canvas: '#0a0a1a' },
pastel: { text: '#5a4a5a', primary: '#d4789c', toolbar: '#fdf6f0', card: '#ffffff', canvas: '#fdf6f0' }
};
const QUOTES = [
"The best way to predict the future is to create it.",
"Simplicity is the ultimate sophistication.",
"Make it work, make it right, make it fast.",
"Done is better than perfect.",
"The details are not the details. They make the design.",
"Good design is obvious. Great design is transparent.",
"Less is more.",
"Design is not just what it looks like. Design is how it works.",
"First, solve the problem. Then, write the code.",
"Code is like humor. When you have to explain it, it's bad."
];
// ============================================
// DATABASE
// ============================================
function initDB() {
return new Promise((resolve, reject) => {
const request = indexedDB.open(DB_NAME, DB_VERSION);
request.onupgradeneeded = (e) => {
db = e.target.result;
if (!db.objectStoreNames.contains('projects')) db.createObjectStore('projects', { keyPath: 'id' });
};
request.onsuccess = (e) => { db = e.target.result; resolve(db); renderDashboard(); };
request.onerror = (e) => reject(e);
});
}
function saveToDB(project) {
const tx = db.transaction(['projects'], 'readwrite');
tx.objectStore('projects').put(project);
return new Promise(resolve => tx.oncomplete = resolve);
}
function getAllFromDB() {
return new Promise(resolve => {
const tx = db.transaction(['projects'], 'readonly');
const request = tx.objectStore('projects').getAll();
request.onsuccess = () => resolve(request.result);
});
}
// ============================================
// IMPORT FUNCTIONALITY
// ============================================
function handleImportFile(e) {
const file = e.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = async (event) => {
try {
const data = JSON.parse(event.target.result);
if (!data.name || !Array.isArray(data.elements)) {
alert('❌ Invalid project file. Missing name or elements.');
return;
}
// Ask user if they want to replace existing or create new
const existing = await new Promise(resolve => {
const tx = db.transaction(['projects'], 'readonly');
const req = tx.objectStore('projects').get(data.id);
req.onsuccess = () => resolve(req.result);
});
let action = 'new';
if (existing) {
const choice = confirm(`A project named "${existing.name}" with this ID already exists.\n\nClick OK to OVERWRITE it.\nClick Cancel to IMPORT AS NEW (duplicate).`);
action = choice ? 'overwrite' : 'new';
}
if (action === 'new') {
data.id = Date.now().toString();
// Regenerate element IDs to avoid conflicts
const idMap = {};
if (data.elements) {
data.elements.forEach(el => {
const newId = 'el_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
idMap[el.id] = newId;
el.id = newId;
});
}
// Update connection references
if (data.connections) {
data.connections.forEach(conn => {
if (idMap[conn.from]) conn.from = idMap[conn.from];
if (idMap[conn.to]) conn.to = idMap[conn.to];
});
}
if (data.dependencies) {
data.dependencies.forEach(dep => {
if (idMap[dep.from]) dep.from = idMap[dep.from];
if (idMap[dep.to]) dep.to = idMap[dep.to];
});
}
data.name = data.name + ' (imported)';
}
await saveToDB(data);
renderDashboard();
showToast(`✅ Imported: ${data.name}`);
} catch (err) {
alert('❌ Failed to import: ' + err.message);
}
};
reader.readAsText(file);
e.target.value = '';
}
// ============================================
// HISTORY / UNDO
// ============================================
function pushHistory() {
if (!currentProject) return;
history = history.slice(0, historyIndex + 1);
history.push(JSON.parse(JSON.stringify({ elements: currentProject.elements, connections: currentProject.connections, dependencies: currentProject.dependencies || [] })));
if (history.length > MAX_HISTORY) history.shift();
historyIndex = history.length - 1;
}
function undo() {
if (historyIndex <= 0) { showToast("Nothing to undo"); return; }
historyIndex--;
const state = JSON.parse(JSON.stringify(history[historyIndex]));
currentProject.elements = state.elements;
currentProject.connections = state.connections;
currentProject.dependencies = state.dependencies || [];
renderWhiteboard();
saveCurrentProjectState();
showToast("↩️ Undone");
}
function redo() {
if (historyIndex >= history.length - 1) { showToast("Nothing to redo"); return; }
historyIndex++;
const state = JSON.parse(JSON.stringify(history[historyIndex]));
currentProject.elements = state.elements;
currentProject.connections = state.connections;
currentProject.dependencies = state.dependencies || [];
renderWhiteboard();
saveCurrentProjectState();
showToast("↪️ Redone");
}
// ============================================
// SETTINGS & THEMES
// ============================================
let appSettings = { background: 'bg-dot' };
function loadSettings() {
const saved = localStorage.getItem('wb_settings');
if (saved) appSettings = JSON.parse(saved);
document.getElementById('setting-bg').value = appSettings.background;
document.getElementById('setting-grid-size').value = appSettings.gridSize || 20;
gridSize = appSettings.gridSize || 20;
urgentGlowEnabled = appSettings.urgentGlow || false;
document.getElementById('setting-urgent-glow').checked = urgentGlowEnabled;
applySettings();
loadCustomColours();
}
function saveGridSize() {
gridSize = parseInt(document.getElementById('setting-grid-size').value) || 20;
appSettings.gridSize = gridSize;
localStorage.setItem('wb_settings', JSON.stringify(appSettings));
}
function saveUrgentGlow() {
urgentGlowEnabled = document.getElementById('setting-urgent-glow').checked;
appSettings.urgentGlow = urgentGlowEnabled;
localStorage.setItem('wb_settings', JSON.stringify(appSettings));
renderWhiteboard();
}
function applyThemePreset(preset) {
const theme = THEME_PRESETS[preset];
if (!theme) return;
document.getElementById('colour-text').value = theme.text;
document.getElementById('colour-primary').value = theme.primary;
document.getElementById('colour-toolbar').value = theme.toolbar;
document.getElementById('colour-card').value = theme.card;
document.getElementById('colour-canvas').value = theme.canvas;
const colours = { ...theme, blur: parseInt(document.getElementById('blur-slider').value), blurSize: parseInt(document.getElementById('blur-size-slider').value) };
localStorage.setItem('wb_colours', JSON.stringify(colours));
applyCustomColours(colours);
document.querySelectorAll('.theme-preset').forEach(p => p.classList.remove('active'));
document.querySelector(`.theme-preset.${preset}`).classList.add('active');
showToast(`🎨 ${preset.charAt(0).toUpperCase() + preset.slice(1)} theme applied`);
}
function applySettings() {
appSettings.background = document.getElementById('setting-bg').value;
localStorage.setItem('wb_settings', JSON.stringify(appSettings));
const wb = document.getElementById('whiteboard');
wb.className = '';
wb.classList.add(appSettings.background);
document.querySelectorAll('.starfall, .stars, .chase').forEach(el => el.remove());
wb.querySelectorAll('canvas.bg-canvas').forEach(c => c.remove());
if (appSettings.background === 'bg-falling-stars') {
const container = document.createElement('div');
container.className = 'starfall';
for (let i = 0; i < 20; i++) {
const star = document.createElement('div');
star.className = 'falling-star';
star.style.left = Math.random() * 100 + 'vw';
star.style.animationDuration = (3 + Math.random() * 4) + 's';
star.style.animationDelay = (Math.random() * 5) + 's';
container.appendChild(star);
}
wb.appendChild(container);
} else if (appSettings.background === 'bg-shooting-stars') {
wb.style.position = 'relative';
const canvas = document.createElement('canvas');
canvas.className = 'bg-canvas';
canvas.style.cssText = 'position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1;pointer-events:none;';
wb.appendChild(canvas);
const ctx = canvas.getContext('2d');
let stars = [];
function resizeCanvas() {
canvas.width = wb.offsetWidth; canvas.height = wb.offsetHeight;
if (stars.length === 0) {
const starCount = Math.floor((canvas.width * canvas.height) / 5000);
for (let i = 0; i < starCount; i++) {
stars.push({ x: Math.random() * canvas.width, y: Math.random() * canvas.height, radius: Math.random() * 1.5, opacity: Math.random() * 0.5 + 0.3, twinkleSpeed: Math.random() * 0.08 + 0.04, targetOpacity: Math.random() * 0.8 + 0.2, vx: (Math.random() - 0.5) * 0.05, vy: (Math.random() - 0.5) * 0.05, flickerChance: Math.random() * 0.05 + 0.02 });
}
}
}
function animateStars() {
ctx.fillStyle = 'rgba(0, 0, 0, 1)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
stars.forEach(star => {
star.opacity += (star.targetOpacity - star.opacity) * star.twinkleSpeed;
if (Math.random() < star.flickerChance) star.targetOpacity = Math.random() * 0.8 + 0.2;
star.x += star.vx; star.y += star.vy;
if (star.x < 0) star.x = canvas.width; if (star.x > canvas.width) star.x = 0;
if (star.y < 0) star.y = canvas.height; if (star.y > canvas.height) star.y = 0;
ctx.fillStyle = `rgba(200, 220, 255, ${star.opacity})`;
ctx.beginPath(); ctx.arc(star.x, star.y, star.radius, 0, Math.PI * 2); ctx.fill();
});
requestAnimationFrame(animateStars);
}
resizeCanvas(); animateStars();
window.addEventListener('resize', resizeCanvas);
} else if (appSettings.background === 'bg-matrix') {
const canvas = document.createElement('canvas');
canvas.className = 'bg-canvas';
canvas.style.cssText = 'position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1;';
wb.appendChild(canvas);
const ctx = canvas.getContext('2d');
canvas.width = wb.offsetWidth; canvas.height = wb.offsetHeight;
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%";
const fontSize = 14;