-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1081 lines (1036 loc) ยท 51.2 KB
/
index.html
File metadata and controls
1081 lines (1036 loc) ยท 51.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="NovelWriter - An agentic AI-powered novel writing application">
<title>NovelWriter</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400;1,700&family=Inter:wght@300;400;500;600;700&family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="/src/styles/main.css">
</head>
<body>
<div id="app">
<!-- Top Bar -->
<header class="top-bar">
<div class="top-bar-left">
<button class="icon-btn" id="btn-reading-mode" title="Reading Mode">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" />
<path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" />
</svg>
</button>
<span class="app-title">NovelWriter</span>
</div>
<div class="top-bar-center">
<span class="project-title" id="project-title">Untitled Book</span>
<button class="icon-btn dashboard-btn" id="btn-dashboard" title="Book Dashboard">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="7" height="7" rx="1" />
<rect x="14" y="3" width="7" height="7" rx="1" />
<rect x="3" y="14" width="7" height="7" rx="1" />
<rect x="14" y="14" width="7" height="7" rx="1" />
</svg>
</button>
</div>
<div class="top-bar-right">
<button class="icon-btn" id="btn-event-line" title="Event Line (Story Events)">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="2" y1="12" x2="22" y2="12" />
<circle cx="6" cy="12" r="2" />
<circle cx="12" cy="12" r="2" />
<circle cx="18" cy="12" r="2" />
</svg>
</button>
<button class="icon-btn" id="btn-plot-tracker" title="Plot Tracker (Plot Lines & Holes)">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
</svg>
</button>
<button class="icon-btn" id="btn-story-pulse" title="Story Pulse (Analysis Graphs)">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 3v18h18" />
<path d="M18.7 8l-5.1 5.2-2.8-2.7L7 14.3" />
</svg>
</button>
<button class="icon-btn" id="btn-connection-web" title="Connection Web (Relationship Graph)">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="5" r="3" />
<circle cx="5" cy="19" r="3" />
<circle cx="19" cy="19" r="3" />
<line x1="12" y1="8" x2="5" y2="16" />
<line x1="12" y1="8" x2="19" y2="16" />
<line x1="5" y1="19" x2="19" y2="19" />
</svg>
</button>
<button class="icon-btn" id="btn-thesaurus" title="Thesaurus">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20" />
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z" />
<path d="M8 7h8M8 11h8M8 15h4" />
</svg>
</button>
<button class="icon-btn" id="btn-open-project" title="Open Project">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />
</svg>
</button>
<button class="icon-btn" id="btn-save-project" title="Save Project">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" />
<polyline points="17,21 17,13 7,13 7,21" />
<polyline points="7,3 7,8 15,8" />
</svg>
</button>
<button class="icon-btn" id="btn-new-project" title="New Project">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<polyline points="14,2 14,8 20,8" />
<line x1="12" y1="18" x2="12" y2="12" />
<line x1="9" y1="15" x2="15" y2="15" />
</svg>
</button>
<button class="icon-btn" id="btn-api-config" title="API Configuration">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path
d="M12 2v6m0 8v6M4.93 4.93l4.24 4.24m5.66 5.66l4.24 4.24M2 12h6m8 0h6M4.93 19.07l4.24-4.24m5.66-5.66l4.24-4.24" />
</svg>
</button>
<button class="icon-btn" id="btn-settings" title="Settings">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="3" />
<path
d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" />
</svg>
</button>
<div class="theme-selector" id="theme-selector">
<button class="icon-btn" id="btn-theme" title="Themes">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10" />
<path d="M12 2a10 10 0 0 0 0 20 4 4 0 0 0 0-8 2 2 0 0 1 0-4 10 10 0 0 0 0-8z" />
<circle cx="12" cy="12" r="2" fill="currentColor" />
</svg>
</button>
<div class="theme-dropdown" id="theme-dropdown">
<div class="theme-dropdown-header">Choose Theme</div>
<button class="theme-option" data-theme="light">
<span class="theme-preview" style="background: linear-gradient(135deg, #f3f5f9 50%, #3b82f6 50%);"></span>
<span>Light</span>
</button>
<button class="theme-option" data-theme="dark">
<span class="theme-preview" style="background: linear-gradient(135deg, #0f1115 50%, #60a5fa 50%);"></span>
<span>Dark</span>
</button>
<button class="theme-option" data-theme="soft-dark">
<span class="theme-preview" style="background: linear-gradient(135deg, #1a1d23 50%, #60a5fa 50%);"></span>
<span>Soft Dark</span>
</button>
<button class="theme-option" data-theme="rain">
<span class="theme-preview" style="background: linear-gradient(135deg, #0f111a 50%, #7dd3fc 50%);"></span>
<span>Rain</span>
</button>
<button class="theme-option" data-theme="sepia">
<span class="theme-preview" style="background: linear-gradient(135deg, #f4ecd8 50%, #8b5a2b 50%);"></span>
<span>Sepia</span>
</button>
<button class="theme-option" data-theme="ocean">
<span class="theme-preview" style="background: linear-gradient(135deg, #0c1929 50%, #0ea5e9 50%);"></span>
<span>Ocean</span>
</button>
<button class="theme-option" data-theme="midnight">
<span class="theme-preview" style="background: linear-gradient(135deg, #0f0f1a 50%, #8b5cf6 50%);"></span>
<span>Midnight</span>
</button>
<button class="theme-option" data-theme="forest">
<span class="theme-preview" style="background: linear-gradient(135deg, #0f1912 50%, #10b981 50%);"></span>
<span>Forest</span>
</button>
<button class="theme-option" data-theme="sunset">
<span class="theme-preview" style="background: linear-gradient(135deg, #1a1210 50%, #f97316 50%);"></span>
<span>Sunset</span>
</button>
</div>
</div>
</div>
</header>
<!-- Main Layout -->
<main class="main-layout">
<!-- Left Sidebar - Navigation Tree -->
<aside class="sidebar sidebar-left" id="sidebar-left">
<div class="sidebar-header">
<input type="text" class="search-input" placeholder="Filter project files..." id="filter-input">
</div>
<nav class="tree-nav" id="tree-nav">
<!-- Tree navigation will be injected here -->
</nav>
</aside>
<!-- Center - Editor Area -->
<section class="editor-area" id="editor-area">
<!-- Toolbar -->
<div class="editor-toolbar" id="editor-toolbar">
<div class="toolbar-group">
<button class="toolbar-btn" id="btn-bold" title="Bold (Ctrl+B)">
<strong>B</strong>
</button>
<button class="toolbar-btn" id="btn-italic" title="Italic (Ctrl+I)">
<em>I</em>
</button>
<button class="toolbar-btn" id="btn-underline" title="Underline (Ctrl+U)">
<u>U</u>
</button>
</div>
<div class="toolbar-divider"></div>
<div class="toolbar-group">
<select class="toolbar-select" id="font-family">
<option value="Merriweather">Merriweather</option>
<option value="Georgia">Georgia</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Arial">Arial</option>
<option value="Inter">Inter</option>
<option value="Courier New">Courier New</option>
</select>
<select class="toolbar-select" id="font-size">
<option value="8">8px</option>
<option value="10">10px</option>
<option value="12">12px</option>
<option value="14">14px</option>
<option value="16" selected>16px</option>
<option value="18">18px</option>
<option value="20">20px</option>
<option value="24">24px</option>
<option value="28">28px</option>
</select>
</div>
<!-- Focus Mode Button - Separated from font options -->
<div style="margin-left: auto;"></div>
<button class="toolbar-btn" id="btn-focus-mode" title="Focus Mode (F11)" style="margin-left: 24px;">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<path d="M8 3H5a2 2 0 0 0-2 2v3"></path>
<path d="M21 8V5a2 2 0 0 0-2-2h-3"></path>
<path d="M3 16v3a2 2 0 0 0 2 2h3"></path>
<path d="M16 21h3a2 2 0 0 0 2-2v-3"></path>
</svg>
</button>
</div>
<!-- Editor Content -->
<div class="editor-content-wrapper">
<div class="editor-page">
<div class="editor-content" id="editor-content" contenteditable="true" spellcheck="true">
</div>
</div>
</div>
<!-- Status Bar -->
<div class="status-bar">
<span class="status-item" id="word-count">0 words</span>
<span class="status-divider">|</span>
<span class="status-item mood-indicator" id="mood-indicator">
<span class="mood-dot"></span>
<span class="mood-label">--</span>
</span>
<span class="status-divider">|</span>
<button class="status-btn" id="btn-echo-chamber" title="Echo Chamber">
๐ฌ Echo
</button>
<span class="status-divider">|</span>
<span class="status-item" id="save-status">Saved</span>
</div>
<!-- Alive Editor Panel (Bottom Right) -->
<div class="alive-panel" id="alive-panel">
<div class="alive-header">
<span>Alive</span>
<button class="alive-collapse-btn" id="alive-collapse-btn" title="Collapse panel">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="6 9 12 15 18 9" />
</svg>
</button>
</div>
<div class="alive-body" id="alive-body"></div>
</div>
<!-- Alive Mood Popup (appears at cursor) -->
<div class="alive-popup" id="alive-popup">
<span class="alive-popup-content"></span>
</div>
</section>
<!-- Right Sidebar - AI Agent Panel -->
<aside class="agent-panel collapsed" id="agent-panel">
<div class="agent-resize-handle" id="agent-resize-handle"></div>
<div class="agent-content">
<div class="agent-header">
<div class="agent-title">
<span class="agent-status" id="agent-status"></span>
<span>AI Agent</span>
</div>
<select class="agent-mode-select" id="agent-mode-select">
<option value="auto"> ๐ Auto</option>
<option value="quick"> โกQuick</option>
<option value="planning"> ๐ Planning</option>
<option value="chatty"> ๐ฌ Chatty</option>
<option value="brainstorm">๐ก Brainstorm</option>
</select>
</div>
<div class="agent-conversations-bar">
<button class="btn btn-sm" id="agent-new-conversation" title="New Conversation">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12" />
</svg>
New
</button>
<select class="agent-conversation-select" id="agent-conversation-select" title="Switch Conversation">
<option value="">No conversations yet</option>
</select>
<button class="icon-btn btn-sm" id="agent-delete-conversation" title="Delete Current Conversation">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="3 6 5 6 21 6" />
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
</svg>
</button>
</div>
<div class="agent-history" id="agent-history">
<div class="agent-message system">
<div class="message-content">๐ I'm your AI writing assistant. Ask me anything about your story, request
edits, or just chat about your plot!</div>
</div>
</div>
<div class="agent-input-area">
<div class="agent-image-preview" id="agent-image-preview" style="display: none;">
<img id="agent-image-thumb" src="" alt="Attached image">
<button class="agent-image-remove" id="agent-image-remove" title="Remove image">โ</button>
</div>
<div class="agent-input-row">
<button class="btn btn-icon agent-attach-btn" id="agent-attach-btn" title="Attach image">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"/>
</svg>
</button>
<textarea id="agent-input" placeholder="Ask the AI agent..." rows="2"></textarea>
<button class="btn btn-primary" id="agent-send-btn">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="22" y1="2" x2="11" y2="13" />
<polygon points="22 2 15 22 11 13 2 9 22 2" />
</svg>
</button>
</div>
<input type="file" id="agent-image-input" accept="image/*" style="display: none;">
</div>
</div>
</aside>
<!-- AI Agent Drawer Tab (positioned after panel for CSS sibling selector) -->
<div class="agent-drawer-tab" id="agent-drawer-tab" title="Toggle AI Agent">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="15 18 9 12 15 6" />
</svg>
</div>
</main>
<!-- Event Line Modal (Fullscreen) -->
<div class="fullscreen-modal" id="event-line-modal">
<div class="fullscreen-modal-header">
<h2>๐ Event Line</h2>
<div class="fullscreen-modal-controls">
<!-- Mode Toggle -->
<div class="mode-toggle" id="event-line-mode-toggle">
<button class="mode-btn active" data-mode="ai">๐ค AI</button>
<button class="mode-btn" data-mode="custom">โ๏ธ Custom</button>
</div>
<!-- AI Mode Controls -->
<div class="ai-mode-controls" id="event-line-ai-controls">
<button class="btn btn-sm" id="btn-generate-events">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2" />
</svg>
Generate / Update
</button>
</div>
<!-- Custom Mode Controls -->
<div class="custom-mode-controls hidden" id="event-line-custom-controls">
<button class="btn btn-sm btn-primary" id="btn-add-event">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12" />
</svg>
Add Event
</button>
<div class="item-manager-dropdown" id="plot-lines-dropdown">
<button class="btn btn-sm" id="btn-plot-lines">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />
</svg>
<span id="current-plot-line-name">Main Plot</span>
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="6 9 12 15 18 9" />
</svg>
</button>
<div class="item-manager-menu hidden" id="plot-lines-menu">
<div class="item-manager-list" id="plot-lines-list"></div>
<div class="item-manager-actions">
<button class="item-action-btn" id="btn-new-plot-line">+ New Plot Line</button>
</div>
</div>
</div>
</div>
<button class="icon-btn" id="close-event-line" title="Close">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
</div>
<div class="event-line-container" id="event-line-container">
<div class="event-line-empty">
<p>No events extracted yet.</p>
<p>Click <strong>Generate / Update</strong> to scan your manuscript and build the event line.</p>
</div>
</div>
<!-- Add Event Popup -->
<div class="add-event-popup hidden" id="add-event-popup">
<div class="add-event-form">
<h3>Add Event</h3>
<div class="form-group">
<label>Event Type</label>
<select id="add-event-type">
<option value="none">โช None (White)</option>
<option value="action">โ๏ธ Action</option>
<option value="conflict">๐ข Conflict</option>
<option value="chase">๐ Chase</option>
<option value="reveal">๐ก Reveal</option>
<option value="mystery">๐ Mystery</option>
<option value="decision">โ๏ธ Decision</option>
<option value="betrayal">๐ก๏ธ Betrayal</option>
<option value="death">๐ Death</option>
<option value="victory">๐ Victory</option>
<option value="defeat">๐ฅ Defeat</option>
<option value="emotional">๐ Emotional</option>
<option value="calm">๐ฟ Calm</option>
<option value="setup">๐ Setup</option>
</select>
</div>
<div class="form-group">
<label>Gap After Last Event</label>
<select id="add-event-gap">
<option value="immediate">Immediate</option>
<option value="soon" selected>Shortly After</option>
<option value="later">Some Time Later</option>
<option value="skip">Time Skip</option>
</select>
</div>
<div class="form-group">
<label>Title <span class="required">*</span></label>
<input type="text" id="add-event-title" placeholder="Brief event title..." maxlength="50">
</div>
<div class="form-group">
<label>Description</label>
<textarea id="add-event-description" placeholder="What happens in this event..." rows="3"
maxlength="200"></textarea>
</div>
<div class="form-actions">
<button class="btn btn-sm" id="btn-cancel-add-event">Cancel</button>
<button class="btn btn-sm btn-primary" id="btn-save-event">Save Event</button>
</div>
</div>
</div>
</div>
<!-- Plot Tracker Modal (Fullscreen) -->
<div class="fullscreen-modal" id="plot-tracker-modal">
<div class="fullscreen-modal-header">
<h2>๐ Plot Tracker</h2>
<div class="fullscreen-modal-controls">
<!-- Mode Toggle -->
<div class="mode-toggle" id="plot-tracker-mode-toggle">
<button class="mode-btn active" data-mode="ai">๐ค AI</button>
<button class="mode-btn" data-mode="custom">โ๏ธ Custom</button>
</div>
<!-- AI Mode Controls -->
<div class="ai-mode-controls" id="plot-tracker-ai-controls">
<button class="btn btn-sm" id="btn-scan-plots">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2" />
</svg>
Scan Manuscript
</button>
</div>
<!-- Custom Mode Controls (shown in section headers instead) -->
<div class="custom-mode-controls hidden" id="plot-tracker-custom-controls">
<span class="custom-mode-hint">Add cards using + buttons in each section</span>
</div>
<button class="icon-btn" id="close-plot-tracker" title="Close">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
</div>
<div class="plot-tracker-container" id="plot-tracker-container">
<div class="plot-tracker-empty">
<p>No plot analysis yet.</p>
<p>Click <strong>Scan Manuscript</strong> to analyze your story for plot lines and potential holes.</p>
</div>
</div>
<!-- Add Card Popup -->
<div class="add-card-popup hidden" id="add-card-popup">
<div class="add-card-form">
<h3 id="add-card-title">Add Card</h3>
<div class="form-group">
<label>Title <span class="required">*</span></label>
<input type="text" id="card-title" placeholder="Brief title..." maxlength="100">
</div>
<div class="form-group">
<label>Location</label>
<input type="text" id="card-location" placeholder="e.g. Part 1 - Chapter 3" maxlength="50">
</div>
<div class="form-group">
<label>Description</label>
<textarea id="card-description" placeholder="Details..." rows="3" maxlength="500"></textarea>
</div>
<div class="form-group severity-group hidden" id="severity-group">
<label>Severity: <span id="severity-value">5</span>/10</label>
<input type="range" id="card-severity" min="1" max="10" value="5">
</div>
<div class="form-actions">
<button class="btn btn-sm" id="btn-cancel-add-card">Cancel</button>
<button class="btn btn-sm btn-primary" id="btn-save-card">Save Card</button>
</div>
</div>
</div>
</div>
<!-- Settings Modal -->
<div class="modal" id="settings-modal">
<div class="modal-backdrop"></div>
<div class="modal-content">
<div class="modal-header">
<h2>Settings</h2>
<button class="icon-btn" id="close-settings">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
<div class="modal-body">
<div class="settings-section">
<h3>Appearance</h3>
<div class="setting-row">
<label>Theme</label>
<select id="setting-theme">
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</div>
<div class="setting-row">
<label>Editor Font</label>
<select id="setting-font">
<option value="Merriweather">Merriweather</option>
<option value="Georgia">Georgia</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Arial">Arial</option>
</select>
</div>
<h3>AI Configuration</h3>
<div class="setting-row">
<label>Context Strategy</label>
<select id="setting-ai-context-strategy">
<option value="smart">Smart (Efficient)</option>
<option value="full">Full Manuscript (High Cost)</option>
</select>
</div>
<h3>Alive Editor</h3>
<p class="settings-description">Real-time AI awareness. Triggers after X letters typed.</p>
<div class="setting-row">
<label>๐ญ Mood Indicator</label>
<div class="setting-inline">
<input type="checkbox" id="setting-alive-mood-enabled" checked />
<input type="number" id="setting-alive-mood-trigger" value="50" min="10" max="2000"
style="width: 70px;" />
<span class="setting-hint">letters</span>
</div>
</div>
<div class="setting-row">
<label>๐ฌ Agent Remarks</label>
<div class="setting-inline">
<input type="checkbox" id="setting-alive-remarks-enabled" />
<input type="number" id="setting-alive-remarks-trigger" value="300" min="10" max="2000"
style="width: 70px;" />
<span class="setting-hint">letters</span>
</div>
</div>
</div>
<h3>๐พ Backup</h3>
<p class="settings-description">Protect your work with manual backups.</p>
<div class="setting-row">
<label>Download Backup</label>
<button class="btn btn-sm" id="btn-manual-backup">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
Backup Now
</button>
</div>
<div class="setting-row">
<label>Restore from Backup</label>
<input type="file" id="backup-file-input" accept=".json" style="display: none;" />
<button class="btn btn-sm btn-secondary" id="btn-restore-backup">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 15v4a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" />
</svg>
Restore
</button>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" id="save-settings">Save Settings</button>
</div>
</div>
</div>
<!-- API Configuration Modal -->
<div class="modal" id="api-config-modal">
<div class="modal-backdrop"></div>
<div class="modal-content">
<div class="modal-header">
<h2>API Configuration</h2>
<button class="modal-close" id="close-api-config">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
<div class="modal-body">
<div class="settings-section">
<p class="settings-description">Configure your AI provider connection. Works with any OpenAI-compatible API.
</p>
<div class="setting-row">
<label>Provider URL</label>
<input type="text" id="setting-ai-provider" placeholder="e.g., https://nano-gpt.com/api/v1" />
</div>
<div class="setting-row">
<label>API Key</label>
<div class="api-key-input">
<input type="password" id="setting-ai-apikey" placeholder="Enter your API key" />
<button type="button" class="btn-icon" id="toggle-apikey-visibility" title="Show/Hide">
<svg viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" fill="none">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
<circle cx="12" cy="12" r="3" />
</svg>
</button>
</div>
</div>
<div class="setting-row">
<label>Model ID</label>
<input type="text" id="setting-ai-model" placeholder="e.g., glm-4.7, gpt-4o, claude-3-5-sonnet" />
</div>
<div class="setting-row setting-row-actions">
<button type="button" class="btn btn-secondary" id="test-ai-connection">Test Connection</button>
<span id="ai-connection-status"></span>
</div>
</div>
<div class="settings-section">
<h3>Alive Editor Model (Optional)</h3>
<p class="settings-description">Faster model for real-time features. Leave blank to use main model.</p>
<div class="setting-row">
<label>Provider URL</label>
<input type="text" id="setting-alive-provider" placeholder="Same as above if blank" />
</div>
<div class="setting-row">
<label>API Key</label>
<input type="password" id="setting-alive-apikey" placeholder="Same as above if blank" />
</div>
<div class="setting-row">
<label>Model ID</label>
<input type="text" id="setting-alive-model" placeholder="e.g., gpt-4o-mini, gemini-flash" />
</div>
</div>
<div class="settings-section">
<h3>Image Model (For Mood Art)</h3>
<p class="settings-description">For generating chapter mood art thumbnails.</p>
<div class="setting-row">
<label>Image API URL</label>
<input type="text" id="setting-image-provider" placeholder="e.g., https://nano-gpt.com/api/v1" />
</div>
<div class="setting-row">
<label>API Key</label>
<input type="password" id="setting-image-apikey" placeholder="Image API key (or same as main)" />
</div>
<div class="setting-row">
<label>Model ID</label>
<input type="text" id="setting-image-model" placeholder="e.g., z-image-turbo" />
</div>
<div class="setting-row">
<label>Art Style</label>
<select id="setting-image-style">
<option value="">-- No style prefix --</option>
<option
value="Digital painting, fantasy book illustration, rich colors, dramatic lighting, magical atmosphere">
๐ง Fantasy</option>
<option value="Anime art style, vibrant colors, cel-shaded, expressive, Studio Ghibli inspired">๐ Anime
</option>
<option
value="Photorealistic, cinematic lighting, detailed textures, 8K quality, professional photography">๐ท
Realistic</option>
<option value="Modern minimalist design, clean lines, muted color palette, contemporary aesthetic">๐๏ธ
Modern</option>
<option
value="Dark gothic atmosphere, moody lighting, deep shadows, Victorian aesthetic, haunting beauty">๐ฆ
Gothic</option>
<option value="Watercolor painting, soft edges, pastel colors, dreamy atmosphere, artistic brush strokes">
๐จ
Watercolor</option>
<option value="Oil painting, classical art style, Renaissance inspired, rich textures, museum quality">
๐ผ๏ธ Classical</option>
<option value="Sci-fi concept art, futuristic, neon lights, cyberpunk aesthetic, high tech">๐ Sci-Fi
</option>
<option value="Noir style, black and white, high contrast, dramatic shadows, film noir aesthetic">๐ฌ
Noir</option>
<option value="Whimsical illustration, storybook style, charming, colorful, children's book aesthetic">
๐ Storybook</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" id="save-api-config">Save Configuration</button>
</div>
</div>
</div>
<!-- Image Gallery Modal -->
<div class="modal" id="image-gallery-modal">
<div class="modal-backdrop"></div>
<div class="modal-content modal-lg">
<div class="modal-header">
<h2>๐ผ๏ธ Image Gallery</h2>
<button class="modal-close" id="close-image-gallery">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
<div class="modal-body">
<p class="settings-description">All generated mood art images. Click to select for current chapter.</p>
<div class="gallery-grid" id="gallery-grid">
<!-- Images injected dynamically -->
</div>
</div>
</div>
</div>
<!-- Reading Mode Modal -->
<div class="reading-modal" id="reading-modal">
<div class="reading-modal-header">
<button class="icon-btn" id="close-reading">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
<span id="reading-title">Reading Mode</span>
</div>
<div class="reading-content" id="reading-content">
<!-- Reading content injected here -->
</div>
</div>
<!-- Hidden file input for opening projects -->
<input type="file" id="file-input" accept=".json" style="display: none;">
<!-- Selection Toolbar (no longer used, kept for potential future features) -->
<div id="selection-toolbar" class="selection-toolbar">
</div>
<!-- Project Selector Modal -->
<div class="modal" id="projects-modal">
<div class="modal-backdrop" id="projects-backdrop"></div>
<div class="modal-content modal-content-wide">
<div class="modal-header">
<h2>Your Projects</h2>
<button class="icon-btn" id="close-projects">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
<div class="modal-body">
<div class="projects-list" id="projects-list">
<!-- Projects will be listed here -->
</div>
<div class="projects-actions">
<button class="btn btn-secondary" id="import-project-btn">Import from File</button>
</div>
</div>
</div>
</div>
<!-- Thesaurus Modal -->
<div class="modal" id="thesaurus-modal">
<div class="modal-backdrop" id="thesaurus-backdrop"></div>
<div class="modal-content thesaurus-modal">
<div class="modal-header">
<h2>๐ Thesaurus</h2>
<button class="icon-btn" id="close-thesaurus">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
<div class="modal-body">
<div class="thesaurus-search-row">
<input type="text" id="thesaurus-input" placeholder="Enter a word..." autocomplete="off" />
<button class="btn btn-primary" id="thesaurus-search-btn">Search</button>
</div>
<div class="thesaurus-toggle">
<button class="toggle-btn active" id="toggle-synonyms">Synonyms</button>
<button class="toggle-btn" id="toggle-antonyms">Antonyms</button>
</div>
<div class="thesaurus-results" id="thesaurus-results">
<p class="thesaurus-hint">Enter a word and press Search to find synonyms or antonyms.</p>
</div>
</div>
</div>
</div>
</div>
<!-- Story Pulse Modal -->
<div class="modal story-pulse-modal" id="story-pulse-modal">
<div class="modal-backdrop" id="story-pulse-backdrop"></div>
<div class="modal-content story-pulse-content">
<div class="modal-header">
<h2>๐ Story Pulse</h2>
<button class="icon-btn" id="close-story-pulse">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body pulse-modal-body">
<div class="pulse-controls">
<label><input type="checkbox" class="metric-checkbox" value="pacing" checked> <span
style="color: #FF5733">Pacing</span></label>
<label><input type="checkbox" class="prev-checkbox" data-metric="pacing" title="Show previous analysis"> <span
class="prev-label">Prev</span></label>
<label><input type="checkbox" class="metric-checkbox" value="engagement" checked> <span
style="color: #28B463">Engagement</span></label>
<label><input type="checkbox" class="prev-checkbox" data-metric="engagement" title="Show previous analysis">
<span class="prev-label">Prev</span></label>
<label><input type="checkbox" class="metric-checkbox" value="enjoyability"> <span
style="color: #F1C40F">Enjoyability</span></label>
<label><input type="checkbox" class="prev-checkbox" data-metric="enjoyability" title="Show previous analysis">
<span class="prev-label">Prev</span></label>
<label><input type="checkbox" class="metric-checkbox" value="emotional"> <span
style="color: #8E44AD">Emotional</span></label>
<label><input type="checkbox" class="prev-checkbox" data-metric="emotional" title="Show previous analysis">
<span class="prev-label">Prev</span></label>
<label><input type="checkbox" class="metric-checkbox" value="tension" checked> <span
style="color: #C0392B">Tension</span></label>
<label><input type="checkbox" class="prev-checkbox" data-metric="tension" title="Show previous analysis">
<span class="prev-label">Prev</span></label>
<label><input type="checkbox" class="metric-checkbox" value="atmosphere"> <span
style="color: #2980B9">Atmosphere</span></label>
<label><input type="checkbox" class="prev-checkbox" data-metric="atmosphere" title="Show previous analysis">
<span class="prev-label">Prev</span></label>
<label><input type="checkbox" class="metric-checkbox" value="depth"> <span
style="color: #797D7F">Depth</span></label>
<label><input type="checkbox" class="prev-checkbox" data-metric="depth" title="Show previous analysis"> <span
class="prev-label">Prev</span></label>
</div>
<div class="pulse-graph-container" id="pulse-graph-container">
<div class="pulse-placeholder">Click "Run Analysis" to generate chapter-by-chapter metrics.</div>
</div>
<div class="pulse-notes-container" id="pulse-notes-container">
<h3>AI Analysis Notes</h3>
<div class="pulse-placeholder">Run analysis to see detailed justifications for each metric.</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" id="close-story-pulse-btn">Cancel</button>
<button class="btn btn-primary" id="btn-run-pulse">Run Analysis (Whole Book)</button>
</div>
</div>
</div>
<!-- Echo Chamber Modal -->
<div class="modal echo-chamber-modal" id="echo-chamber-modal">
<div class="modal-backdrop" id="echo-chamber-backdrop"></div>
<div class="modal-content echo-chamber-content">
<div class="modal-header">
<h2>๐ฌ Echo Chamber</h2>
<button class="icon-btn" id="close-echo-chamber">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<!-- Echo Chamber Controls -->
<div class="echo-controls">
<div class="echo-controls-left">
<button class="btn btn-success" id="btn-start-echo">โถ Start</button>
<button class="btn btn-danger" id="btn-stop-echo">โน Stop</button>
<span class="echo-status" id="echo-status">Echo Chamber is paused</span>
</div>
<div class="echo-controls-right">
<label>
Trigger:
<input type="number" id="echo-trigger-count" value="500" min="100" max="2000" step="100">
letters
</label>
<button class="btn btn-secondary btn-sm" id="btn-new-echo-chat" title="New Conversation">๐๏ธ New</button>
</div>
</div>
<!-- Echo Chat Container -->
<div class="modal-body echo-modal-body">
<div class="echo-chat-area">
<div class="echo-chat-container" id="echo-chat-container">
<div class="echo-placeholder">Start the Echo Chamber to see your readers react!</div>
</div>
</div>
<!-- Collapsible Change Log Panel -->
<div class="echo-log-panel" id="echo-log-panel">
<div class="echo-log-header" id="btn-toggle-echo-log">
<span>๐ Change Log</span>
<span class="echo-log-toggle">โผ</span>
</div>
<div class="echo-log-content" id="echo-log-content">
<div class="echo-log-empty">No changes logged yet.</div>
</div>
</div>
</div>
</div>
</div>
<!-- Connection Web Modal -->
<div class="modal connection-web-modal" id="connection-web-modal">
<div class="modal-backdrop" id="connection-web-backdrop"></div>
<div class="modal-content connection-web-content">
<div class="modal-header">
<h2>๐ธ๏ธ Connection Web</h2>
<div class="connection-web-controls-right">
<!-- Mode Toggle -->
<div class="mode-toggle" id="connection-web-mode-toggle">
<button class="mode-btn active" data-mode="ai">๐ค AI</button>
<button class="mode-btn" data-mode="custom">โ๏ธ Custom</button>
</div>
<button class="icon-btn" id="close-connection-web">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
</div>
<div class="modal-body connection-web-body">
<div class="connection-web-toolbar">
<!-- AI Mode Controls -->
<div class="ai-mode-controls" id="connection-web-ai-controls">
<button class="btn btn-primary" id="btn-generate-web">
<span class="btn-icon">โจ</span>
<span id="generate-web-text">Generate Web</span>
</button>
</div>
<!-- Custom Mode Controls -->
<div class="custom-mode-controls hidden" id="connection-web-custom-controls">
<div class="item-manager-dropdown" id="webs-dropdown">
<button class="btn btn-sm" id="btn-webs">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"></circle>
<line x1="2" y1="12" x2="22" y2="12"></line>
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z">
</path>
</svg>
<span id="current-web-name">Main Web</span>
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="6 9 12 15 18 9" />
</svg>
</button>
<div class="item-manager-menu hidden" id="webs-menu">
<div class="item-manager-list" id="webs-list"></div>
<div class="item-manager-actions">
<button class="item-action-btn" id="btn-new-web">+ New Web</button>
</div>
</div>
</div>
</div>
<!-- Shared Controls -->
<button class="btn btn-secondary" id="btn-add-node" title="Add Node">
<span class="btn-icon">โ</span> Add Node
</button>
<button class="btn btn-secondary" id="btn-add-edge" title="Link Nodes">