-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.html
More file actions
1612 lines (1517 loc) · 99.8 KB
/
Copy pathdashboard.html
File metadata and controls
1612 lines (1517 loc) · 99.8 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" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Financial Fragility Clock · ISE 2003–2026</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%237132f5'/%3E%3Ccircle cx='16' cy='16' r='11' stroke='white' stroke-width='2' fill='none'/%3E%3Cline x1='16' y1='6' x2='16' y2='16' stroke='white' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='16' y1='16' x2='22' y2='12' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&family=IBM+Plex+Serif:ital,wght@0,400;0,600;1,400&display=swap" rel="stylesheet">
<style>
:root{--bg:#f9f8f6;--surface:#fff;--alt:#f3f2f0;--border:rgba(0,0,0,.07);--bm:rgba(0,0,0,.13);--t:#1a1714;--t2:#5a5450;--t3:#a09894;--pu:#7132f5;--pdk:#5741d8;--ps:rgba(113,50,245,.09);--pd:rgba(113,50,245,.22);--hedge:#149e61;--spec:#d97706;--ponzi:#dc2626;--hs:rgba(20,158,97,.11);--ss:rgba(217,119,6,.11);--ps2:rgba(220,38,38,.11);--cf:#fff;--cn:rgba(0,0,0,.22);--ct:rgba(0,0,0,.1);--sh:0 1px 3px rgba(0,0,0,.05),0 8px 24px rgba(0,0,0,.07);--r:4px;--rl:12px;--fs:'IBM Plex Serif',Georgia,serif;--fn:'IBM Plex Sans',system-ui,sans-serif;--fm:'IBM Plex Mono',monospace}
[data-theme=dark]{--bg:#0c0c10;--surface:#131318;--alt:#1a1a22;--border:rgba(255,255,255,.07);--bm:rgba(255,255,255,.14);--t:#e8eaf0;--t2:#8b92a8;--t3:#3d4357;--ps:rgba(113,50,245,.15);--cf:#0e0e14;--cn:rgba(255,255,255,.2);--ct:rgba(255,255,255,.09);--sh:0 1px 3px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.5)}
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
html{scroll-behavior:smooth}
body{font-family:var(--fn);background:var(--bg);color:var(--t);-webkit-font-smoothing:antialiased;font-variant-numeric:tabular-nums;transition:background .3s,color .3s;padding-bottom:64px}
::-webkit-scrollbar{width:5px}::-webkit-scrollbar-thumb{background:var(--bm);border-radius:3px}
/* NAV */
.nav{position:sticky;top:0;z-index:100;height:52px;display:flex;align-items:center;justify-content:space-between;padding:0 40px;border-bottom:1px solid var(--border);background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(14px)}
.nav-logo{display:flex;align-items:center;gap:9px;text-decoration:none;color:var(--t)}
.nav-logo-icon{width:26px;height:26px;background:var(--pu);border-radius:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.nav-logo-name{font-size:13px;font-weight:600;letter-spacing:-.01em}
.nav-links{display:flex;gap:2px}
.nav-a{font-size:12px;font-weight:500;color:var(--t2);text-decoration:none;padding:5px 10px;border-radius:var(--r);transition:color .15s,background .15s}
.nav-a:hover,.nav-a.active{color:var(--pu);background:var(--ps)}
.nav-right{display:flex;align-items:center;gap:8px}
.rpill{font-family:var(--fm);font-size:10px;padding:3px 9px;border-radius:9999px;letter-spacing:.06em;text-transform:uppercase}
.rpill.hedge{background:var(--hs);color:var(--hedge)}.rpill.spec{background:var(--ss);color:var(--spec)}.rpill.ponzi{background:var(--ps2);color:var(--ponzi)}
.ibtn{width:32px;height:32px;border-radius:var(--r);border:1px solid var(--bm);background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--t2);transition:all .15s}
.ibtn:hover{color:var(--pu);border-color:var(--pd);background:var(--ps)}
a.ibtn{text-decoration:none;font-size:13px;font-weight:500}
/* MODEL TOGGLE — nav pill */
.model-seg{display:inline-flex;background:var(--alt);border-radius:var(--r);padding:3px;gap:1px;border:1px solid var(--border)}
.mseg-btn{font-family:var(--fm);font-size:10px;padding:4px 10px;border-radius:2px;border:none;background:transparent;color:var(--t3);cursor:pointer;transition:all .18s;letter-spacing:.06em;line-height:1.2;white-space:nowrap}
.mseg-btn small{display:block;font-size:8px;opacity:.7;letter-spacing:.04em}
.mseg-btn.on{background:var(--surface);color:var(--pu);box-shadow:var(--sh)}
.mseg-btn.on small{opacity:1}
/* TOGGLE SWITCH (dark mode) */
.toggle-switch{position:relative;display:inline-flex;align-items:center;gap:7px;cursor:pointer;font-family:var(--fm);font-size:10px;color:var(--t3)}
.toggle-track{width:32px;height:18px;border-radius:9px;background:var(--alt);border:1px solid var(--bm);position:relative;transition:background .2s,border-color .2s;flex-shrink:0}
.toggle-track.on{background:var(--pu);border-color:var(--pu)}
.toggle-thumb{position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;transition:left .2s,box-shadow .2s;box-shadow:0 1px 3px rgba(0,0,0,.2)}
.toggle-track.on .toggle-thumb{left:16px}
/* LAYOUT */
.section{max-width:1200px;margin:0 auto;padding:72px 40px}
.fw{border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
.fw .inner{max-width:1200px;margin:0 auto;padding:72px 40px}
.eyebrow{font-family:var(--fm);font-size:10px;font-weight:500;letter-spacing:.16em;text-transform:uppercase;color:var(--pu);margin-bottom:10px}
.sh{font-family:var(--fs);font-size:clamp(26px,3vw,40px);font-weight:400;letter-spacing:-.025em;line-height:1.13;margin-bottom:10px}
.sh em{font-style:italic;color:var(--t2)}
.sub{font-size:14px;color:var(--t2);line-height:1.65;max-width:520px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}
/* HERO */
.hero{min-height:calc(100vh - 52px - 64px);display:grid;grid-template-columns:1fr 1fr;gap:72px;align-items:center}
.hero-clock-wrap{display:flex;flex-direction:column;align-items:center;position:relative}
.clock-glow{position:absolute;inset:-50px;border-radius:50%;pointer-events:none;transition:background .8s}
.clock-svg{width:100%;max-width:380px;height:auto;overflow:visible}
.hero-info{display:flex;flex-direction:column;gap:32px}
.hero-time{font-family:var(--fs);font-size:clamp(28px,3.2vw,48px);font-weight:300;line-height:1.1;letter-spacing:-.025em}
.score-block{display:flex;flex-direction:column;gap:10px}
.score-lbl{font-family:var(--fm);font-size:10px;letter-spacing:.13em;text-transform:uppercase;color:var(--t3)}
.score-num{font-family:var(--fm);font-size:50px;font-weight:500;line-height:1;transition:color .6s}
.score-bar{height:3px;background:var(--bm);border-radius:2px;max-width:250px;overflow:hidden}
.score-bar-fill{height:100%;border-radius:2px;transition:width .8s cubic-bezier(.34,1.56,.64,1),background .6s}
.meta-list{display:flex;flex-direction:column;gap:8px}
.meta-item{display:flex;align-items:baseline;gap:8px;font-size:13px;color:var(--t2)}
.meta-dot{width:5px;height:5px;border-radius:50%;flex-shrink:0;position:relative;top:-1px}
.cta-row{display:flex;gap:10px;flex-wrap:wrap}
.btn-p{font-family:var(--fn);font-size:13px;font-weight:500;padding:9px 18px;background:var(--pu);color:#fff;border:none;border-radius:var(--r);cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:background .15s,transform .1s;text-decoration:none}
.btn-p:hover{background:var(--pdk);transform:translateY(-1px)}
.btn-s{font-family:var(--fn);font-size:13px;font-weight:500;padding:9px 18px;background:transparent;color:var(--t);border:1px solid var(--bm);border-radius:var(--r);cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:border-color .15s,color .15s;text-decoration:none}
.btn-s:hover{border-color:var(--pu);color:var(--pu)}
/* STICKY SCRUBBER */
.sticky-scrub{position:fixed;bottom:0;left:0;right:0;z-index:200;height:64px;background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(18px);border-top:1px solid var(--border);display:flex;align-items:center;padding:0 40px;gap:16px;box-shadow:0 -4px 24px rgba(0,0,0,.06)}
.ss-label{font-family:var(--fm);font-size:9px;letter-spacing:.14em;text-transform:uppercase;color:var(--t3);white-space:nowrap}
.ss-date{font-family:var(--fm);font-size:12px;color:var(--pu);white-space:nowrap;min-width:90px}
input[type=range].slider{flex:1;-webkit-appearance:none;appearance:none;height:2px;background:var(--bm);border-radius:1px;cursor:pointer;outline:none}
input[type=range].slider::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;background:var(--pu);border-radius:50%;border:2.5px solid var(--surface);box-shadow:0 0 0 1.5px var(--pu);cursor:pointer}
.ss-right{display:flex;align-items:center;gap:8px;flex-shrink:0}
.ss-score-badge{font-family:var(--fm);font-size:11px;padding:3px 10px;border-radius:9999px;white-space:nowrap;transition:background .3s,color .3s}
/* SLIDER TUTORIAL HINT */
.slider-hint{position:fixed;bottom:74px;left:50%;transform:translateX(-50%);z-index:201;background:var(--pu);color:#fff;font-family:var(--fm);font-size:11px;letter-spacing:.05em;padding:7px 16px 7px 12px;border-radius:9999px;display:flex;align-items:center;gap:8px;box-shadow:0 4px 20px rgba(113,50,245,.35);pointer-events:none;transition:opacity .4s,transform .4s;white-space:nowrap}
.slider-hint.hide{opacity:0;transform:translateX(-50%) translateY(8px);pointer-events:none}
.slider-hint-arrow{position:absolute;bottom:-6px;left:50%;transform:translateX(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid var(--pu)}
@keyframes hint-pulse{0%,100%{box-shadow:0 4px 20px rgba(113,50,245,.35)}50%{box-shadow:0 4px 28px rgba(113,50,245,.65)}}
.slider-hint{animation:hint-pulse 2s ease-in-out infinite}
.slider-hint.hide{animation:none}
/* STAT STRIP */
.stat-strip{display:grid;grid-template-columns:repeat(4,1fr);border:1px solid var(--border);max-width:1200px;margin:0 auto}
.stat{padding:24px 28px;border-right:1px solid var(--border)}
.stat:last-child{border-right:none}
.stat-lbl{font-family:var(--fm);font-size:9px;letter-spacing:.16em;text-transform:uppercase;color:var(--t3);margin-bottom:8px}
.stat-val{font-family:var(--fm);font-size:28px;font-weight:500;line-height:1;margin-bottom:5px;transition:color .5s}
.stat-note{font-size:11px;color:var(--t3)}
.up{color:var(--hedge)}.dn{color:var(--ponzi)}.pu{color:var(--pu)}
/* CARD */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--rl);box-shadow:var(--sh);overflow:hidden}
.card-head{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid var(--border)}
.card-title{font-size:13px;font-weight:600}
.card-sub{font-size:11px;color:var(--t2);margin-top:2px}
.card-body{padding:20px}
.btn-x{font-family:var(--fm);font-size:10px;padding:4px 10px;background:var(--ps);color:var(--pu);border:1px solid var(--pd);border-radius:var(--r);cursor:pointer;transition:all .15s;white-space:nowrap}
.btn-x:hover{background:var(--pu);color:#fff}
/* TABLES */
.tbl{width:100%;border-collapse:collapse}
.tbl th{font-family:var(--fm);font-size:9px;letter-spacing:.1em;text-transform:uppercase;color:var(--t3);padding:8px 12px;text-align:left;border-bottom:1px solid var(--border)}
.tbl td{font-family:var(--fm);font-size:12px;padding:9px 12px;border-bottom:1px solid var(--border);transition:color .4s}
.tbl tr:last-child td{border-bottom:none}
.tbl td.best{color:var(--pu);font-weight:500}.tbl td.mu{color:var(--t2)}.tbl td.good{color:var(--hedge)}.tbl td.bad{color:var(--ponzi)}
/* SHAP */
.shap-row{display:flex;align-items:center;gap:10px;margin-bottom:11px}
.shap-lbl{font-family:var(--fm);font-size:11px;color:var(--t2);width:120px;text-align:right;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.shap-track{flex:1;height:7px;background:var(--border);border-radius:4px;overflow:hidden}
.shap-fill{height:100%;border-radius:4px;background:var(--pu);transition:width .7s ease}
.shap-num{font-family:var(--fm);font-size:10px;color:var(--t3);width:48px;text-align:right}
/* HEATMAP */
.hmap-cell{border-radius:3px;display:flex;align-items:center;justify-content:center;font-family:var(--fm);font-size:11px;font-weight:500;cursor:default;transition:transform .15s;position:relative}
.hmap-cell:hover{transform:scale(1.1);z-index:2}
/* CRISIS BARS */
.cd-row{display:grid;grid-template-columns:130px 1fr 1fr;gap:16px;align-items:center;margin-bottom:14px}
.cd-name{font-size:12px;font-weight:500;text-align:right;color:var(--t2)}
.cd-date{font-family:var(--fm);font-size:10px;color:var(--t3);display:block;margin-top:2px}
.cd-bar-wrap{position:relative}
.cd-bar-track{height:28px;background:var(--alt);border-radius:4px;overflow:visible;position:relative;border:1px solid var(--border)}
.cd-bar-fill{height:100%;border-radius:4px;display:flex;align-items:center;justify-content:flex-end;padding-right:8px;transition:width .7s cubic-bezier(.34,1.56,.64,1)}
.cd-bar-val{font-family:var(--fm);font-size:11px;font-weight:500;color:#fff;white-space:nowrap}
.cd-thresh{position:absolute;top:-2px;bottom:-2px;width:2px;border-radius:1px;background:var(--ponzi);opacity:.6;pointer-events:none}
.cd-tag{font-family:var(--fm);font-size:10px;padding:2px 7px;border-radius:9999px;margin-left:8px;white-space:nowrap}
.cd-tag.missed{background:var(--ps2);color:var(--ponzi)}.cd-tag.caught{background:var(--hs);color:var(--hedge)}.cd-tag.partial{background:var(--ss);color:var(--spec)}
/* REGIME MATRIX */
.rmat{display:grid;grid-template-columns:auto repeat(3,1fr);gap:4px}
.rmat-cell{padding:12px 8px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-family:var(--fm);font-size:13px;font-weight:500;transition:opacity .4s}
.rmat-lbl{font-family:var(--fm);font-size:10px;color:var(--t3);display:flex;align-items:center;justify-content:flex-end;padding-right:8px;letter-spacing:.05em}
.rmat-head{font-family:var(--fm);font-size:10px;color:var(--t3);display:flex;align-items:center;justify-content:center;letter-spacing:.05em}
/* FEATURE TIMELINE */
.ftl-legend{display:flex;flex-wrap:wrap;gap:12px;margin-bottom:12px}
.ftl-item{display:flex;align-items:center;gap:6px;font-family:var(--fm);font-size:11px;color:var(--t2);cursor:pointer}
.ftl-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}
/* DRAWER */
.drawer{position:fixed;top:52px;right:0;z-index:300;width:360px;height:calc(100vh - 52px - 64px);background:var(--surface);border-left:1px solid var(--border);box-shadow:-12px 0 40px rgba(0,0,0,.1);transform:translateX(100%);transition:transform .35s cubic-bezier(.25,.46,.45,.94);display:flex;flex-direction:column}
.drawer.open{transform:translateX(0)}
.drawer-head{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid var(--border)}
.drawer-title{font-size:13px;font-weight:600}
.dclose{width:28px;height:28px;border:1px solid var(--bm);background:transparent;border-radius:var(--r);cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--t2);font-size:13px}
.drawer-body{padding:22px;overflow-y:auto;flex:1}
.dsect{margin-bottom:20px}
.dsect-title{font-family:var(--fm);font-size:9px;letter-spacing:.14em;text-transform:uppercase;color:var(--pu);margin-bottom:6px}
.dsect-text{font-size:13px;line-height:1.72;color:var(--t2)}
/* TIMELINE CRISIS EVENTS */
.cline{position:relative;padding-left:28px}
.cline::before{content:'';position:absolute;left:5px;top:8px;bottom:0;width:1px;background:var(--bm)}
.cev{position:relative;margin-bottom:32px}
.cev::before{content:'';position:absolute;left:-27px;top:7px;width:9px;height:9px;border-radius:50%;background:var(--ponzi);border:2px solid var(--surface)}
.cev.s::before{background:var(--spec)}.cev.h::before{background:var(--hedge)}
.cev-date{font-family:var(--fm);font-size:10px;letter-spacing:.07em;color:var(--t3);margin-bottom:4px}
.cev-title{font-size:14px;font-weight:600;margin-bottom:5px}
.cev-desc{font-size:13px;color:var(--t2);line-height:1.65}
.cev-badge{display:inline-flex;align-items:center;margin-top:7px;font-family:var(--fm);font-size:10px;padding:2px 8px;border-radius:9999px;background:var(--ps2);color:var(--ponzi)}
.cev-badge.s{background:var(--ss);color:var(--spec)}.cev-badge.h{background:var(--hs);color:var(--hedge)}
/* REPORTS: WF heatmap */
.wf-grid{display:grid;gap:3px}
.wf-cell{border-radius:4px;padding:10px 6px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:var(--fm);font-size:12px;font-weight:500;cursor:default;transition:transform .15s}
.wf-cell:hover{transform:scale(1.04);z-index:2}
.wf-head{font-family:var(--fm);font-size:9px;letter-spacing:.08em;color:var(--t3);text-align:center;padding:6px 4px}
.wf-row-lbl{font-family:var(--fm);font-size:11px;color:var(--t2);display:flex;align-items:center;justify-content:flex-end;padding-right:8px;text-align:right;line-height:1.3}
/* REPORTS: gap timeline */
.gap-legend{display:flex;gap:16px;font-family:var(--fm);font-size:10px;color:var(--t3);margin-top:8px}
.gap-legend span{display:flex;align-items:center;gap:6px}
/* REPORTS: regime dwell */
.dwell-bar{height:36px;border-radius:6px;overflow:hidden;display:flex;margin-bottom:6px}
.dwell-seg{display:flex;align-items:center;justify-content:center;font-family:var(--fm);font-size:10px;font-weight:500;color:#fff;transition:width .6s cubic-bezier(.34,1.56,.64,1);white-space:nowrap;overflow:hidden}
/* REPORTS: algo table */
.algo-badge{display:inline-block;font-family:var(--fm);font-size:9px;padding:2px 7px;border-radius:9999px;letter-spacing:.05em}
/* FOOTER */
footer{border-top:1px solid var(--border);padding:24px 40px;display:flex;align-items:center;justify-content:space-between;max-width:1200px;margin:0 auto;flex-wrap:wrap;gap:12px}
.footer-txt{font-family:var(--fm);font-size:10px;color:var(--t3);line-height:1.7}
/* LOADING */
.loading-overlay{position:fixed;inset:0;background:var(--bg);display:flex;align-items:center;justify-content:center;z-index:999;transition:opacity .4s}
.loading-overlay.hide{opacity:0;pointer-events:none}
.loading-txt{font-family:var(--fm);font-size:12px;color:var(--t3);letter-spacing:.1em;animation:pulse 1.5s ease-in-out infinite}
@keyframes pulse{0%,100%{opacity:.3}50%{opacity:1}}
/* RESPONSIVE */
@media(max-width:1024px){.hero{grid-template-columns:1fr;min-height:auto;gap:48px;padding-top:48px}.hero-info{order:-1}.grid2,.grid3{grid-template-columns:1fr}}
@media(max-width:900px){.nav{padding:0 20px}.nav-links{display:none}.section{padding:56px 20px}.fw .inner{padding:56px 20px}.stat-strip{grid-template-columns:1fr 1fr}.sticky-scrub{padding:0 16px}.cd-row{grid-template-columns:90px 1fr 1fr;gap:10px}}
@media(max-width:640px){
/* existing */
.stat-strip{grid-template-columns:1fr 1fr}.cd-row{grid-template-columns:1fr;gap:4px}.cd-name{text-align:left}.nav-logo-name{display:none}.mseg-btn small{display:none}
/* Nav: hide Present + Report links to stop overflow */
.nav-right a.ibtn{display:none}
/* Drawer: full-width on phone */
.drawer{width:100%;border-left:none;box-shadow:0 -8px 40px rgba(0,0,0,.18)}
/* Chart cards: enable horizontal scroll so labels stay readable */
#timeline .card,#features .card,#models .card,#reports .card{overflow-x:auto !important}
#timeline-svg{min-width:520px;height:200px}
#ftl-svg{min-width:480px;height:180px}
#gap-svg,#dist-svg{min-width:320px;height:160px}
/* Stat strip: tighter */
.stat{padding:16px 14px}.stat-val{font-size:22px}
/* Hero */
.score-num{font-size:36px}
.clock-svg{max-width:260px !important}
/* CTA row: stack buttons */
.cta-row{flex-direction:column}
.cta-row .btn-p,.cta-row .btn-s{justify-content:center;width:100%}
/* Scrubber: drop the Navigate label to save room */
.ss-label{display:none}
/* Slider hint: allow wrap so it doesn't overflow viewport */
.slider-hint{white-space:normal;max-width:calc(100vw - 32px);text-align:center;flex-wrap:wrap;justify-content:center}
/* Footer */
footer{padding:16px 20px}
/* Section padding */
.section{padding:40px 16px}.fw .inner{padding:40px 16px}
}
@media(max-width:400px){
/* Ultra-small: hide regime pill to stop nav crunch */
#nav-pill{display:none}
.stat-val{font-size:18px}.stat{padding:12px 10px}
.mseg-btn{padding:3px 7px}
}
</style>
</head>
<body>
<div class="loading-overlay" id="loading"><div class="loading-txt">LOADING DATA...</div></div>
<!-- NAV -->
<nav class="nav">
<a href="#" class="nav-logo">
<div class="nav-logo-icon"><svg width="13" height="13" viewBox="0 0 14 14" fill="none"><circle cx="7" cy="7" r="5" stroke="white" stroke-width="1.5"/><line x1="7" y1="2.5" x2="7" y2="7" stroke="white" stroke-width="1.5" stroke-linecap="round"/><line x1="7" y1="7" x2="10.2" y2="5.2" stroke="white" stroke-width="1" stroke-linecap="round"/></svg></div>
<span class="nav-logo-name">Financial Fragility Clock</span>
</a>
<div class="nav-links">
<a href="#clock" class="nav-a active">Clock</a>
<a href="#timeline" class="nav-a">Timeline</a>
<a href="#detection" class="nav-a">Crisis Detection</a>
<a href="#models" class="nav-a">Performance</a>
<a href="#features" class="nav-a">Features</a>
<a href="#history" class="nav-a">Archive</a>
<a href="#commercial" class="nav-a">Extensions</a>
</div>
<div class="nav-right">
<span class="rpill spec" id="nav-pill">SPECULATIVE</span>
<!-- Model toggle -->
<div class="model-seg" title="Switch between the two trained models">
<button class="mseg-btn" id="mp-a" onclick="switchModel('model_2009')">A<small>2009–11</small></button>
<button class="mseg-btn on" id="mp-b" onclick="switchModel('model_2003')">B<small>2003–26</small></button>
</div>
<a href="presentation.html" class="ibtn" title="Presentation mode" style="font-size:11px;padding:0 8px;width:auto">▶ Present</a>
<a href="reports.html" class="ibtn" title="Research report" style="font-size:11px;padding:0 8px;width:auto">⬇ Report</a>
<!-- Dark mode toggle -->
<label class="toggle-switch" title="Toggle dark mode" id="theme-toggle">
<div class="toggle-track" id="theme-track"><div class="toggle-thumb"></div></div>
</label>
</div>
</nav>
<!-- HERO -->
<section class="section" id="clock">
<div class="hero">
<div class="hero-clock-wrap">
<div class="clock-glow" id="clock-glow"></div>
<svg class="clock-svg" viewBox="0 0 380 400" id="clock-svg">
<defs>
<radialGradient id="faceGrad" cx="50%" cy="50%" r="50%">
<stop offset="0%" id="grad-stop" stop-color="#d97706" stop-opacity="0.12"/>
<stop offset="100%" stop-color="#d97706" stop-opacity="0"/>
</radialGradient>
</defs>
<g id="regime-arcs"></g>
<circle cx="190" cy="195" r="172" fill="none" stroke="var(--bm)" stroke-width="1"/>
<circle cx="190" cy="195" r="155" fill="url(#faceGrad)"/>
<g id="ticks"></g>
<g id="crisis-pins"></g>
<text x="190" y="14" text-anchor="middle" font-size="9" font-family="IBM Plex Mono,monospace" id="crash-lbl" fill="rgba(220,38,38,0.4)" letter-spacing="0.22em">CRASH</text>
<text x="190" y="382" text-anchor="middle" font-size="9" font-family="IBM Plex Mono,monospace" fill="var(--cn)" letter-spacing="0.22em">SAFE</text>
<circle cx="190" cy="195" r="135" fill="var(--cf)" id="clock-face"/>
<circle cx="190" cy="195" r="135" fill="none" stroke="var(--ct)" stroke-width="1"/>
<text x="190" y="52" text-anchor="middle" dominant-baseline="middle" font-size="12" font-family="IBM Plex Mono,monospace" fill="var(--cn)">12</text>
<text x="333" y="197" text-anchor="middle" dominant-baseline="middle" font-size="12" font-family="IBM Plex Mono,monospace" fill="var(--cn)">3</text>
<text x="190" y="342" text-anchor="middle" dominant-baseline="middle" font-size="12" font-family="IBM Plex Mono,monospace" fill="var(--cn)">6</text>
<text x="47" y="197" text-anchor="middle" dominant-baseline="middle" font-size="12" font-family="IBM Plex Mono,monospace" fill="var(--cn)">9</text>
<text id="face-date" x="190" y="165" text-anchor="middle" font-size="9" font-family="IBM Plex Mono,monospace" fill="var(--cn)" letter-spacing="0.09em">—</text>
<text id="face-score" x="190" y="232" text-anchor="middle" font-size="13" font-family="IBM Plex Mono,monospace" font-weight="500" fill="#d97706" letter-spacing="0.04em">— / 100</text>
<line id="second-hand" x1="190" y1="211" x2="190" y2="100" stroke="rgba(220,38,38,0.35)" stroke-width="1" stroke-linecap="round"/>
<line id="minute-hand" x1="190" y1="211" x2="190" y2="95" stroke="#d97706" stroke-width="2.5" stroke-linecap="round"/>
<line id="hour-hand" x1="190" y1="209" x2="190" y2="128" stroke="#d97706" stroke-width="4.5" stroke-linecap="round"/>
<circle cx="190" cy="195" r="6.5" fill="var(--cf)" stroke="var(--bm)" stroke-width="1.5"/>
<circle cx="190" cy="195" r="3.5" fill="#d97706" id="pivot"/>
</svg>
</div>
<div class="hero-info">
<div>
<p class="eyebrow">Istanbul Stock Exchange · Minsky Fragility Framework</p>
<h1 class="hero-time"><em id="hero-em" style="color:var(--spec)">—</em><br><span id="hero-sfx">to midnight</span></h1>
</div>
<div class="score-block">
<div class="score-lbl">Fragility Score <span id="hero-model-badge" style="font-size:9px;letter-spacing:.06em;color:var(--pu);margin-left:6px">MODEL B</span></div>
<div class="score-num" id="hero-score">—</div>
<div class="score-bar" style="position:relative;overflow:visible"><div class="score-bar-fill" id="score-fill" style="width:0%"></div><div style="position:absolute;left:70%;top:-3px;bottom:-3px;width:1.5px;background:var(--ponzi);border-radius:1px;opacity:0.45" title="Ponzi threshold (70)"></div></div>
</div>
<div class="meta-list">
<div class="meta-item"><div class="meta-dot" style="background:var(--pu)"></div><span>Regime: <strong id="hero-regime">—</strong></span></div>
<div class="meta-item"><div class="meta-dot" id="meta-dot-2" style="background:var(--spec)"></div><span id="hero-driver">Top mean-SHAP driver loading...</span></div>
<div class="meta-item"><div class="meta-dot" style="background:var(--t3)"></div><span id="hero-model-lbl">—</span></div>
</div>
<div id="hero-trajectory" style="padding:10px 14px;background:var(--alt);border:1px solid var(--border);border-radius:var(--r);font-family:var(--fm)">
<div style="font-size:9px;color:var(--t3);letter-spacing:.12em;text-transform:uppercase;margin-bottom:4px">3-Month Trend · Not a Forecast</div>
<div id="trajectory-text" style="font-size:12px;color:var(--t2)">—</div>
</div>
<div class="cta-row">
<button class="btn-p" onclick="openDrawer('clock')"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><circle cx="12" cy="17" r=".5" fill="currentColor"/></svg>How to read this</button>
<a href="#timeline" class="btn-s">Explore timeline ↓</a>
</div>
</div>
</div>
</section>
<!-- STAT STRIP -->
<div class="stat-strip">
<div class="stat"><div class="stat-lbl">Active Score</div><div class="stat-val pu" id="st-score">—</div><div class="stat-note" id="st-score-note">selected model & month</div></div>
<div class="stat"><div class="stat-lbl">Baseline A <span style="font-size:8px;opacity:.7">2009–11</span></div><div class="stat-val" id="st-ma">—</div><div class="stat-note">global indices only</div></div>
<div class="stat"><div class="stat-lbl">Extended B <span style="font-size:8px;opacity:.7">2003–26</span></div><div class="stat-val" id="st-mb">—</div><div class="stat-note">Turkey-aware features</div></div>
<div class="stat"><div class="stat-lbl">Model Gap (B−A)</div><div class="stat-val" id="st-delta">—</div><div class="stat-note" id="st-delta-note">how far apart the models read</div></div>
</div>
<!-- REGIME TIMELINE -->
<section id="timeline" class="fw" style="background:var(--surface)">
<div class="inner">
<div style="display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:32px;flex-wrap:wrap;gap:16px">
<div>
<p class="eyebrow">Regime History</p>
<h2 class="sh">Fragility over time<br><em id="timeline-subtitle">2003 — 2026</em></h2>
</div>
<div style="display:flex;flex-direction:column;align-items:flex-end;gap:10px">
<div style="display:flex;gap:16px;font-family:var(--fm);font-size:10px;letter-spacing:.05em">
<span style="color:var(--hedge)">● Hedge <40</span>
<span style="color:var(--spec)">● Speculative 40–70</span>
<span style="color:var(--ponzi)">● Ponzi ≥70</span>
</div>
<div style="font-family:var(--fm);font-size:9px;color:var(--t3)">Click chart to navigate · dashes = regime thresholds · drag scrubber at bottom</div>
<button class="btn-x" onclick="openDrawer('timeline')">? Plain English</button>
</div>
</div>
<div class="card" style="cursor:crosshair;overflow:hidden">
<svg id="timeline-svg" width="100%" height="260" viewBox="0 0 1120 260" preserveAspectRatio="none" style="display:block;"></svg>
</div>
<p style="font-size:11px;font-family:var(--fm);color:var(--t3);margin-top:10px;letter-spacing:.04em" id="timeline-note">—</p>
</div>
</section>
<!-- CRISIS DETECTION -->
<section id="detection" class="section">
<p class="eyebrow">Model Comparison</p>
<h2 class="sh">Which model flagged<br><em>Turkey's crises?</em></h2>
<p class="sub" style="margin-bottom:32px">Model A is the global-only baseline trained on 2009–2011 data. Model B extends the feature set across a full 23-year window with Turkey-specific indicators. The meaningful question is not just whether either crosses 70 — it's whether Model B sustains a materially stronger signal during domestic stress, especially late 2021.</p>
<div class="card">
<div class="card-head">
<div><div class="card-title">Crisis Episodes — Baseline A vs Extended B</div><div class="card-sub">Score height = stress signal strength. The gap between bars is the key evidence.</div></div>
<button class="btn-x" onclick="openDrawer('detection')">? Explain</button>
</div>
<div class="card-body">
<div style="display:grid;grid-template-columns:130px 1fr 1fr;gap:16px;margin-bottom:8px;padding-bottom:10px;border-bottom:1px solid var(--border)">
<div></div>
<div style="font-family:var(--fm);font-size:9px;letter-spacing:.1em;text-transform:uppercase;color:var(--t3)">Model A · Baseline 2009–11</div>
<div style="font-family:var(--fm);font-size:9px;letter-spacing:.1em;text-transform:uppercase;color:var(--pu)">Model B · Extended 2003–26</div>
</div>
<div id="crisis-detect-chart"></div>
<div style="margin-top:16px;padding:14px 16px;background:var(--ps);border:1px solid var(--pd);border-radius:var(--rl);font-size:13px;color:var(--t2)">
<span style="font-family:var(--fm);font-size:9px;color:var(--pu);letter-spacing:.12em;text-transform:uppercase;display:block;margin-bottom:5px">Key Finding</span>
The clearest contrast is <strong style="color:var(--t)">November 2021</strong>: Model A reads 33.5 while Model B reads 53.0 — a <strong style="color:var(--pu)">+19.4 point gap</strong> during a period of Turkey-specific stress but global calm. 2020 is the threshold-crossing case; 2018 is better read as an early warning divergence than a binary win/loss.
</div>
</div>
</div>
</section>
<!-- MODEL PERFORMANCE -->
<section id="models" class="fw" style="background:var(--surface)">
<div class="inner">
<p class="eyebrow">Model Performance</p>
<h2 class="sh" style="margin-bottom:8px">Walk-forward accuracy<br><em>& feature importance</em></h2>
<p class="sub" style="margin-bottom:32px">Walk-forward scores show where prediction breaks down under structural change. SHAP values here reflect global feature importance across the full dataset — not a claim about what drove any single month.</p>
<div class="grid2" style="margin-bottom:20px">
<div class="card">
<div class="card-head">
<div><div class="card-title">Walk-Forward Performance</div><div class="card-sub" id="perf-sub">Active: Extended 2003–2026</div></div>
<button class="btn-x" onclick="openDrawer('perf')">? Explain</button>
</div>
<div class="card-body" style="padding:0">
<table class="tbl" id="perf-tbl">
<thead><tr><th>Split</th><th>Model</th><th>R²</th><th>RMSE</th><th>Hedge RMSE</th><th>Spec RMSE</th></tr></thead>
<tbody id="perf-body"></tbody>
</table>
</div>
</div>
<div class="card">
<div class="card-head">
<div><div class="card-title">SHAP Feature Importance</div><div class="card-sub" id="shap-sub">Active model · mean |SHAP| across all months</div></div>
<button class="btn-x" onclick="openDrawer('shap')">? Explain</button>
</div>
<div class="card-body" id="shap-body"></div>
</div>
</div>
<div class="grid2">
<div class="card">
<div class="card-head">
<div><div class="card-title">Regime Transition Probabilities</div><div class="card-sub">Empirical month-to-month transition rates (Markov chain)</div></div>
<button class="btn-x" onclick="openDrawer('markov')">? Explain</button>
</div>
<div class="card-body" id="regime-matrix-body"></div>
</div>
<div class="card">
<div class="card-head">
<div><div class="card-title">Score Distribution by Model</div><div class="card-sub">Full 2003–2026 range · where each model spends its time</div></div>
</div>
<div class="card-body" style="padding:0">
<svg id="dist-svg" width="100%" height="200" viewBox="0 0 540 200" preserveAspectRatio="none" style="display:block;"></svg>
</div>
</div>
</div>
</div>
</section>
<!-- FEATURE ANALYSIS -->
<section id="features" class="section">
<p class="eyebrow">Feature Analysis</p>
<h2 class="sh" style="margin-bottom:8px">What Model B sees<br><em>that Model A cannot</em></h2>
<p class="sub" style="margin-bottom:32px">VIX, DXY, Brent and TRY/USD help explain why the extended model stays more elevated during Turkey-specific episodes. The strongest separation between the two models appears in 2021, not just at the 2018 shock peak.</p>
<div class="card" style="margin-bottom:20px">
<div class="card-head">
<div><div class="card-title">Turkey-Specific Features Over Time (Model B only)</div><div class="card-sub">Monthly values, each feature independently scaled · click legend to show/hide</div></div>
<button class="btn-x" onclick="openDrawer('features')">? Explain</button>
</div>
<div class="card-body">
<div class="ftl-legend" id="ftl-legend"></div>
<svg id="ftl-svg" width="100%" height="220" viewBox="0 0 1120 220" preserveAspectRatio="none" style="display:block;"></svg>
</div>
</div>
<div class="card">
<div class="card-head">
<div><div class="card-title">ISE vs Global Indices — Rolling Correlation</div><div class="card-sub" id="hmap-date">60-day Pearson correlation · scrub timeline to update</div></div>
<button class="btn-x" onclick="openDrawer('heatmap')">? Explain</button>
</div>
<div class="card-body" id="hmap-body"></div>
</div>
</section>
<!-- REPORTS (NEW) -->
<section id="reports" class="fw" style="background:var(--surface)">
<div class="inner">
<p class="eyebrow">Reports</p>
<h2 class="sh" style="margin-bottom:8px">Diagnostic deep-dive<br><em>across all algorithms</em></h2>
<p class="sub" style="margin-bottom:36px">A full cross-section of walk-forward R² for every algorithm and crisis period, the month-by-month gap between models, regime dwell-time, and algorithm performance comparison.</p>
<!-- Walk-forward R² heatmap -->
<div class="card" style="margin-bottom:20px">
<div class="card-head">
<div><div class="card-title">Walk-Forward R² — All Algorithms × All Crisis Splits</div><div class="card-sub">Green = strong predictive fit · Red = structural break (R² < 0) · Hover for value</div></div>
<div style="display:flex;gap:6px">
<button class="btn-x" id="wf-btn-a" onclick="setWFModel('model_2009')">Model A</button>
<button class="btn-x" id="wf-btn-b" onclick="setWFModel('model_2003')" style="background:var(--pu);color:#fff;border-color:var(--pu)">Model B</button>
</div>
</div>
<div class="card-body" id="wf-heatmap-body"></div>
</div>
<!-- Gap timeline + regime dwell side by side -->
<div class="grid2" style="margin-bottom:20px">
<div class="card">
<div class="card-head">
<div><div class="card-title">Model B − Model A Score Gap</div><div class="card-sub">Monthly divergence · positive = B reads more fragile</div></div>
<button class="btn-x" onclick="openDrawer('gap')">? Explain</button>
</div>
<div class="card-body" style="padding:0">
<svg id="gap-svg" width="100%" height="200" viewBox="0 0 540 200" preserveAspectRatio="none" style="display:block;"></svg>
</div>
<div class="gap-legend" style="padding:0 16px 14px">
<span><span style="display:inline-block;width:10px;height:2px;background:var(--pu);border-radius:1px"></span> B above A</span>
<span><span style="display:inline-block;width:10px;height:2px;background:var(--ponzi);border-radius:1px"></span> B below A</span>
<span style="color:var(--t3)">Dashes = crisis events</span>
</div>
</div>
<div class="card">
<div class="card-head">
<div><div class="card-title">Time Spent in Each Regime</div><div class="card-sub">% of months in Hedge / Speculative / Ponzi — full coverage period</div></div>
</div>
<div class="card-body" id="dwell-body"></div>
</div>
</div>
<!-- Algorithm comparison table -->
<div class="card">
<div class="card-head">
<div><div class="card-title">Algorithm Comparison — Overall In-Sample Performance</div><div class="card-sub">OLS · Elastic Net · Lasso · Random Forest — both models side by side</div></div>
<button class="btn-x" onclick="openDrawer('algos')">? Explain</button>
</div>
<div class="card-body" style="padding:0">
<table class="tbl" id="algo-tbl">
<thead><tr><th>Algorithm</th><th colspan="3" style="color:var(--t3)">Model A · Baseline</th><th colspan="3" style="color:var(--pu)">Model B · Extended</th></tr>
<tr><th></th><th>R²</th><th>RMSE</th><th>MAE</th><th>R²</th><th>RMSE</th><th>MAE</th></tr></thead>
<tbody id="algo-body"></tbody>
</table>
</div>
</div>
</div>
</section>
<!-- CRISIS ARCHIVE -->
<section id="history" class="section">
<div style="display:grid;grid-template-columns:1fr 1.1fr;gap:72px;align-items:start">
<div>
<p class="eyebrow">Crisis Archive</p>
<h2 class="sh">Key episodes<br><em>& what the models saw</em></h2>
<p class="sub" style="margin-top:16px">Four annotated crisis episodes with real fragility scores from both models. The story is the changing gap between A and B across different crisis mechanisms — not a single headline date.</p>
<div style="margin-top:24px;padding:16px 18px;background:var(--ps);border:1px solid var(--pd);border-radius:var(--rl)">
<div style="font-family:var(--fm);font-size:9px;letter-spacing:.12em;color:var(--pu);margin-bottom:6px;text-transform:uppercase">Academic Framing</div>
<div style="font-size:13px;line-height:1.7;color:var(--t2)">Model A remains useful as the global-contagion baseline. It underreacts when fragility is driven by Turkey-specific conditions. Model B does not "solve" every month — it is more useful because it stays persistently higher when local stress decouples from calm global markets.</div>
</div>
</div>
<div class="cline" id="crisis-archive"></div>
</div>
</section>
<!-- COMMERCIAL EXTENSION -->
<section id="commercial" class="fw" style="background:var(--surface)">
<div class="inner">
<div style="display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:32px;flex-wrap:wrap;gap:16px">
<div>
<p class="eyebrow">EM Risk Intelligence · Commercial Extension</p>
<h2 class="sh">What it becomes<br><em>when handed to a client</em></h2>
<p class="sub">Three interactive prototypes built on the same Minsky pipeline — connecting live Turkey fragility data to portfolio stress-testing, multi-country comparison, and scenario modelling. Illustrative data is clearly tagged.</p>
</div>
<a href="kpmg.html" class="btn-p" style="flex-shrink:0">
Open prototype →
</a>
</div>
<div class="grid3">
<!-- Feature A -->
<div class="card">
<div class="card-head">
<div>
<div class="card-title">Portfolio Stress-Tester</div>
<div class="card-sub">Feature A · real fragility data · illustrative betas</div>
</div>
<span class="rpill hedge">Live</span>
</div>
<div class="card-body" style="font-size:13px;color:var(--t2);line-height:1.65">
Allocate weights across Turkish and global asset classes. Computes portfolio-weighted fragility exposure and simulates estimated drawdown across GFC 2008, 2018 TRY, COVID-19, and Nov 2021 — all weighted by your allocation.
</div>
</div>
<!-- Feature B -->
<div class="card">
<div class="card-head">
<div>
<div class="card-title">EM Country Comparison</div>
<div class="card-sub">Feature B · Turkey live · others illustrative ◦</div>
</div>
<span class="rpill spec">Partial</span>
</div>
<div class="card-body" style="font-size:13px;color:var(--t2);line-height:1.65">
Fragility timelines across Turkey, Brazil, Egypt, South Africa, and Indonesia with a Pearson correlation matrix. Turkey runs on real Model B data. Other countries use VIX-driven illustrative scores — clearly marked in the UI.
</div>
</div>
<!-- Feature C -->
<div class="card">
<div class="card-head">
<div>
<div class="card-title">What-If Scenario Tool</div>
<div class="card-sub">Feature C · Markov chain real · sensitivities illustrative</div>
</div>
<span class="rpill spec">Partial</span>
</div>
<div class="card-body" style="font-size:13px;color:var(--t2);line-height:1.65">
Adjust VIX shock, TRY depreciation, Brent price, and DXY surge. Projects fragility score via empirical transition probabilities from the real regime history, then maps to a Minsky regime and position-sizing signal.
</div>
</div>
</div>
<div style="margin-top:20px;padding:14px 18px;background:var(--alt);border:1px solid var(--border);border-radius:var(--r);font-size:12px;color:var(--t3);display:flex;align-items:center;gap:10px;flex-wrap:wrap">
<span style="font-family:var(--fm);letter-spacing:.06em;font-size:10px;color:var(--pu)">SCOPE NOTE</span>
Not a trading signal, not a real-time system, not a complete product. An academic prototype demonstrating what the methodology looks like when surfaced through a client-facing interface.
</div>
</div>
</section>
<footer>
<div class="footer-txt">Financial Fragility Clock · Group 5 · MSc FinTech · University of Birmingham<br>Minsky (1992) · OLS + Elastic Net + Lasso + Random Forest · ISE 2003–2026 · April 2026</div>
<span class="rpill spec" id="footer-pill">SPECULATIVE REGIME</span>
</footer>
<!-- SLIDER TUTORIAL HINT -->
<div class="slider-hint hide" id="slider-hint">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
Drag to travel through time
<div class="slider-hint-arrow"></div>
</div>
<!-- STICKY SCRUBBER -->
<div class="sticky-scrub">
<span class="ss-label">Navigate</span>
<span class="ss-date" id="scrubber-lbl">—</span>
<input type="range" class="slider" id="scrubber" min="0" max="100" value="100">
<div class="ss-right">
<span class="ss-score-badge spec" id="ss-badge">— / 100</span>
</div>
</div>
<!-- DRAWER -->
<div class="drawer" id="drawer">
<div class="drawer-head"><span class="drawer-title">Plain English</span><button class="dclose" onclick="closeDrawer()">✕</button></div>
<div class="drawer-body" id="drawer-body"></div>
</div>
<script>
// ── TWEAK DEFAULTS ───────────────────────────────────────────────────────────
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"darkMode": false
}/*EDITMODE-END*/;
// ── CONSTANTS ────────────────────────────────────────────────────────────────
const CX=190, CY=195, R_OUT=172;
const REGIME_COLS = {HEDGE:'#149e61', SPECULATIVE:'#d97706', PONZI:'#dc2626'};
// ── STATE ────────────────────────────────────────────────────────────────────
let DATA = null;
let currentModel = 'model_2003';
let currentIdx = 0;
let darkMode = TWEAK_DEFAULTS.darkMode;
let secondAngle = 0;
let hiddenFeatures = new Set();
let wfModel = 'model_2003';
// ── DATA ACCESS ───────────────────────────────────────────────────────────────
const getScores = () => DATA?.models[currentModel]?.monthly_scores || [];
const getScore = i => getScores()[i]?.fragility_score ?? 0;
const getDate = i => getScores()[i]?.date ?? '';
const getShap = () => DATA?.models[currentModel]?.shap_values ?? {};
const getWF = () => DATA?.models[currentModel]?.walk_forward ?? [];
const monthKey = d => (d || '').slice(0,7);
const monthNum = d => {
const [y,m] = monthKey(d).split('-').map(Number);
if (!y || !m) return null;
return y * 12 + (m - 1);
};
function getScoreByDate(model, dateStr) {
const s = DATA?.models[model]?.monthly_scores;
if (!s) return null;
const key = monthKey(dateStr);
const row = s.find(r => monthKey(r.date) === key);
return row ? row.fragility_score : null;
}
function getRowByDate(model, dateStr) {
const s = DATA?.models[model]?.monthly_scores;
if (!s) return null;
const key = monthKey(dateStr);
return s.find(r => monthKey(r.date) === key) || null;
}
// ── HELPERS ───────────────────────────────────────────────────────────────────
const regimeFromScore = s => s>=70?'PONZI':s>=40?'SPECULATIVE':'HEDGE';
const regCol = s => s>=70?'#dc2626':s>=40?'#d97706':'#149e61';
const regLabel = s => s>=70?'Ponzi Finance':s>=40?'Speculative Finance':'Hedge Finance';
const regClass = s => s>=70?'ponzi':s>=40?'spec':'hedge';
const fmtDateLong = d => {
const key = monthKey(d);
if(!key) return '—';
const [y,m] = key.split('-').map(Number);
const dt = new Date(Date.UTC(y, (m || 1) - 1, 1));
return dt.toLocaleDateString('en-US',{year:'numeric',month:'short', timeZone:'UTC'});
};
const prettyFeature = key => ({
VIX_lag1m:'VIX lag 1m', VIX_lag3m:'VIX lag 3m', VIX_lag6m:'VIX lag 6m',
USDTRY_lag1m:'USDTRY lag 1m', USDTRY_lag3m:'USDTRY lag 3m',
usdtry_vol:'USDTRY volatility', rolling_vol:'Rolling volatility',
rf_prediction_error:'RF prediction error', mean_corr:'Mean correlation',
pe_inv:'Inverse entropy', pe:'Perm. entropy', eigenvalue_ratio:'Eigenvalue ratio',
BRENT_lag3m:'Brent lag 3m', DXY_lag1m:'DXY lag 1m', DXY_lag12m:'DXY lag 12m',
}[key] || key);
function polar(cx,cy,r,deg){const rad=(deg-90)*Math.PI/180;return{x:cx+r*Math.cos(rad),y:cy+r*Math.sin(rad)}}
function scoreToTime(s){
if(s>=70){const m=Math.round((s-70)/30*120);return{h:Math.floor(m/60),m:m%60}}
const m2=Math.round((1-s/100)*120),tot=24*60-m2;
return{h:Math.floor(tot/60)%12||12,m:tot%60}
}
function timeToAngle(h,m,isH){return isH?((h%12)+m/60)*30:m*6}
function timeDisplay(s){
if(s>=70){const m=Math.round((s-70)/30*120);return{em:m===0?'Past midnight':`${m} min`,sfx:'past midnight'}}
const mins=Math.round((1-s/100)*120);
if(mins>=60){const hh=Math.floor(mins/60),mm=mins%60;return{em:`${hh}h ${mm}m`,sfx:'to midnight'}}
return{em:`${Math.max(1,mins)} min`,sfx:'to midnight'}
}
// ── LOAD DATA ─────────────────────────────────────────────────────────────────
async function loadData() {
try {
const res = await fetch('./data/fragility_output.json');
if (!res.ok) throw new Error('not found');
DATA = await res.json();
} catch(e) {
try {
const res2 = await fetch('./uploads/fragility_output-31cd57fd.json');
if (!res2.ok) throw new Error('not found');
DATA = await res2.json();
} catch(e2) { DATA = getMockData(); }
}
initAll();
}
function getMockData() {
const scores = [];
for (let i=0; i<277; i++) {
const yr=2003+Math.floor(i/12), mo=(i%12)+1;
const d=`${yr}-${String(mo).padStart(2,'0')}-28`;
const s=30+20*Math.sin(i/12)+10*Math.sin(i/4)+5*(yr>=2018?1:0);
const sc=Math.min(85,Math.max(10,s));
scores.push({date:d,fragility_score:sc,regime:sc>=70?'PONZI':sc>=40?'SPECULATIVE':'HEDGE',
correlations:{sp500:.6,dax:.55,ftse:.5,nikkei:.3,bovespa:.45,eu:.58,em:.65},
features:{vix:15+5*Math.sin(i/6),dxy:95+3*Math.sin(i/8),brent:70+15*Math.sin(i/5),try_usd:0.2-0.001*i}
});
}
return {version:'mock',models:{
model_2009:{meta:{id:'model_2009',label:'2009–2011 Original'},monthly_scores:scores.map(s=>({...s,fragility_score:s.fragility_score*.7+5})),shap_values:{EM:.027,SP500:.019,FTSE:.015,NIKKEI:.011,EU:.010,BOVESPA:.009,DAX:.001},walk_forward:[],performance:{ols:{r2:.04,rmse:.098,mae:.08},elastic_net:{r2:.079,rmse:.096,mae:.076},lasso:{r2:.064,rmse:.097,mae:.077},random_forest:{r2:.008,rmse:.100,mae:.077}}},
model_2003:{meta:{id:'model_2003',label:'2003–2026 Extended'},monthly_scores:scores,shap_values:{EM:.018,BOVESPA:.008,FTSE:.004,VIX_lag1m:.004,SP500:.004,usdtry_vol:.003,EU:.003,DAX:.003,rolling_vol:.002,USDTRY_lag1m:.001},walk_forward:[],performance:{ols:{r2:.094,rmse:.095,mae:.076},elastic_net:{r2:.090,rmse:.095,mae:.075},lasso:{r2:.095,rmse:.095,mae:.075},random_forest:{r2:.137,rmse:.093,mae:.074}}}
}};
}
// ── INIT ──────────────────────────────────────────────────────────────────────
function initAll() {
const len = getScores().length;
const scrub = document.getElementById('scrubber');
scrub.max = len-1;
const apr2020 = getScores().findIndex(s => s.date.startsWith('2020-04'));
const defaultIdx = apr2020 >= 0 ? apr2020 : len-1;
scrub.value = defaultIdx;
currentIdx = defaultIdx;
drawTicks();
drawRegimeArcs();
drawTimeline();
renderCrisisDetection();
renderPerf();
renderShap();
renderRegimeMatrix();
renderDistribution();
renderFeatureTimeline();
renderCrisisArchive();
renderReports();
updateAll(currentIdx);
document.getElementById('loading').classList.add('hide');
setTimeout(()=>document.getElementById('loading').style.display='none', 500);
scrub.addEventListener('input', () => { currentIdx=parseInt(scrub.value); updateAll(currentIdx); dismissSliderHint(); });
applyTheme();
// Show slider tutorial hint after a short delay (only if not previously dismissed)
if (!sessionStorage.getItem('sliderHintDismissed')) {
setTimeout(showSliderHint, 1800);
}
}
function showSliderHint() {
const hint = document.getElementById('slider-hint');
if (!hint) return;
hint.classList.remove('hide');
// Auto-dismiss after 6s if user hasn't touched slider
setTimeout(dismissSliderHint, 6000);
}
function dismissSliderHint() {
const hint = document.getElementById('slider-hint');
if (!hint || hint.classList.contains('hide')) return;
hint.classList.add('hide');
sessionStorage.setItem('sliderHintDismissed', '1');
}
// ── UPDATE ALL ────────────────────────────────────────────────────────────────
function updateAll(idx) {
currentIdx = idx;
const s = getScore(idx);
const d = getDate(idx);
const col = regCol(s);
const rc = regClass(s);
const {em, sfx} = timeDisplay(s);
const dateKey = monthKey(d);
const sa = getScoreByDate('model_2009', dateKey);
const sb = getScoreByDate('model_2003', dateKey);
// Hero
const he = document.getElementById('hero-em');
if(he){he.textContent=em;he.style.color=col;}
document.getElementById('hero-sfx').textContent=sfx;
document.getElementById('hero-score').textContent=s.toFixed(1);
document.getElementById('hero-score').style.color=col;
document.getElementById('score-fill').style.width=`${s}%`;
document.getElementById('score-fill').style.background=col;
document.getElementById('hero-regime').textContent=regLabel(s);
document.getElementById('hero-model-badge').textContent=currentModel==='model_2003'?'MODEL B':'MODEL A';
const ml = currentModel==='model_2003'
? 'Extended features · 23-year training window'
: 'Global-only baseline · 2009–2011 training window';
document.getElementById('hero-model-lbl').textContent=ml;
const shap = getShap();
const top = Object.entries(shap).sort((a,b)=>b[1]-a[1])[0];
if(top){
document.getElementById('hero-driver').innerHTML=`Top SHAP driver: <strong>${prettyFeature(top[0])}</strong>`;
document.getElementById('meta-dot-2').style.background=col;
}
['nav-pill','footer-pill'].forEach(id=>{
const el=document.getElementById(id);if(!el)return;
el.className=`rpill ${rc}`;
el.textContent=regimeFromScore(s)+(id==='footer-pill'?' REGIME':'');
});
// Sticky scrubber
document.getElementById('scrubber-lbl').textContent=fmtDateLong(d);
document.getElementById('scrubber').value=idx;
const badge=document.getElementById('ss-badge');
badge.textContent=`${s.toFixed(1)} / 100`;
badge.className=`ss-score-badge rpill ${rc}`;
// Stat strip
document.getElementById('st-score').textContent=s.toFixed(1);
document.getElementById('st-score').className='stat-val '+rc;
document.getElementById('st-score-note').textContent=`${currentModel==='model_2003'?'Extended B':'Baseline A'} · ${fmtDateLong(d)}`;
if(sa!=null){document.getElementById('st-ma').textContent=sa.toFixed(1);document.getElementById('st-ma').className='stat-val '+regClass(sa);}
else{document.getElementById('st-ma').textContent='—';document.getElementById('st-ma').className='stat-val';}
if(sb!=null){document.getElementById('st-mb').textContent=sb.toFixed(1);document.getElementById('st-mb').className='stat-val '+regClass(sb);}
else{document.getElementById('st-mb').textContent='—';document.getElementById('st-mb').className='stat-val';}
if(sa!=null && sb!=null){
const delta=sb-sa;
document.getElementById('st-delta').textContent=(delta>=0?'+':'')+delta.toFixed(1);
document.getElementById('st-delta').className='stat-val '+(delta>=10?'dn':delta>=3?'pu':'up');
document.getElementById('st-delta-note').textContent=delta>=10?'Strong divergence — B far more elevated':delta>=3?'B consistently reads higher':'Models broadly aligned this month';
} else {
document.getElementById('st-delta').textContent='—';
document.getElementById('st-delta').className='stat-val';
document.getElementById('st-delta-note').textContent='Shared coverage begins Apr 2007';
}
// Clock face
const fd=document.getElementById('face-date');if(fd)fd.textContent=fmtDateLong(d).toUpperCase();
const fs=document.getElementById('face-score');if(fs){fs.textContent=`${s.toFixed(1)} / 100`;fs.setAttribute('fill',col);}
const glow=document.getElementById('clock-glow');if(glow)glow.style.background=`radial-gradient(circle,${col}1a 0%,transparent 68%)`;
document.getElementById('grad-stop')?.setAttribute('stop-color',col);
const cl=document.getElementById('crash-lbl');if(cl)cl.setAttribute('fill',s>75?'rgba(220,38,38,0.8)':'rgba(220,38,38,0.3)');
updateClock(s);
updateTrajectory(idx);
updateHeatmap(idx, d);
updateTimelineLine(idx);
}
// ── TRAJECTORY ───────────────────────────────────────────────────────────────
function updateTrajectory(idx) {
const el = document.getElementById('trajectory-text');
if (!el) return;
const scores = getScores();
if (idx < 3) { el.textContent = 'Not enough history for trend'; el.style.color = 'var(--t3)'; return; }
const s = scores[idx].fragility_score;
if (s >= 70) { el.textContent = 'Ponzi regime — threshold already crossed'; el.style.color = 'var(--ponzi)'; return; }
const window4 = [scores[idx-3], scores[idx-2], scores[idx-1], scores[idx]].map(r => r.fragility_score);
const changes = window4.slice(1).map((v, i) => v - window4[i]);
const slope = changes.reduce((a, b) => a + b, 0) / changes.length;
if (slope <= 0) {
el.textContent = `Score ${slope < -0.5 ? 'declining' : 'stable'} — no threshold crossing projected`;
el.style.color = 'var(--hedge)'; return;
}
const months = Math.ceil((70 - s) / slope);
if (months > 120) { el.textContent = 'No near-term Ponzi crossing at current rate'; el.style.color = 'var(--t3)'; return; }
const urgency = months <= 6 ? 'var(--ponzi)' : months <= 18 ? 'var(--spec)' : 'var(--t3)';
el.textContent = `At this rate: Ponzi threshold in ~${months} month${months === 1 ? '' : 's'}`;
el.style.color = urgency;
}
// ── CLOCK ─────────────────────────────────────────────────────────────────────
function drawTicks(){
const g=document.getElementById('ticks');
for(let i=0;i<60;i++){
const deg=i*6,major=i%5===0;
const p1=polar(CX,CY,R_OUT-(major?13:5),deg);
const p2=polar(CX,CY,R_OUT,deg);
const ln=document.createElementNS('http://www.w3.org/2000/svg','line');
ln.setAttribute('x1',p1.x);ln.setAttribute('y1',p1.y);
ln.setAttribute('x2',p2.x);ln.setAttribute('y2',p2.y);
ln.setAttribute('stroke',major?'var(--cn)':'var(--ct)');
ln.setAttribute('stroke-width',major?'1.5':'0.8');
g.appendChild(ln);
}
}
function drawRegimeArcs(){
const g=document.getElementById('regime-arcs');const R=R_OUT+10;
[{s:220,e:340,col:'#149e61'},{s:340,e:358,col:'#d97706'},{s:0,e:60,col:'#dc2626'}].forEach(a=>{
const path=document.createElementNS('http://www.w3.org/2000/svg','path');
const st=polar(CX,CY,R,a.s),en=polar(CX,CY,R,a.e);
const large=a.e-a.s>180?1:0;
path.setAttribute('d',`M${st.x},${st.y} A${R},${R} 0 ${large},1 ${en.x},${en.y}`);
path.setAttribute('fill','none');path.setAttribute('stroke',a.col);
path.setAttribute('stroke-width','3');path.setAttribute('opacity','0.4');path.setAttribute('stroke-linecap','round');
g.appendChild(path);
});
}
function updateClock(s){
const col=regCol(s);
const{h,m}=scoreToTime(s);
const hA=timeToAngle(h,m,true),mA=timeToAngle(h,m,false);
function hp(angle,rT,rB){return{tip:polar(CX,CY,rT,angle),base:polar(CX,CY,rB,angle+180)}}
const{tip:mT,base:mB}=hp(mA,120,18);
const{tip:hT,base:hB}=hp(hA,84,16);
const{tip:sT,base:sB}=hp(secondAngle,108,18);
function sl(id,p1,p2){const el=document.getElementById(id);if(!el)return;el.setAttribute('x1',p1.x);el.setAttribute('y1',p1.y);el.setAttribute('x2',p2.x);el.setAttribute('y2',p2.y);}
sl('minute-hand',mB,mT);sl('hour-hand',hB,hT);sl('second-hand',sB,sT);
['minute-hand','hour-hand'].forEach(id=>{const el=document.getElementById(id);if(el)el.setAttribute('stroke',col);});
document.getElementById('pivot')?.setAttribute('fill',col);
}
setInterval(()=>{secondAngle=(secondAngle+6)%360;updateClock(getScore(currentIdx));},1000);
// ── TIMELINE ──────────────────────────────────────────────────────────────────
function drawTimeline(){
const svg=document.getElementById('timeline-svg');
const W=1120,H=260,P={t:20,b:32,l:44,r:20};
const cW=W-P.l-P.r,cH=H-P.t-P.b;
const scores=getScores();
if(!scores.length){svg.innerHTML='';return;}
const firstMonth=monthNum(scores[0].date);
const lastMonth=monthNum(scores[scores.length-1].date);
const span=Math.max(1,(lastMonth??0)-(firstMonth??0));
const xForDate=d=>P.l+(((monthNum(d)??firstMonth)-firstMonth)/span)*cW;
const pts=scores.map((s,i)=>({x:xForDate(s.date),y:P.t+cH-(s.fragility_score/100)*cH,s:s.fragility_score,r:regimeFromScore(s.fragility_score),i}));
let html=`<defs><clipPath id="tcc"><rect x="${P.l}" y="${P.t}" width="${cW}" height="${cH}"/></clipPath></defs>`;
[0,40,70,100].forEach(v=>{
const y=P.t+cH-(v/100)*cH;const isDash=v===40||v===70;
html+=`<line x1="${P.l}" y1="${y}" x2="${W-P.r}" y2="${y}" stroke="var(--border)" stroke-width="${isDash?1.5:.7}" stroke-dasharray="${isDash?'6,4':''}"/>`;
html+=`<text x="38" y="${y+4}" text-anchor="end" font-size="9" font-family="IBM Plex Mono,monospace" fill="var(--t3)">${v}</text>`;
});
html+=`<text x="${P.l+6}" y="${P.t+cH-(70/100)*cH-5}" font-size="8" font-family="IBM Plex Mono,monospace" fill="var(--ponzi)" letter-spacing=".08em">PONZI ≥70</text>`;
html+=`<text x="${P.l+6}" y="${P.t+cH-(40/100)*cH-5}" font-size="8" font-family="IBM Plex Mono,monospace" fill="var(--spec)" letter-spacing=".08em">SPEC ≥40</text>`;
const botY=P.t+cH;
let seg=[],lastR=pts[0].r,segs=[];
pts.forEach(p=>{if(p.r!==lastR&&seg.length){segs.push({p:seg,r:lastR});seg=[];}seg.push(p);lastR=p.r;});
if(seg.length)segs.push({p:seg,r:lastR});
segs.forEach(({p:sp,r})=>{
const col=REGIME_COLS[r]||'#888';
let d=`M${sp[0].x},${botY} L${sp[0].x},${sp[0].y}`;
sp.forEach((p,j)=>{if(j)d+=` L${p.x},${p.y}`;});
d+=` L${sp[sp.length-1].x},${botY} Z`;
html+=`<path d="${d}" fill="${col}" fill-opacity=".28" clip-path="url(#tcc)"/>`;
});
let lp=`M${pts[0].x},${pts[0].y}`;
pts.forEach((p,i)=>{if(i)lp+=` L${p.x},${p.y}`;});
html+=`<path d="${lp}" fill="none" stroke="var(--t)" stroke-width="1" stroke-opacity=".25" clip-path="url(#tcc)"/>`;
[{label:'GFC',date:'2008-10',col:'#dc2626'},{label:'TRY',date:'2018-08',col:'#d97706'},{label:'COVID',date:'2020-03',col:'#dc2626'},{label:'Nov 2021',date:'2021-11',col:'#8b5cf6'}].forEach(ev=>{
const mn=monthNum(ev.date);if(mn==null||mn<firstMonth||mn>lastMonth)return;
const x=xForDate(ev.date);
html+=`<line x1="${x}" y1="${P.t}" x2="${x}" y2="${botY}" stroke="${ev.col}" stroke-width="1" stroke-dasharray="3,3" opacity=".5"/>`;
html+=`<text x="${x+4}" y="${P.t+12}" font-size="8" font-family="IBM Plex Mono,monospace" fill="${ev.col}" opacity=".8">${ev.label}</text>`;
});
const firstYear=parseInt(scores[0].date.slice(0,4),10);
const lastYear=parseInt(scores[scores.length-1].date.slice(0,4),10);
for(let yr=firstYear;yr<=lastYear;yr+=3){
const x=xForDate(`${yr}-01`);
html+=`<text x="${x}" y="${H-8}" text-anchor="middle" font-size="9" font-family="IBM Plex Mono,monospace" fill="var(--t3)">${yr}</text>`;
}
html+=`<line id="tl-scrub-line" x1="${P.l}" y1="${P.t}" x2="${P.l}" y2="${botY}" stroke="var(--pu)" stroke-width="1.5" opacity=".7"/>`;
svg.innerHTML=html;
svg.addEventListener('click',function(e){
const rect=svg.getBoundingClientRect();
const xRel=(e.clientX-rect.left)/rect.width*W;
const frac=(xRel-P.l)/cW;
const idx=Math.round(frac*(scores.length-1));