-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
581 lines (536 loc) · 40.7 KB
/
index.html
File metadata and controls
581 lines (536 loc) · 40.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>MimicNotes — Notes That Learn You</title>
<link href="https://fonts.googleapis.com/css2?family=Caveat:wght@400;600;700&family=DM+Mono:ital,wght@0,300;0,400;1,300&family=Fraunces:ital,wght@0,300;0,700;1,400&display=swap" rel="stylesheet">
<style>
:root{--ink:#1a1410;--paper:#f5f0e8;--cream:#ede7d3;--amber:#d4841a;--rust:#c0392b;--sage:#5a7a5a;--blue:#2c5f8a;--purple:#6b4c8a;--line:rgba(26,20,16,0.12);--shadow:rgba(26,20,16,0.14);}
*{margin:0;padding:0;box-sizing:border-box;}
body{background:var(--paper);color:var(--ink);font-family:'DM Mono',monospace;min-height:100vh;background-image:repeating-linear-gradient(transparent,transparent 31px,var(--line) 31px,var(--line) 32px);background-attachment:fixed;overflow-x:hidden;}
body::after{content:'';position:fixed;left:60px;top:0;bottom:0;width:2px;background:rgba(192,57,43,0.2);pointer-events:none;z-index:999;}
/* HEADER */
header{padding:14px 18px 12px 80px;border-bottom:2px solid var(--line);display:flex;align-items:center;gap:10px;flex-wrap:wrap;position:sticky;top:0;background:rgba(245,240,232,0.96);backdrop-filter:blur(8px);z-index:100;}
.logo{font-family:'Caveat',cursive;font-size:32px;font-weight:700;letter-spacing:-1px;flex-shrink:0;}
.logo span{color:var(--amber);}
.nav-tabs{display:flex;gap:4px;}
.tab-btn{background:transparent;border:1px solid var(--line);padding:6px 13px;border-radius:4px;font-family:'DM Mono',monospace;font-size:11px;cursor:pointer;color:var(--ink);transition:all 0.2s;position:relative;}
.tab-btn:hover{border-color:var(--amber);color:var(--amber);}
.tab-btn.active{background:var(--ink);color:var(--paper);border-color:var(--ink);}
.badge{position:absolute;top:-6px;right:-6px;background:var(--rust);color:white;border-radius:10px;padding:1px 5px;font-size:9px;min-width:16px;text-align:center;}
.api-wrap{display:flex;gap:6px;align-items:center;margin-left:auto;flex-wrap:wrap;}
.api-wrap input{background:var(--cream);border:1px solid var(--line);border-radius:4px;padding:7px 10px;font-family:'DM Mono',monospace;font-size:11px;color:var(--ink);width:195px;outline:none;}
.api-wrap input:focus{border-color:var(--amber);}
.api-wrap input::placeholder{opacity:0.4;}
.api-wrap select{background:var(--cream);border:1px solid var(--line);border-radius:4px;padding:7px 8px;font-family:'DM Mono',monospace;font-size:11px;color:var(--ink);outline:none;cursor:pointer;}
.btn{background:var(--amber);color:white;border:none;padding:7px 12px;border-radius:4px;font-family:'DM Mono',monospace;font-size:11px;cursor:pointer;transition:opacity 0.2s;white-space:nowrap;}
.btn:hover{opacity:0.85;}
.btn.ghost{background:transparent;border:1px solid var(--line);color:var(--ink);}
.btn.ghost:hover{border-color:var(--amber);color:var(--amber);}
.btn.danger{background:var(--rust);}
.btn.full{width:100%;}
.btn:disabled{opacity:0.4;cursor:not-allowed;}
.score-pill{display:flex;align-items:center;gap:7px;background:var(--cream);border:1px solid var(--line);border-radius:20px;padding:5px 12px;font-size:10px;flex-shrink:0;}
.score-bar{width:48px;height:3px;background:var(--line);border-radius:2px;overflow:hidden;}
.score-fill{height:100%;background:linear-gradient(90deg,var(--sage),var(--amber));border-radius:2px;transition:width 0.6s ease;}
/* VIEWS */
.view{display:none;}.view.active{display:block;}
/* GENERATE */
.gen-layout{display:grid;grid-template-columns:330px 1fr;min-height:calc(100vh - 76px);}
.p-left{padding:22px 18px 22px 80px;border-right:2px solid var(--line);overflow-y:auto;max-height:calc(100vh - 76px);}
.p-right{padding:22px 22px 22px 18px;position:relative;overflow-y:auto;max-height:calc(100vh - 76px);}
.panel-label{font-family:'Fraunces',serif;font-size:10px;font-weight:300;letter-spacing:0.2em;text-transform:uppercase;color:var(--amber);margin-bottom:13px;}
.steps{display:flex;gap:5px;margin-bottom:13px;align-items:center;}
.step{display:flex;align-items:center;gap:4px;font-size:10px;opacity:0.3;transition:opacity 0.3s;}
.step.active{opacity:1;}.step.done{opacity:0.6;color:var(--sage);}
.step-dot{width:16px;height:16px;border-radius:50%;border:1.5px solid currentColor;display:flex;align-items:center;justify-content:center;font-size:9px;flex-shrink:0;}
.step.done .step-dot{background:var(--sage);color:white;border-color:transparent;}
.step.active .step-dot{border-color:var(--amber);color:var(--amber);}
.upload-zone{border:2px dashed rgba(26,20,16,0.18);border-radius:8px;padding:26px 14px;text-align:center;cursor:pointer;transition:all 0.3s;background:rgba(255,255,255,0.3);position:relative;margin-bottom:12px;}
.upload-zone:hover,.drag-over{border-color:var(--amber)!important;background:rgba(212,132,26,0.05)!important;}
.upload-zone input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%;}
.upload-zone h3{font-family:'Caveat',cursive;font-size:20px;font-weight:600;margin-bottom:4px;}
.upload-zone p{font-size:10px;opacity:0.42;}
.photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(78px,1fr));gap:6px;margin-bottom:12px;}
.pt{position:relative;aspect-ratio:4/3;border-radius:4px;overflow:hidden;border:1.5px solid var(--line);animation:fi 0.3s;}
.pt img{width:100%;height:100%;object-fit:cover;}
.pt .rm{position:absolute;top:2px;right:2px;background:var(--rust);color:white;border:none;border-radius:50%;width:15px;height:15px;font-size:10px;cursor:pointer;display:flex;align-items:center;justify-content:center;}
.style-box{background:rgba(255,255,255,0.4);border:1px solid var(--line);border-radius:8px;padding:12px;margin-bottom:12px;display:none;}
.style-box.on{display:block;animation:fi 0.4s;}
.style-box h4{font-family:'Fraunces',serif;font-size:10px;font-weight:300;letter-spacing:0.12em;text-transform:uppercase;color:var(--sage);margin-bottom:8px;}
.stag{display:inline-block;background:var(--cream);border:1px solid var(--line);border-radius:20px;padding:2px 8px;font-size:10px;margin:2px;}
.stag.dom{background:var(--amber);color:white;border-color:transparent;}
.style-evo{font-size:10px;color:var(--sage);margin-top:8px;font-style:italic;opacity:0.75;}
.sug-box{margin-bottom:12px;}
.sug-lbl{font-size:9px;letter-spacing:0.12em;text-transform:uppercase;opacity:0.4;margin-bottom:5px;}
.chips{display:flex;flex-wrap:wrap;gap:5px;}
.chip{background:var(--cream);border:1px solid var(--line);border-radius:20px;padding:3px 9px;font-size:10px;cursor:pointer;transition:all 0.2s;font-family:'DM Mono',monospace;}
.chip:hover{border-color:var(--amber);color:var(--amber);}
.chip.gap{border-color:var(--rust);color:var(--rust);}
.chip.conn{border-color:var(--sage);color:var(--sage);}
.flabel{font-size:9px;letter-spacing:0.12em;text-transform:uppercase;opacity:0.43;margin-bottom:5px;display:block;}
.topic-in{width:100%;background:rgba(255,255,255,0.4);border:1px solid var(--line);border-radius:4px;padding:10px 12px;font-family:'Caveat',cursive;font-size:20px;color:var(--ink);outline:none;transition:border-color 0.2s;margin-bottom:9px;}
.topic-in:focus{border-color:var(--amber);}
.topic-in::placeholder{opacity:0.3;}
.gen-btn{width:100%;background:var(--ink);color:var(--paper);border:none;padding:13px;border-radius:6px;font-family:'Caveat',cursive;font-size:21px;cursor:pointer;transition:background 0.3s;margin-bottom:6px;}
.gen-btn:hover{background:var(--amber);}
.gen-btn:disabled{opacity:0.4;cursor:not-allowed;}
.empty-s{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:360px;opacity:0.22;text-align:center;}
.empty-s .big{font-family:'Caveat',cursive;font-size:68px;line-height:1;}
.empty-s p{font-size:11px;letter-spacing:0.07em;margin-top:10px;}
.notes-out{display:none;animation:fi 0.5s;}.notes-out.on{display:block;}
.notes-hdr{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;gap:8px;flex-wrap:wrap;}
.notes-title{font-family:'Caveat',cursive;font-size:27px;font-weight:700;}
.notes-acts{display:flex;gap:6px;}
.nc{font-family:'Caveat',cursive;font-size:19px;line-height:1.85;color:var(--ink);}
.nc h1{font-size:30px;font-weight:700;margin:16px 0 9px;color:var(--blue);border-bottom:2px solid var(--line);padding-bottom:5px;}
.nc h2{font-size:24px;font-weight:600;margin:14px 0 7px;color:var(--amber);}
.nc h3{font-size:20px;font-weight:600;margin:12px 0 5px;color:var(--rust);}
.nc p{margin-bottom:9px;}.nc ul,.nc ol{padding-left:20px;margin-bottom:9px;}.nc li{margin-bottom:4px;}
.nc blockquote{border-left:3px solid var(--amber);padding-left:12px;font-style:italic;color:var(--sage);margin:12px 0;}
.nc code{background:rgba(0,0,0,0.07);padding:1px 5px;border-radius:3px;font-family:'DM Mono',monospace;font-size:0.78em;}
.nc .diag{background:rgba(255,255,255,0.5);border:1.5px solid var(--line);border-radius:8px;padding:13px;margin:11px 0;text-align:center;font-family:'DM Mono',monospace;font-size:11px;white-space:pre-wrap;color:var(--sage);}
.nc strong{background:rgba(212,132,26,0.16);padding:1px 4px;border-radius:3px;}
.related-sec{margin-top:20px;border-top:2px solid var(--line);padding-top:16px;}
.related-sec h4{font-family:'Fraunces',serif;font-size:10px;font-weight:300;letter-spacing:0.16em;text-transform:uppercase;color:var(--purple);margin-bottom:9px;}
.rc{background:rgba(255,255,255,0.4);border:1px solid var(--line);border-radius:6px;padding:9px 12px;margin-bottom:6px;cursor:pointer;transition:all 0.2s;}
.rc:hover{border-color:var(--purple);}
.rc-topic{font-family:'Caveat',cursive;font-size:17px;font-weight:600;}
.rc-meta{font-size:9px;opacity:0.4;margin-top:1px;}
.rc-conn{font-size:10px;color:var(--sage);margin-top:2px;font-style:italic;}
.ld{display:none;position:absolute;inset:0;background:rgba(245,240,232,0.9);align-items:center;justify-content:center;flex-direction:column;z-index:10;backdrop-filter:blur(4px);}
.ld.on{display:flex;}
.ld-icon{font-size:40px;animation:wr 1.2s ease-in-out infinite;}
.ld-text{font-family:'Caveat',cursive;font-size:21px;margin-top:11px;animation:pl 1.5s ease-in-out infinite;}
.ld-sub{font-size:10px;opacity:0.43;margin-top:3px;letter-spacing:0.1em;}
.prog{width:150px;height:3px;background:var(--line);border-radius:2px;margin-top:11px;overflow:hidden;}
.prog-fill{height:100%;background:var(--amber);width:0%;transition:width 0.5s ease;border-radius:2px;}
/* LIBRARY */
#libraryView{padding:26px 22px 26px 80px;}
.lib-hdr{display:flex;align-items:center;gap:12px;margin-bottom:20px;flex-wrap:wrap;}
.lib-hdr h2{font-family:'Fraunces',serif;font-size:25px;font-weight:300;}
.search-in{background:var(--cream);border:1px solid var(--line);border-radius:4px;padding:7px 12px;font-family:'DM Mono',monospace;font-size:11px;color:var(--ink);outline:none;width:210px;margin-left:auto;}
.search-in:focus{border-color:var(--amber);}
.lib-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:13px;}
.ncard{background:rgba(255,255,255,0.5);border:1.5px solid var(--line);border-radius:8px;padding:15px;cursor:pointer;transition:all 0.25s;position:relative;overflow:hidden;animation:fi 0.3s;}
.ncard::before{content:'';position:absolute;top:0;left:0;right:0;height:3px;background:var(--amber);}
.ncard:hover{border-color:var(--amber);transform:translateY(-2px);box-shadow:0 7px 20px var(--shadow);}
.nc-top{font-family:'Caveat',cursive;font-size:20px;font-weight:700;margin-bottom:4px;}
.nc-date{font-size:9px;opacity:0.38;margin-bottom:7px;}
.nc-prev{font-size:11px;opacity:0.58;line-height:1.5;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}
.nc-tags{display:flex;flex-wrap:wrap;gap:3px;margin-top:9px;}
.nc-tag{background:var(--cream);border:1px solid var(--line);border-radius:10px;padding:2px 7px;font-size:9px;opacity:0.6;}
.del-btn{position:absolute;top:9px;right:9px;opacity:0;background:var(--rust);color:white;border:none;border-radius:3px;padding:2px 6px;font-size:9px;cursor:pointer;transition:opacity 0.2s;}
.ncard:hover .del-btn{opacity:1;}
.lib-empty{text-align:center;padding:60px 20px;opacity:0.26;}
.lib-empty .big{font-family:'Caveat',cursive;font-size:58px;}
.lib-empty p{font-size:11px;letter-spacing:0.08em;margin-top:9px;}
/* MODAL */
.modal-bg{display:none;position:fixed;inset:0;background:rgba(26,20,16,0.5);z-index:500;align-items:center;justify-content:center;padding:18px;}
.modal-bg.on{display:flex;}
.modal-box{background:var(--paper);border-radius:12px;max-width:680px;width:100%;max-height:86vh;overflow-y:auto;padding:28px 32px;position:relative;background-image:repeating-linear-gradient(transparent,transparent 31px,var(--line) 31px,var(--line) 32px);}
.modal-close{position:sticky;top:0;float:right;background:var(--ink);color:white;border:none;border-radius:4px;padding:5px 10px;font-size:10px;cursor:pointer;margin-bottom:12px;}
/* INSIGHTS */
#insightsView{padding:26px 22px 26px 80px;}
.ins-hdr{margin-bottom:22px;}
.ins-hdr h2{font-family:'Fraunces',serif;font-size:25px;font-weight:300;margin-bottom:2px;}
.ins-hdr p{font-size:11px;opacity:0.42;}
.ins-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:11px;margin-bottom:22px;}
.icard{background:rgba(255,255,255,0.5);border:1.5px solid var(--line);border-radius:8px;padding:16px;}
.icard .il{font-size:9px;letter-spacing:0.13em;text-transform:uppercase;opacity:0.4;margin-bottom:6px;}
.icard .iv{font-family:'Caveat',cursive;font-size:38px;font-weight:700;line-height:1;color:var(--amber);}
.icard .is{font-size:10px;opacity:0.48;margin-top:4px;}
.sec-title{font-family:'Fraunces',serif;font-size:11px;font-weight:300;letter-spacing:0.15em;text-transform:uppercase;color:var(--purple);margin-bottom:11px;}
.tmap{background:rgba(255,255,255,0.4);border:1.5px solid var(--line);border-radius:10px;padding:18px;margin-bottom:18px;}
.tnodes{display:flex;flex-wrap:wrap;gap:7px;}
.tnode{background:var(--cream);border:1.5px solid var(--line);border-radius:6px;padding:6px 12px;font-size:11px;cursor:pointer;transition:all 0.2s;}
.tnode:hover{border-color:var(--amber);transform:scale(1.03);}
.tnode.lg{font-size:15px;padding:8px 15px;font-family:'Caveat',cursive;font-weight:600;}
.tnode.sm{font-size:10px;opacity:0.6;}
.tc{font-size:8px;opacity:0.4;margin-top:1px;}
.gaps-box{margin-bottom:18px;}
.gap-item{display:flex;align-items:center;gap:9px;background:rgba(192,57,43,0.05);border:1px solid rgba(192,57,43,0.13);border-radius:6px;padding:10px 13px;margin-bottom:6px;cursor:pointer;transition:all 0.2s;}
.gap-item:hover{background:rgba(192,57,43,0.1);}
.gap-topic{font-family:'Caveat',cursive;font-size:17px;font-weight:600;}
.gap-reason{font-size:10px;opacity:0.52;margin-top:1px;}
.gap-cta{margin-left:auto;background:var(--rust);color:white;border:none;border-radius:4px;padding:4px 8px;font-size:9px;cursor:pointer;font-family:'DM Mono',monospace;white-space:nowrap;}
.evo-box{background:rgba(255,255,255,0.4);border:1.5px solid var(--line);border-radius:10px;padding:18px;margin-bottom:18px;}
.tl-item{display:flex;gap:11px;margin-bottom:12px;align-items:flex-start;}
.tl-dot{width:8px;height:8px;border-radius:50%;background:var(--amber);flex-shrink:0;margin-top:3px;}
.tl-sess{font-size:9px;opacity:0.38;margin-bottom:2px;}
.tl-ch{font-size:11px;line-height:1.5;}
@keyframes fi{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
@keyframes wr{0%,100%{transform:rotate(-5deg) translateX(0)}50%{transform:rotate(5deg) translateX(7px)}}
@keyframes pl{0%,100%{opacity:0.55}50%{opacity:1}}
.toast{position:fixed;bottom:16px;right:16px;background:var(--ink);color:var(--paper);padding:9px 15px;border-radius:6px;font-size:11px;font-family:'DM Mono',monospace;transform:translateY(50px);opacity:0;transition:all 0.3s;z-index:9999;}
.toast.on{transform:translateY(0);opacity:1;}
@media(max-width:768px){
body::after{left:26px;}
header{padding:11px 11px 9px 38px;gap:7px;}
.logo{font-size:24px;}
.api-wrap input{width:140px;}
.gen-layout{grid-template-columns:1fr;}
.p-left{padding:16px 11px 16px 38px;max-height:none;border-right:none;border-bottom:2px solid var(--line);}
.p-right{padding:16px 11px 16px 38px;max-height:none;}
#libraryView,#insightsView{padding:16px 11px 16px 38px;}
.modal-box{padding:16px 14px;}
.nav-tabs{width:100%;}
.tab-btn{flex:1;text-align:center;font-size:10px;padding:5px 5px;}
}
</style>
</head>
<body>
<header>
<div class="logo">Mimic<span>Notes</span></div>
<div class="nav-tabs">
<button class="tab-btn active" onclick="showView('generate',this)">✏️ Generate</button>
<button class="tab-btn" onclick="showView('library',this)">📚 Library<span class="badge" id="libBadge" style="display:none">0</span></button>
<button class="tab-btn" onclick="showView('insights',this)">🧠 Insights</button>
</div>
<div class="api-wrap">
<input type="password" id="apiKey" placeholder="AIza… Gemini API key"/>
<select id="modelSel">
<option value="gemini-2.5-flash" selected>gemini-2.5-flash</option>
<option value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option>
<option value="gemini-2.5-pro">gemini-2.5-pro</option>
</select>
<button class="btn" onclick="saveKey()">Save</button>
</div>
<div class="score-pill" title="Style accuracy grows with every session">
<span style="font-size:9px;opacity:0.5">fit</span>
<div class="score-bar"><div class="score-fill" id="scoreFill" style="width:0%"></div></div>
<span id="scoreLabel" style="font-size:10px;font-weight:bold">0%</span>
</div>
</header>
<!-- GENERATE -->
<div class="view active" id="generateView">
<div class="gen-layout">
<div class="p-left">
<div class="panel-label">01 — Upload Your Notes</div>
<div class="steps">
<div class="step active" id="s1"><div class="step-dot">1</div><span>Upload</span></div>
<span style="opacity:0.2;font-size:10px">→</span>
<div class="step" id="s2"><div class="step-dot">2</div><span>Analyze</span></div>
<span style="opacity:0.2;font-size:10px">→</span>
<div class="step" id="s3"><div class="step-dot">3</div><span>Generate</span></div>
</div>
<div class="upload-zone" id="uz">
<input type="file" id="fileIn" accept="image/*" multiple capture="environment"/>
<span style="font-size:36px;display:block;margin-bottom:6px;opacity:0.5">📷</span>
<h3>Tap to photograph notes</h3>
<p>JPG · PNG · HEIC · multiple OK</p>
</div>
<div class="photo-grid" id="photoGrid"></div>
<div class="style-box" id="styleBox">
<h4>✦ Your Style Profile</h4>
<div id="styleTags"></div>
<div class="style-evo" id="styleEvo"></div>
</div>
<div class="sug-box" id="sugBox" style="display:none">
<div class="sug-lbl">💡 Suggested next topics</div>
<div class="chips" id="sugChips"></div>
</div>
<label class="flabel" for="topicIn">Topic to take notes on</label>
<input type="text" class="topic-in" id="topicIn" placeholder="e.g. Mitosis, WWII, Derivatives…"/>
<button class="gen-btn" id="genBtn" onclick="generate()">✏️ Generate My Notes</button>
<button class="btn ghost full" style="margin-top:0" onclick="generateNoPhoto()">Generate from topic only (use saved style)</button>
</div>
<div class="p-right">
<div class="panel-label">02 — Your Personalized Notes</div>
<div style="position:relative">
<div class="empty-s" id="emptyState">
<div class="big">✎</div>
<p>Upload a photo · enter a topic · generate</p>
</div>
<div class="notes-out" id="notesOut">
<div class="notes-hdr">
<div class="notes-title" id="notesTitle">Notes</div>
<div class="notes-acts">
<button class="btn ghost" onclick="copyNotes()">Copy</button>
<button class="btn" onclick="saveNote()">Save to Library</button>
</div>
</div>
<div class="nc" id="notesContent"></div>
<div class="related-sec" id="relSec" style="display:none">
<h4>🔗 From Your Library — Related Notes</h4>
<div id="relList"></div>
</div>
</div>
<div class="ld" id="ldDiv">
<div class="ld-icon">✏️</div>
<div class="ld-text" id="ldText">Analyzing…</div>
<div class="ld-sub" id="ldSub">reading patterns</div>
<div class="prog"><div class="prog-fill" id="progFill"></div></div>
</div>
</div>
</div>
</div>
</div>
<!-- LIBRARY -->
<div class="view" id="libraryView">
<div class="lib-hdr">
<h2>📚 Notes Library</h2>
<input class="search-in" id="libSearch" placeholder="Search topics…" oninput="renderLib()"/>
<button class="btn danger" onclick="clearLib()">Clear all</button>
</div>
<div class="lib-grid" id="libGrid"></div>
<div class="lib-empty" id="libEmpty" style="display:none">
<div class="big">📭</div>
<p>No notes yet — generate some and save them!</p>
</div>
</div>
<!-- INSIGHTS -->
<div class="view" id="insightsView">
<div class="ins-hdr">
<h2>🧠 Learning Insights</h2>
<p>Your profile gets smarter every session</p>
</div>
<div class="ins-grid" id="insGrid"></div>
<div class="tmap"><div class="sec-title">Topic Universe</div><div class="tnodes" id="topicNodes"><p style="opacity:0.32;font-size:11px">Save notes to build your topic map</p></div></div>
<div class="gaps-box"><div class="sec-title">📍 Knowledge Gaps</div><div id="gapsList"><p style="opacity:0.32;font-size:11px">Save more notes to get gap analysis</p></div></div>
<div class="evo-box"><div class="sec-title">Style Evolution Timeline</div><div id="evoContent"><p style="opacity:0.32;font-size:11px">More sessions = more timeline data</p></div></div>
</div>
<!-- MODAL -->
<div class="modal-bg" id="modalBg" onclick="closeMod(event)">
<div class="modal-box"><button class="modal-close" onclick="closeModDirect()">✕ close</button><div id="modalContent"></div></div>
</div>
<div class="toast" id="toast"></div>
<script>
let imgs=[],styleProfile=null,curNoteText='',curTopic='';
/* STORAGE */
function getDB(){try{return JSON.parse(localStorage.getItem('mn_db')||'{}')}catch{return{}}}
function saveDB(d){localStorage.setItem('mn_db',JSON.stringify(d))}
function getProf(){const d=getDB();return d.prof||{sessions:0,styleHist:[],cumStyle:null,topics:[],studyDates:[]}}
function saveProf(p){const d=getDB();d.prof=p;saveDB(d)}
function getNotes(){const d=getDB();return d.notes||[]}
function saveNotes(n){const d=getDB();d.notes=n;saveDB(d)}
/* INIT */
window.addEventListener('load',()=>{
const k=localStorage.getItem('mn_key');if(k)document.getElementById('apiKey').value=k;
updateScore();updateBadge();loadSugs();
});
function saveKey(){localStorage.setItem('mn_key',document.getElementById('apiKey').value.trim());toast('Key saved ✓')}
function getKey(){return document.getElementById('apiKey').value.trim()}
function getModel(){return document.getElementById('modelSel').value}
/* VIEWS */
function showView(n,btn){
document.querySelectorAll('.view').forEach(v=>v.classList.remove('active'));
document.querySelectorAll('.tab-btn').forEach(b=>b.classList.remove('active'));
document.getElementById(n+'View').classList.add('active');
if(btn)btn.classList.add('active');
if(n==='library')renderLib();
if(n==='insights')renderInsights();
}
/* UPLOAD */
document.getElementById('fileIn').addEventListener('change',e=>handleFiles(e.target.files));
const uz=document.getElementById('uz');
uz.addEventListener('dragover',e=>{e.preventDefault();uz.classList.add('drag-over')});
uz.addEventListener('dragleave',()=>uz.classList.remove('drag-over'));
uz.addEventListener('drop',e=>{e.preventDefault();uz.classList.remove('drag-over');handleFiles(e.dataTransfer.files)});
function handleFiles(files){
Array.from(files).forEach(f=>{
if(!f.type.startsWith('image/'))return;
const r=new FileReader();
r.onload=e=>{imgs.push({url:e.target.result,b64:e.target.result.split(',')[1],mime:f.type});renderPhotos();smark(1,'done');smark(2,'active');if(imgs.length===1)setTimeout(analyzeStyle,700);};
r.readAsDataURL(f);
});
}
function renderPhotos(){document.getElementById('photoGrid').innerHTML=imgs.map((img,i)=>`<div class="pt"><img src="${img.url}"/><button class="rm" onclick="rmPhoto(${i})">×</button></div>`).join('');}
function rmPhoto(i){imgs.splice(i,1);renderPhotos();if(!imgs.length){smark(1,'active');smark(2,'');}}
/* ANALYZE */
async function analyzeStyle(){
if(!getKey()||!imgs.length)return;
setLoad(true,'Reading your style…','analyzing handwriting',22);
try{
const p=getProf();
const prior=p.cumStyle?`\n\nPRIOR PROFILE (${p.sessions} sessions): ${JSON.stringify(p.cumStyle)}\nRefine/blend with new observations.`:'';
const parts=[...imgs.slice(0,3).map(i=>({inline_data:{mime_type:i.mime,data:i.b64}})),
{text:`Analyze handwritten notes. Return ONLY valid JSON:\n{"noteStyle":"bullet-heavy|paragraph-heavy|mixed|outline|cornell|mind-map","visualElements":["diagrams","arrows","boxes","highlights","doodles"],"writingDensity":"sparse|moderate|dense","organizationPattern":"hierarchical|linear|clustered|flowing","emphasisStyle":["underline","caps","circle","stars"],"detailLevel":"brief-keywords|short-phrases|full-sentences|detailed-paragraphs","analogyUsage":"none|occasional|frequent","colorUsage":"monochrome|minimal-color|multi-color","abbreviations":"none|some|heavy","subjectArea":"detected subject","personalFlair":"unique trait","dominantTrait":"top characteristic","confidenceScore":0.5}${prior}`}];
const res=await callGemini(parts);
const m=res.match(/\{[\s\S]*\}/);
if(m){styleProfile=JSON.parse(m[0]);updateCumProf(styleProfile);showStyleBox();smark(2,'done');smark(3,'active');updateScore();loadSugs();}
}catch(e){console.error(e);toast('⚠ '+e.message);}
setLoad(false);
}
function updateCumProf(sp){
const p=getProf();p.sessions=(p.sessions||0)+1;p.cumStyle=sp;p.styleHist=p.styleHist||[];
p.styleHist.push({date:new Date().toLocaleDateString(),snap:{noteStyle:sp.noteStyle,detailLevel:sp.detailLevel,analogyUsage:sp.analogyUsage,dominantTrait:sp.dominantTrait}});
if(p.styleHist.length>10)p.styleHist=p.styleHist.slice(-10);
p.studyDates=p.studyDates||[];const today=new Date().toDateString();if(!p.studyDates.includes(today))p.studyDates.push(today);
saveProf(p);
}
function showStyleBox(){
if(!styleProfile)return;const sp=styleProfile;
const tags=[{l:sp.dominantTrait,dom:true},{l:sp.noteStyle?.replace(/-/g,' ')},{l:sp.detailLevel?.replace(/-/g,' ')},...(sp.visualElements||[]).slice(0,3).map(v=>({l:v})),{l:sp.analogyUsage!=='none'?sp.analogyUsage+' analogies':null},{l:sp.abbreviations!=='none'?sp.abbreviations+' abbr':null}].filter(t=>t.l);
document.getElementById('styleTags').innerHTML=tags.map(t=>`<span class="stag ${t.dom?'dom':''}">${t.l}</span>`).join('');
const p=getProf();document.getElementById('styleEvo').textContent=p.sessions>1?`↑ Refined across ${p.sessions} sessions · ${Math.round((sp.confidenceScore||0.5)*100)}% confidence`:(sp.personalFlair?`"${sp.personalFlair}"`:'');
document.getElementById('styleBox').classList.add('on');
}
/* SUGGESTIONS */
function loadSugs(){
const notes=getNotes();const p=getProf();if(!notes.length&&!p.cumStyle)return;
const sugs=buildSugs(notes.map(n=>n.topic),p.cumStyle);if(!sugs.length)return;
document.getElementById('sugBox').style.display='block';
document.getElementById('sugChips').innerHTML=sugs.map(s=>`<div class="chip ${s.t}" onclick="fillT('${s.topic}')" title="${s.r}">${s.topic}</div>`).join('');
}
function buildSugs(topics,style){
const sugs=[];const tl=topics.map(t=>t.toLowerCase());
const map={biology:['Meiosis','Photosynthesis','DNA Replication','Natural Selection','Cell Respiration','Mitosis'],history:['World War II','Cold War','French Revolution','Industrial Revolution','Civil Rights','Napoleon'],math:['Integration','Derivatives','Limits','Matrices','Probability','Statistics','Trigonometry'],chemistry:['Stoichiometry','Chemical Bonding','Thermodynamics','Organic Chemistry'],physics:["Newton's Laws","Thermodynamics","Quantum Mechanics","Electromagnetism"],cs:['Big O Notation','Sorting Algorithms','Data Structures','Recursion','Dynamic Programming']};
let det=null;for(const[s,rel]of Object.entries(map)){if(rel.some(t=>tl.some(saved=>saved.includes(t.toLowerCase().split(' ')[0])))){det=s;break;}}
if(det)map[det].filter(t=>!tl.includes(t.toLowerCase())).slice(0,3).forEach(t=>sugs.push({topic:t,t:'conn',r:`Related to your ${det} notes`}));
const pairs=[{c:'mitosis',s:'Meiosis',r:'Cell division continuation'},{c:'derivative',s:'Integration',r:'Calc follow-up'},{c:'integration',s:'Differential Equations',r:'Next calc level'},{c:'world war i',s:'World War II',r:'Historical continuation'},{c:'french revolution',s:'Napoleon Bonaparte',r:'Direct continuation'},{c:'newton',s:'Thermodynamics',r:'Physics follow-up'},{c:'sorting',s:'Dynamic Programming',r:'Algorithms follow-up'},{c:'cell',s:'DNA Replication',r:'Cell biology follow-up'}];
pairs.forEach(({c,s,r})=>{if(tl.some(t=>t.includes(c))&&!tl.some(t=>t.includes(s.toLowerCase())))sugs.push({topic:s,t:'gap',r});});
return sugs.slice(0,5);
}
function fillT(t){document.getElementById('topicIn').value=t;document.getElementById('topicIn').focus();}
/* GENERATE */
async function generate(){
if(!getKey()){toast('⚠ Enter your Gemini key');return;}
const topic=document.getElementById('topicIn').value.trim();
if(!topic){toast('⚠ Enter a topic');return;}
if(!imgs.length){toast('⚠ Upload at least one photo');return;}
if(!styleProfile)await analyzeStyle();
await doGen(topic);
}
async function generateNoPhoto(){
if(!getKey()){toast('⚠ Enter your Gemini key');return;}
const topic=document.getElementById('topicIn').value.trim();
if(!topic){toast('⚠ Enter a topic');return;}
const p=getProf();if(p.cumStyle){styleProfile=p.cumStyle;showStyleBox();}
await doGen(topic);
}
async function doGen(topic){
setLoad(true,'Writing your notes…','mimicking your style',50);
const notes=getNotes();
const ctx=notes.slice(-3).map(n=>`TOPIC:${n.topic}\nPREVIEW:${n.content.slice(0,170)}…`).join('\n\n');
const si=buildSI(styleProfile);
try{
const parts=[...imgs.slice(0,4).map(i=>({inline_data:{mime_type:i.mime,data:i.b64}})),
{text:`You are a personalized AI note-taker that perfectly mimics a student's unique style.\n\nSTYLE PROFILE:\n${JSON.stringify(styleProfile||getProf().cumStyle||{},null,2)}\n\nSTYLE INSTRUCTIONS:\n${si}\n\n${ctx?'PRIOR NOTES CONTEXT (reference when relevant):\n'+ctx+'\n\n':''}TOPIC: "${topic}"\n\nCreate comprehensive notes that:\n1. Perfectly mimic this student's style\n2. Reference prior topics where relevant ("As you saw in [topic]…")\n3. Match exact detail level, structure, density\n4. Include ASCII diagrams if they use visuals\n5. Match abbreviations, analogy frequency, emphasis style\n6. End with "📌 Next to study:" suggestions\n\nUse markdown (#, ##, ###, **bold**, >, bullets). Write now:`}];
const res=await callGemini(parts);
curNoteText=res;curTopic=topic;renderNotes(topic,res);smark(3,'done');
const p=getProf();if(!p.topics)p.topics=[];if(!p.topics.includes(topic)){p.topics.push(topic);saveProf(p);}
showRelated(topic);loadSugs();updateScore();
}catch(e){console.error(e);toast('⚠ '+e.message);}
setLoad(false);
}
function buildSI(sp){
if(!sp)return'Use a clear balanced style.';const i=[];
if(sp.noteStyle==='bullet-heavy')i.push('Bullet points for EVERYTHING.');
else if(sp.noteStyle==='paragraph-heavy')i.push('Full flowing paragraphs. No bullets.');
else if(sp.noteStyle==='cornell')i.push('Cornell format: main right, questions left, summary bottom.');
else if(sp.noteStyle==='mind-map')i.push('Mind-map style: hierarchical indentation, show connections.');
if(sp.visualElements?.includes('diagrams'))i.push('Include ASCII diagrams and flowcharts.');
if(sp.detailLevel==='brief-keywords')i.push('CONCISE — keywords only, no full sentences.');
else if(sp.detailLevel==='detailed-paragraphs')i.push('Very thorough — textbook-level explanations.');
if(sp.analogyUsage==='frequent')i.push('Lots of analogies: "Think of it like…" regularly.');
else if(sp.analogyUsage==='occasional')i.push('A few analogies for hard concepts.');
if(sp.abbreviations==='heavy')i.push('Heavy abbreviations: w/, b/c, →, ∴, ≈ etc.');
if(sp.writingDensity==='sparse')i.push('Sparse and scannable.');
else if(sp.writingDensity==='dense')i.push('Dense, pack in lots of info.');
return i.join('\n')||'Clear balanced style.';
}
/* RENDER */
function renderNotes(topic,md){
document.getElementById('emptyState').style.display='none';
document.getElementById('notesOut').classList.add('on');
document.getElementById('notesTitle').textContent=topic;
document.getElementById('notesContent').innerHTML=md2html(md);
}
function md2html(md){
let h=md.replace(/^# (.+)$/gm,'<h1>$1</h1>').replace(/^## (.+)$/gm,'<h2>$1</h2>').replace(/^### (.+)$/gm,'<h3>$1</h3>')
.replace(/\*\*(.+?)\*\*/g,'<strong>$1</strong>').replace(/\*(.+?)\*/g,'<em>$1</em>')
.replace(/^> (.+)$/gm,'<blockquote>$1</blockquote>').replace(/`([^`]+)`/g,'<code>$1</code>')
.replace(/^```([\s\S]*?)```$/gm,'<div class="diag">$1</div>')
.replace(/^\- (.+)$/gm,'<li>$1</li>').replace(/^\d+\. (.+)$/gm,'<li>$1</li>')
.replace(/(<li>[\s\S]*?<\/li>\n?)+/g,m=>`<ul>${m}</ul>`)
.replace(/\n\n+/g,'</p><p>').replace(/\n/g,'<br>');
h='<p>'+h+'</p>';
['h1','h2','h3','ul','blockquote'].forEach(t=>{h=h.replace(new RegExp(`<p>(<${t}>)`,'g'),'$1').replace(new RegExp(`(</${t}>)<\/p>`,'g'),'$1');});
h=h.replace(/<p>(<div class="diag">)/g,'$1').replace(/(<\/div>)<\/p>/g,'$1').replace(/<p><\/p>/g,'').replace(/<p><br><\/p>/g,'');
return h;
}
/* RELATED */
function showRelated(topic){
const notes=getNotes();if(!notes.length)return;
const tw=topic.toLowerCase().split(' ');
const rel=notes.filter(n=>{const nw=n.topic.toLowerCase().split(' ');return n.topic!==topic&&tw.some(w=>w.length>3&&nw.some(nw2=>nw2.includes(w)||w.includes(nw2)));}).slice(0,3);
if(!rel.length)return;
document.getElementById('relSec').style.display='block';
document.getElementById('relList').innerHTML=rel.map(n=>`<div class="rc" onclick="openNote(${n.id})"><div class="rc-topic">${n.topic}</div><div class="rc-meta">${n.date}</div><div class="rc-conn">Related to "${topic}" — tap to review</div></div>`).join('');
}
/* LIBRARY */
function saveNote(){
if(!curNoteText||!curTopic){toast('⚠ Generate notes first');return;}
const notes=getNotes();
notes.unshift({id:Date.now(),topic:curTopic,content:curNoteText,date:new Date().toLocaleDateString(),tags:[...curNoteText.matchAll(/^#+\s(.+)$/gm)].map(m=>m[1]).slice(0,3)});
saveNotes(notes);updateBadge();loadSugs();toast('✓ Saved to library!');
}
function renderLib(){
const notes=getNotes();const q=(document.getElementById('libSearch')?.value||'').toLowerCase();
const f=notes.filter(n=>!q||n.topic.toLowerCase().includes(q)||n.content.toLowerCase().includes(q));
const grid=document.getElementById('libGrid');const empty=document.getElementById('libEmpty');
if(!f.length){grid.innerHTML='';empty.style.display='block';return;}
empty.style.display='none';
grid.innerHTML=f.map(n=>`<div class="ncard" onclick="openNote(${n.id})"><button class="del-btn" onclick="delNote(event,${n.id})">✕</button><div class="nc-top">${n.topic}</div><div class="nc-date">${n.date}</div><div class="nc-prev">${n.content.replace(/[#*\`>]/g,'').slice(0,185)}</div><div class="nc-tags">${(n.tags||[]).map(t=>`<span class="nc-tag">${t}</span>`).join('')}</div></div>`).join('');
}
function openNote(id){
const n=getNotes().find(n=>n.id===id);if(!n)return;
document.getElementById('modalContent').innerHTML=`<div style="font-size:9px;opacity:0.38;margin-bottom:4px;font-family:'DM Mono',monospace">${n.date}</div><div class="nc">${md2html(n.content)}</div>`;
document.getElementById('modalBg').classList.add('on');
}
function delNote(e,id){e.stopPropagation();saveNotes(getNotes().filter(n=>n.id!==id));renderLib();updateBadge();toast('Deleted');}
function clearLib(){if(!confirm('Delete all saved notes?'))return;saveNotes([]);renderLib();updateBadge();}
function updateBadge(){const c=getNotes().length;const b=document.getElementById('libBadge');b.style.display=c>0?'inline':'none';b.textContent=c;}
function closeMod(e){if(e.target===document.getElementById('modalBg'))closeModDirect();}
function closeModDirect(){document.getElementById('modalBg').classList.remove('on');}
/* INSIGHTS */
function renderInsights(){
const p=getProf();const notes=getNotes();
const today=new Date().toDateString();const streak=calcStreak(p.studyDates||[]);
document.getElementById('insGrid').innerHTML=`
<div class="icard"><div class="il">Sessions</div><div class="iv">${p.sessions||0}</div><div class="is">note-taking sessions</div></div>
<div class="icard"><div class="il">Topics</div><div class="iv">${(p.topics||[]).length}</div><div class="is">unique topics studied</div></div>
<div class="icard"><div class="il">Saved Notes</div><div class="iv">${notes.length}</div><div class="is">in your library</div></div>
<div class="icard"><div class="il">Streak</div><div class="iv">${streak}d</div><div class="is">${(p.studyDates||[]).includes(today)?'🔥 active today':'study today!'}</div></div>
<div class="icard"><div class="il">Style Fit</div><div class="iv">${p.cumStyle?Math.round((p.cumStyle.confidenceScore||0.5)*100):0}%</div><div class="is">improves with sessions</div></div>
<div class="icard"><div class="il">Style</div><div class="iv" style="font-size:17px;margin-top:5px">${p.cumStyle?.noteStyle?.replace(/-/g,' ')||'—'}</div><div class="is">${p.cumStyle?.dominantTrait||'upload notes to detect'}</div></div>`;
const topics=p.topics||[];const freq={};notes.forEach(n=>{freq[n.topic]=(freq[n.topic]||0)+1;});
document.getElementById('topicNodes').innerHTML=topics.length
?topics.map(t=>{const f=freq[t]||1;const sz=f>=3?'lg':f>=2?'':'sm';return `<div class="tnode ${sz}" onclick="jumpTo('${t}')">${t}<div class="tc">${f>1?f+'x':''}</div></div>`;}).join('')
:'<p style="opacity:0.32;font-size:11px">Save notes to build your topic map</p>';
const sugs=buildSugs(topics,p.cumStyle);const gaps=sugs.filter(s=>s.t==='gap');
document.getElementById('gapsList').innerHTML=gaps.length
?gaps.map(g=>`<div class="gap-item" onclick="jumpTo('${g.topic}')"><span style="font-size:16px">🕳️</span><div><div class="gap-topic">${g.topic}</div><div class="gap-reason">${g.r}</div></div><button class="gap-cta">Study →</button></div>`).join('')
:'<p style="opacity:0.32;font-size:11px">Save more notes for gap analysis</p>';
const hist=p.styleHist||[];
document.getElementById('evoContent').innerHTML=hist.length>1
?hist.map((h,i)=>`<div class="tl-item"><div class="tl-dot"></div><div><div class="tl-sess">Session ${i+1} · ${h.date}</div><div class="tl-ch">${h.snap.noteStyle} · ${h.snap.detailLevel} · ${h.snap.analogyUsage} analogies</div></div></div>`).join('')
:'<p style="opacity:0.32;font-size:11px">More sessions = timeline data</p>';
}
function calcStreak(dates){
if(!dates.length)return 0;const uniq=[...new Set(dates)].sort().reverse();let s=0;const today=new Date();
for(let i=0;i<uniq.length;i++){if(Math.round((today-new Date(uniq[i]))/(864e5))===i)s++;else break;}return s;
}
function jumpTo(t){document.getElementById('topicIn').value=t;showView('generate',document.querySelector('.tab-btn'));document.getElementById('topicIn').focus();}
function updateScore(){const p=getProf();const s=Math.min(100,(p.sessions||0)*15+(p.topics||[]).length*5);document.getElementById('scoreFill').style.width=s+'%';document.getElementById('scoreLabel').textContent=s+'%';}
/* API */
async function callGemini(parts){
const key=getKey();const model=getModel();
const res=await fetch(`https://generativelanguage.googleapis.com/v1beta/models/${model}:generateContent?key=${key}`,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({contents:[{parts}],generationConfig:{maxOutputTokens:4000,temperature:0.75}})});
if(!res.ok){const e=await res.json();throw new Error(e.error?.message||`API error ${res.status}`);}
const d=await res.json();return d.candidates?.[0]?.content?.parts?.[0]?.text||'';
}
/* UI */
function setLoad(on,text,sub,prog){
const ld=document.getElementById('ldDiv');document.getElementById('genBtn').disabled=on;
if(on){ld.classList.add('on');document.getElementById('ldText').textContent=text||'Working…';document.getElementById('ldSub').textContent=sub||'';if(prog!==undefined){document.getElementById('progFill').style.width=prog+'%';setTimeout(()=>{document.getElementById('progFill').style.width=(prog+20)+'%';},700);}}
else{ld.classList.remove('on');document.getElementById('progFill').style.width='100%';setTimeout(()=>{document.getElementById('progFill').style.width='0%';},600);}
}
function smark(n,state){const el=document.getElementById('s'+n);if(!el)return;el.className='step '+state;el.querySelector('.step-dot').textContent=state==='done'?'✓':n;}
function copyNotes(){navigator.clipboard.writeText(document.getElementById('notesContent').innerText).then(()=>toast('Copied ✓'));}
function toast(msg){const t=document.getElementById('toast');t.textContent=msg;t.classList.add('on');setTimeout(()=>t.classList.remove('on'),3000);}
</script>
</body>
</html>