File size: 54,751 Bytes
b9ffb6b
 
 
 
 
 
6a38202
b9ffb6b
 
 
 
6a38202
 
 
 
 
2bb302c
 
 
b9ffb6b
66e787f
6a38202
 
 
 
 
b9ffb6b
2bb302c
 
 
 
 
b9ffb6b
2bb302c
6a38202
2bb302c
6a38202
b9ffb6b
2bb302c
 
 
 
45fe5ce
b9ffb6b
2bb302c
 
6a38202
2bb302c
 
45fe5ce
22f0f50
 
d4901b9
 
 
 
 
22f0f50
2bb302c
 
45fe5ce
 
 
 
6a38202
 
 
2bb302c
 
 
45fe5ce
2bb302c
b9ffb6b
3166640
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2bb302c
 
 
 
45fe5ce
6a38202
 
 
 
 
 
2bb302c
6a38202
2bb302c
b9ffb6b
6a38202
2bb302c
6a38202
 
2bb302c
45fe5ce
b9ffb6b
2bb302c
 
6a38202
2bb302c
 
 
 
 
 
 
 
 
6a38202
2bb302c
6a38202
45fe5ce
2bb302c
 
 
 
 
 
 
45fe5ce
 
2bb302c
 
66e787f
b9ffb6b
2bb302c
 
 
 
 
45fe5ce
2bb302c
 
b9ffb6b
2bb302c
 
45fe5ce
2bb302c
6a38202
2bb302c
45fe5ce
2bb302c
 
 
45fe5ce
 
66e787f
2bb302c
 
 
 
8e3e99d
 
cc9fd51
 
 
2bb302c
 
45fe5ce
2bb302c
 
 
 
 
45fe5ce
6a38202
 
2bb302c
 
66e787f
2bb302c
 
 
45fe5ce
2bb302c
 
45fe5ce
2bb302c
 
45fe5ce
2bb302c
 
 
 
45fe5ce
6a38202
2bb302c
 
 
 
 
45fe5ce
2bb302c
45fe5ce
 
2bb302c
 
 
 
6a38202
66e787f
 
 
b9ffb6b
66e787f
45fe5ce
 
66e787f
6a38202
45fe5ce
66e787f
b9ffb6b
3166640
2bb302c
6a38202
b9ffb6b
6a38202
66e787f
45fe5ce
 
 
2bb302c
cc9fd51
 
 
 
6a38202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3166640
 
 
 
 
6a38202
 
 
 
 
 
 
45fe5ce
b9ffb6b
6a38202
 
 
 
 
 
 
 
 
 
 
 
 
45fe5ce
8e3e99d
 
cc9fd51
27fdab1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8e3e99d
 
27fdab1
8e3e99d
27fdab1
8e3e99d
 
b9ffb6b
66e787f
45fe5ce
 
 
6a38202
 
 
66e787f
45fe5ce
66e787f
6a38202
2bb302c
45fe5ce
 
 
66e787f
 
b9ffb6b
2bb302c
66e787f
6a38202
8e3e99d
 
2bb302c
45fe5ce
 
 
 
6a38202
 
 
45fe5ce
b8a5854
6a38202
 
 
 
 
45fe5ce
66e787f
45fe5ce
3166640
 
 
 
 
 
 
 
 
 
 
 
8e3e99d
 
 
d4901b9
 
6a38202
 
 
 
 
2bb302c
6a38202
45fe5ce
3166640
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a38202
 
45fe5ce
3166640
 
 
6a38202
 
 
 
8e3e99d
 
 
 
d4901b9
 
 
 
 
 
 
c689c36
d4901b9
4149f1b
d4901b9
 
 
 
8e3e99d
 
 
d4901b9
b8a5854
 
 
 
8e3e99d
e199bee
8e3e99d
27fdab1
 
 
 
8e3e99d
e199bee
27fdab1
 
8e3e99d
 
 
 
cc9fd51
 
e199bee
 
8e3e99d
 
 
 
 
 
 
 
 
66e787f
b9ffb6b
66e787f
2bb302c
 
45fe5ce
6a38202
 
 
 
 
45fe5ce
66e787f
b9ffb6b
2bb302c
66e787f
45fe5ce
2bb302c
8e3e99d
 
6a38202
45fe5ce
6a38202
 
 
2bb302c
6a38202
 
 
2bb302c
22f0f50
 
 
6a38202
 
 
66e787f
 
45fe5ce
66e787f
22f0f50
 
cc9fd51
8e3e99d
27fdab1
8e3e99d
66e787f
b9ffb6b
2bb302c
45fe5ce
 
 
6a38202
c6f4734
45fe5ce
6a38202
45fe5ce
cc9fd51
2bb302c
6a38202
 
45fe5ce
2bb302c
45fe5ce
 
c6f4734
66e787f
 
b9ffb6b
66e787f
45fe5ce
 
2bb302c
6a38202
 
45fe5ce
 
2bb302c
cbc9da9
45fe5ce
cc9fd51
2bb302c
 
6a38202
cbc9da9
 
6a38202
45fe5ce
6a38202
 
 
 
 
 
 
66e787f
b9ffb6b
c6f4734
 
ca4a7cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6f4734
 
27fdab1
c6f4734
27fdab1
c6f4734
 
 
 
 
 
 
 
 
ca4a7cd
 
c6f4734
 
 
 
 
 
 
 
 
 
 
 
 
27fdab1
c6f4734
 
 
 
 
 
 
 
 
27fdab1
 
 
 
 
 
 
 
 
 
ce3d03e
 
 
 
 
27fdab1
 
 
 
 
 
 
c6f4734
 
27fdab1
c6f4734
 
 
 
 
 
 
 
27fdab1
c6f4734
 
 
 
27fdab1
 
 
 
c6f4734
 
 
27fdab1
 
 
 
 
c6f4734
 
 
 
27fdab1
 
 
 
c6f4734
 
27fdab1
c6f4734
 
 
 
 
27fdab1
 
 
 
 
ca4a7cd
27fdab1
 
 
 
 
 
ce3d03e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ca4a7cd
ce3d03e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ca4a7cd
ce3d03e
 
 
 
27fdab1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6f4734
 
 
 
ca4a7cd
c6f4734
 
 
 
 
27fdab1
c6f4734
27fdab1
c6f4734
 
 
 
 
 
 
 
 
 
 
 
 
27fdab1
c6f4734
27fdab1
c6f4734
 
 
 
 
 
 
 
 
 
 
66e787f
6a38202
45fe5ce
6a38202
66e787f
6a38202
 
 
 
 
66e787f
6a38202
 
 
 
 
 
27fdab1
 
 
6a38202
 
 
 
 
 
 
 
45fe5ce
 
 
6a38202
66e787f
6a38202
66e787f
b9ffb6b
66e787f
45fe5ce
 
 
6a38202
 
 
45fe5ce
6a38202
45fe5ce
6a38202
 
 
 
50e96ee
6a38202
 
 
45fe5ce
6a38202
 
 
45fe5ce
6a38202
2bb302c
45fe5ce
6a38202
 
2bb302c
6a38202
2bb302c
 
6a38202
2bb302c
45fe5ce
2bb302c
45fe5ce
2bb302c
6a38202
45fe5ce
 
2bb302c
 
 
 
45fe5ce
 
 
 
6a38202
 
2bb302c
 
 
6a38202
 
45fe5ce
66e787f
 
2bb302c
6a38202
b9ffb6b
 
 
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
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>LEADBOARD โ€” ์‹ ์•ฝ ์˜ˆ์ธก ๋„๊ตฌ ์‹œํ—˜๋Œ€</title>
<meta name="description" content="One yardstick, per discipline, for drug prediction tools. Baselines and experimental error published in advance.">
<!-- <head> ๋Š” ์„ ํƒ์ด ์•„๋‹ˆ๋‹ค: ํ”Œ๋žซํผ์ด ์ž๊ธฐ ํƒœ๊ทธ๋ฅผ ๋ฌธ์„œ์— ์ฃผ์ž…ํ•˜๋Š”๋ฐ, ๋ฐ›์„ head ๊ฐ€ ์—†์œผ๋ฉด
     ๊ทธ๊ฒƒ๋“ค์ด doctype ์•ž์— ๋†“์ด๊ณ  ํŽ˜์ด์ง€ ์ „์ฒด๊ฐ€ ์ฟผํฌ ๋ชจ๋“œ๋กœ ๋–จ์–ด์ง„๋‹ค. -->
<style>
  :root{
    --bg:#fbfcfd;--bg2:#f0f3f7;--card:#fff;--ink:#0b0d12;--ink2:#3a4150;
    --muted:#6d7585;--line:#e6e9ef;--line2:#d0d6e0;
    --acc:#1f4fa3;--acc2:#3d7ae0;--soft:#eaf0fb;
    --warn:#8a5c00;--warnbg:#fff6e2;--warnln:#f0d9a0;
    --good:#0f6b43;--goodbg:#e6f6ee;--bad:#9c2f24;--badbg:#fdeceb;
    --m:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
    --sh:0 1px 2px rgba(13,18,30,.05),0 2px 6px rgba(13,18,30,.05);
    --sh2:0 8px 16px -6px rgba(13,18,30,.14),0 20px 36px -12px rgba(13,18,30,.14);
  }
  @media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
    --bg:#090b0f;--bg2:#101319;--card:#141821;--ink:#f1f4f8;--ink2:#c8cfdb;
    --muted:#8b94a5;--line:#212734;--line2:#2e3646;--acc:#8cb0f0;--acc2:#6a95e4;
    --soft:#111a2b;--warn:#e8bd5e;--warnbg:#241d0e;--warnln:#4a3c1a;
    --good:#4fd396;--goodbg:#0c2418;--bad:#f59285;--badbg:#2b1411;
    --sh:0 1px 2px rgba(0,0,0,.4);--sh2:0 12px 32px rgba(0,0,0,.55);}}
  :root[data-theme="dark"]{
    --bg:#090b0f;--bg2:#101319;--card:#141821;--ink:#f1f4f8;--ink2:#c8cfdb;
    --muted:#8b94a5;--line:#212734;--line2:#2e3646;--acc:#8cb0f0;--acc2:#6a95e4;
    --soft:#111a2b;--warn:#e8bd5e;--warnbg:#241d0e;--warnln:#4a3c1a;
    --good:#4fd396;--goodbg:#0c2418;--bad:#f59285;--badbg:#2b1411;
    --sh:0 1px 2px rgba(0,0,0,.4);--sh2:0 12px 32px rgba(0,0,0,.55);}
  *{box-sizing:border-box}
  /* ํžˆ์–ด๋กœ ๋’ค ๊ทธ๋ผ๋””์–ธํŠธ๊ฐ€ ์ขŒ์šฐ๋กœ ์Œ์ˆ˜ inset ์„ ์“ด๋‹ค. z-index ๋ฅผ ๋‚ด๋ ค๋„ ์Šคํฌ๋กค ๋ฒ”์œ„์—๋Š”
     ๋‚จ์•„ ๊ฐ€๋กœ ์Šคํฌ๋กค์ด ์ƒ๊ธด๋‹ค. clip ์€ hidden ๊ณผ ๋‹ฌ๋ฆฌ sticky ํ—ค๋”๋ฅผ ๊นจ๋œจ๋ฆฌ์ง€ ์•Š๋Š”๋‹ค. */
  html{overflow-x:clip}
  body{margin:0;overflow-x:clip;background:var(--bg);color:var(--ink);line-height:1.62;font-size:15px;
    font-family:-apple-system,BlinkMacSystemFont,"Pretendard","Apple SD Gothic Neo",
    "Malgun Gothic",Segoe UI,Roboto,sans-serif;-webkit-font-smoothing:antialiased}
  .wrap{max-width:1060px;margin:0 auto;padding:0 24px}
  a{color:var(--acc);text-decoration:none}a:hover{text-decoration:underline}
  .m,code{font-family:var(--m);font-variant-numeric:tabular-nums}
  .dim{color:var(--muted)}

  nav{position:sticky;top:0;z-index:30;background:color-mix(in srgb,var(--bg) 78%,transparent);
      backdrop-filter:saturate(180%) blur(16px);border-bottom:1px solid var(--line)}
  nav .in{max-width:1060px;margin:0 auto;padding:12px 24px;display:flex;align-items:center;gap:11px}
  .lg{font-weight:850;letter-spacing:-.04em;font-size:18px;color:var(--ink)}
  .lg:hover{text-decoration:none}.lg i{color:var(--acc);font-style:normal}
  .sp{flex:1}
  /* ์ง„์ž… ๋ถ€๋ฌธ ๋ฐฐ์ง€. 46๋ถ€๋ฌธ ์ค‘ ์–ด๋””์„œ ์‹œ์ž‘ํ• ์ง€ ๋ชฐ๋ผ ์•„๋ฌด ๋ฐ๋„ ์‹œ์ž‘ํ•˜์ง€ ๋ชปํ•˜๋Š”
     ๊ฒƒ์„ ๋ง‰์œผ๋ ค๋Š” ํ‘œ์‹œ๋‹ค. */
  .prizebox{background:linear-gradient(135deg,#fffdf7 0%,#fdf4e3 100%);border:1px solid #f0dfba;border-radius:12px;padding:16px 18px}
  .prizebox .amt{font-size:28px;font-weight:900;color:#a97c1a;letter-spacing:-1px}
  .prizebox p{font-size:13.5px;color:#6b5a36;margin:6px 0;line-height:1.7}
  .prizebox .fine{font-size:11.5px;color:#8a7649;border-top:1px solid #f0dfba;padding-top:9px;margin-top:8px}
  .prizebox .cand{font-size:13px;color:#4a3f24;margin-top:8px}
  .chip.st1{background:#e8f5e9;color:#2e7d32;border-color:#c8e6c9}
  .chip{display:inline-flex;align-items:center;font-size:11px;font-family:var(--m);
        padding:3px 9px;border-radius:99px;background:var(--soft);color:var(--acc);font-weight:700}
  .chip.g{background:transparent;border:1px solid var(--line2);color:var(--muted)}
  .chip.ok{background:var(--goodbg);color:var(--good)}
  .chip.wr{background:var(--warnbg);color:var(--warn)}
  .chip.bd{background:var(--badbg);color:var(--bad)}
  .lang{padding:5px 11px;border-radius:8px;border:1px solid var(--line2);background:var(--card);
        color:var(--ink2);font-size:12px;font-weight:650;cursor:pointer;font-family:inherit}
  .lang:hover{border-color:var(--acc);color:var(--acc)}
  .btn{display:inline-flex;align-items:center;gap:8px;padding:10px 19px;border-radius:11px;
       background:linear-gradient(180deg,var(--acc2),var(--acc));color:#fff;font-size:14px;
       font-weight:650;border:0;cursor:pointer;box-shadow:var(--sh);transition:transform .1s,filter .15s}
  .btn:hover{filter:brightness(1.08);text-decoration:none}
  .btn:active{transform:translateY(1px)}.btn:disabled{opacity:.45;cursor:default}

  /* ์ž๋งค ์‹œํ—˜๋Œ€ ๋  โ€” ODC/OMC ๋กœ ๊ฑด๋„ˆ๊ฐ€๋Š” ์ž๋ฆฌ. ์‚ฌ์ดํŠธ๊ฐ€ ํ˜ผ์ž ์„œ ์žˆ์ง€ ์•Š๋‹ค๋Š” ํ‘œ์‹œ์ด๊ธฐ๋„ ํ•˜๋‹ค */
  .sib{border-bottom:1px solid var(--line);background:var(--bg2)}
  .sib .in{max-width:1060px;margin:0 auto;padding:10px 24px;display:flex;gap:10px;
           align-items:center;flex-wrap:wrap;font-size:12.5px}
  .sib .lb{color:var(--muted);letter-spacing:.06em;text-transform:uppercase;font-size:10.5px;font-weight:700}
  .sib a{display:inline-flex;align-items:center;gap:7px;padding:5px 12px;border-radius:99px;
         border:1px solid var(--line2);background:var(--card);color:var(--ink2);font-weight:600}
  .sib a:hover{border-color:var(--acc);color:var(--acc);text-decoration:none}
  .sib a span{color:var(--muted);font-weight:400}

  /* ๋ฐœ๊ฒฌ ์นด๋“œ โ€” ์„œ์‚ฌ๊ฐ€ ์•„๋‹ˆ๋ผ ์ˆ˜์น˜๊ฐ€ ์ฃผ์ธ๊ณต์ด ๋˜๊ฒŒ ํ•œ๋‹ค */
  .finds{display:grid;grid-template-columns:repeat(auto-fit,minmax(288px,1fr));gap:15px}
  .find{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:21px;
        box-shadow:var(--sh);border-top:3px solid var(--acc)}
  .find b{display:block;font-size:16.5px;font-weight:750;letter-spacing:-.02em;margin-bottom:8px;line-height:1.4}
  .find p{font-size:13.5px;color:var(--muted);line-height:1.62;margin:0}

  .prose{font-size:15.5px;color:var(--ink2);line-height:1.78;max-width:44em}
  .prose p{margin:0 0 16px}
  .cite{font-size:12.5px;color:var(--muted);font-style:italic;border-left:2px solid var(--line2);
        padding-left:13px;margin:6px 0 0}

  /* ์ง€ํ‘œ ์ •์˜ */
  .defs{display:grid;grid-template-columns:auto 1fr;gap:0;border:1px solid var(--line);
        border-radius:16px;overflow:hidden;background:var(--card);box-shadow:var(--sh)}
  .defs dt{padding:14px 18px;font-family:var(--m);font-size:13px;font-weight:750;color:var(--acc);
           border-top:1px solid var(--line);white-space:nowrap}
  .defs dd{padding:14px 18px 14px 0;margin:0;font-size:13.5px;color:var(--ink2);
           border-top:1px solid var(--line);line-height:1.6}
  .defs dt:first-of-type,.defs dd:first-of-type{border-top:0}

  .hero{padding:78px 0 46px;position:relative}
  .hero::before{content:"";position:absolute;inset:-70% -30% auto -30%;height:520px;z-index:-1;
    background:radial-gradient(ellipse 55% 50% at 32% 55%,color-mix(in srgb,var(--acc) 16%,transparent),transparent 70%)}
  .brand{font-size:clamp(46px,9vw,80px);font-weight:900;letter-spacing:-.05em;margin:0;line-height:.96}
  .brand i{color:var(--acc);font-style:normal}
  .subttl{font-size:12.5px;color:var(--muted);margin:9px 0 0;letter-spacing:.11em;text-transform:uppercase}
  .tag{font-size:clamp(23px,3.9vw,34px);font-weight:750;margin:30px 0 14px;
       letter-spacing:-.03em;line-height:1.32;max-width:17em}
  .lede{font-size:16.5px;color:var(--ink2);margin:0;max-width:38em;line-height:1.72}
  .stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(128px,1fr));gap:1px;
    margin:44px 0 0;background:var(--line);border:1px solid var(--line);border-radius:14px;overflow:hidden}
  .stat{background:var(--card);padding:17px 19px}
  .stat b{display:block;font-size:30px;font-weight:850;font-family:var(--m);letter-spacing:-.045em;line-height:1.1}
  .stat span{font-size:11.5px;color:var(--muted)}

  .sec{margin:76px 0 0}
  .sec h2{font-size:11.5px;font-weight:750;letter-spacing:.17em;text-transform:uppercase;
     color:var(--acc);margin:0 0 8px}
  .sec .lead2{font-size:15.5px;color:var(--ink2);margin:0 0 22px;max-width:46em}
  h3{font-size:18.5px;font-weight:720;margin:30px 0 9px;letter-spacing:-.018em}
  p{margin:0 0 15px}

  .terr{background:var(--card);border:1px solid var(--line);border-radius:16px;
        padding:22px 24px 18px;box-shadow:var(--sh)}
  .trow{display:grid;grid-template-columns:104px 1fr 60px;align-items:center;gap:12px;padding:4px 0;font-size:13px}
  .trow .nm{font-weight:650;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .trow .nm a{color:var(--ink)}
  .trk{position:relative;height:19px;background:var(--bg2);border-radius:5px;overflow:hidden}
  .trk .fill{position:absolute;left:0;top:0;bottom:0;border-radius:5px;
             background:linear-gradient(90deg,var(--acc2),var(--acc));opacity:.85}
  .trk .fill.in{background:linear-gradient(90deg,#e0a83c,#c98d1d)}
  .trk .one{position:absolute;top:-3px;bottom:-3px;width:2px;background:var(--ink);opacity:.42}
  .trow .v{font-family:var(--m);font-size:12px;color:var(--muted);text-align:right}
  .trow .v.in{color:var(--warn);font-weight:700}
  .taxis{display:grid;grid-template-columns:104px 1fr 60px;gap:12px;margin-top:11px;
         font-size:11px;color:var(--muted);font-family:var(--m)}
  .taxis .lbl{display:flex;justify-content:space-between;gap:8px}

  .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(252px,1fr));gap:15px}
  .cc{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:20px;
      display:block;box-shadow:var(--sh);transition:box-shadow .2s,transform .13s,border-color .2s}
  a.cc:hover{box-shadow:var(--sh2);transform:translateY(-3px);border-color:var(--line2);text-decoration:none}
  .cc.off{opacity:.5}
  .cc .ico{font-size:25px;line-height:1}
  .cc .nm{font-weight:720;font-size:17px;margin:11px 0 4px;color:var(--ink);
          display:flex;align-items:center;gap:8px;flex-wrap:wrap}
  .cc .ds{font-size:13px;color:var(--muted);line-height:1.55;min-height:40px}
  .cc .mt{margin-top:14px;padding-top:12px;border-top:1px solid var(--line);
          font-family:var(--m);font-size:11.5px;color:var(--muted);
          display:flex;justify-content:space-between;gap:8px}

  .crumb{font-size:13px;color:var(--muted);margin:30px 0 12px}
  .ttl{font-size:clamp(30px,5vw,42px);font-weight:850;letter-spacing:-.035em;margin:0 0 6px;
       display:flex;align-items:center;gap:12px;flex-wrap:wrap}
  .pills{display:flex;gap:7px;flex-wrap:wrap;margin:24px 0 4px}
  .pilltab{padding:9px 17px;border-radius:11px;font-size:13.5px;font-weight:650;
           color:var(--muted);border:1px solid var(--line);background:var(--card)}
  .pilltab:hover{text-decoration:none;color:var(--ink2);border-color:var(--line2)}
  .pilltab.on{background:var(--ink);color:var(--bg);border-color:var(--ink)}

  .tw{overflow-x:auto;border:1px solid var(--line);border-radius:16px;background:var(--card);
      box-shadow:var(--sh);margin:18px 0}
  table{width:100%;border-collapse:collapse;font-size:13.5px}
  th{text-align:right;font-weight:650;color:var(--muted);font-size:10.5px;letter-spacing:.08em;
     text-transform:uppercase;padding:13px;border-bottom:1px solid var(--line);white-space:nowrap}
  th:first-child,td:first-child{text-align:center;width:48px}
  th:nth-child(2),td:nth-child(2),th:nth-child(3),td:nth-child(3){text-align:left}
  td{padding:13px;border-bottom:1px solid var(--line);text-align:right;
     font-family:var(--m);font-variant-numeric:tabular-nums;white-space:nowrap}
  td:nth-child(2){font-family:inherit;font-weight:680}
  tbody tr:last-child td{border-bottom:0}
  tbody tr:hover td{background:var(--bg2)}
  tr.base td{color:var(--muted)}
  .rk{display:inline-flex;width:25px;height:25px;align-items:center;justify-content:center;
      border-radius:8px;background:var(--bg2);font-size:12px;font-weight:750}
  .rk.g1{background:#f0c44a26;color:#9c7710}.rk.g2{background:#aab4c426;color:#77828f}
  .rk.g3{background:#c9885526;color:#95612f}
  .gain{color:var(--good);font-weight:700}
  .loss{color:var(--bad);font-weight:700}
  .sub2{font-size:11.5px;color:var(--muted);font-family:inherit;font-weight:400;margin-top:3px}
  .cc .bl{font-size:12.5px;color:var(--acc);font-weight:600;margin:-1px 0 6px}
  .blurbig{font-size:17px;color:var(--ink2);font-weight:600;margin:2px 0 8px}
  .mini{display:inline-block;height:6px;border-radius:3px;background:var(--acc);opacity:.5;
        vertical-align:middle;margin-right:7px}

  .fig{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:19px 21px;
       margin:16px 0;font-family:var(--m);font-size:13px;line-height:1.95;overflow-x:auto;box-shadow:var(--sh)}
  .fig .n{color:var(--acc);font-weight:750}
  .note{background:var(--warnbg);border:1px solid var(--warnln);border-radius:13px;
        padding:15px 18px;font-size:14.5px;margin:18px 0;color:var(--ink2);line-height:1.65}
  .note.ok{background:var(--goodbg);border-color:color-mix(in srgb,var(--good) 30%,transparent)}
  .note.n{background:var(--card);border-color:var(--line)}
  .kv{display:grid;grid-template-columns:190px 1fr;gap:10px 18px;font-size:14px;margin:15px 0}
  .kv dt{color:var(--muted)}.kv dd{margin:0;font-family:var(--m);font-size:13px;word-break:break-word}
  label{display:block;font-size:13.5px;font-weight:680;margin:17px 0 6px}
  .hint{font-size:12px;color:var(--muted);font-weight:400}
  input[type=text],textarea{width:100%;padding:12px 14px;border:1px solid var(--line2);
    border-radius:11px;background:var(--card);color:var(--ink);font-family:var(--m);font-size:13px}
  input:focus,textarea:focus{outline:2px solid color-mix(in srgb,var(--acc) 45%,transparent);
    outline-offset:-1px;border-color:var(--acc)}
  .drop{border:2px dashed var(--line2);border-radius:13px;padding:30px;text-align:center;
        color:var(--muted);font-size:14px;cursor:pointer;transition:.15s}
  .drop:hover,.drop.hot{border-color:var(--acc);background:var(--soft);color:var(--acc)}
  .steps{counter-reset:s;list-style:none;padding:0;margin:18px 0}
  .steps li{counter-increment:s;position:relative;padding:0 0 26px 46px;border-left:2px solid var(--line);margin-left:15px}
  .steps li:last-child{border-left-color:transparent;padding-bottom:0}
  .steps li::before{content:counter(s);position:absolute;left:-16px;top:-3px;width:30px;height:30px;
    border-radius:50%;background:var(--soft);color:var(--acc);font-weight:750;font-size:13px;
    display:flex;align-items:center;justify-content:center;font-family:var(--m);border:3px solid var(--bg)}
  .steps b{display:block;font-size:16px;margin-bottom:4px}
  ol.cl{list-style:none;counter-reset:c;padding:0;margin:18px 0;
        display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));gap:0}
  ol.cl li{counter-increment:c;position:relative;padding:16px 16px 16px 52px;border-top:1px solid var(--line)}
  ol.cl li::before{content:counter(c);position:absolute;left:8px;top:16px;width:30px;height:30px;
    border-radius:9px;background:var(--soft);color:var(--acc);font-weight:750;font-size:13px;
    display:flex;align-items:center;justify-content:center;font-family:var(--m)}
  ol.cl b{display:block;font-size:15px;margin-bottom:3px}
  ol.cl span{font-size:13px;color:var(--muted);line-height:1.5}
  .skel{height:150px;border-radius:16px;background:linear-gradient(90deg,var(--bg2),var(--card),var(--bg2));
        background-size:200% 100%;animation:sh 1.3s infinite}
  @keyframes sh{0%{background-position:200% 0}100%{background-position:-200% 0}}
  footer{margin-top:88px;padding:28px 0 64px;border-top:1px solid var(--line);
    font-size:13px;color:var(--muted);display:flex;gap:20px;flex-wrap:wrap;align-items:center}
  @media(max-width:640px){
    .kv{grid-template-columns:1fr}.kv dt{margin-top:8px}
    .trow,.taxis{grid-template-columns:78px 1fr 48px;gap:8px;font-size:12px}}
</style>
</head>
<body>

<nav><div class="in">
  <a class="lg" href="#/">LEAD<i>BOARD</i></a>
  <span class="chip g" id="spec">v1.1</span>
  <span class="sp"></span>
  <button class="lang" id="lang"></button>
  <span id="who" style="font-size:13px;color:var(--muted)"></span>
</div></nav>

<div class="sib"><div class="in" id="sibbar"></div></div>
<div id="app"><div class="wrap"><div class="skel" style="margin-top:70px"></div></div></div>
<footer class="wrap" id="foot"></footer>

<script src="i18n.js"></script>
<script>
const $=s=>document.querySelector(s), app=$("#app");
const f=(x,d=3)=>(x==null||isNaN(x))?"โ€”":Number(x).toFixed(d);
const esc=s=>String(s??"").replace(/[&<>"]/g,c=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[c]));
const W=h=>`<div class="wrap">${h}</div>`;
/* ์ œ์ถœ์ž๋Š” ํ—ˆ๊น…ํŽ˜์ด์Šค ๊ณ„์ •์ด๋‹ค. ์ด๋ฆ„๋งŒ ์ ์œผ๋ฉด ๋ˆ„๊ตฌ์ธ์ง€ ํ™•์ธํ•  ๊ธธ์ด ์—†๋‹ค. */
const hfUser=u=>u&&u!=="โ€”"
  ?`<a href="https://huggingface.co/${encodeURIComponent(u)}" target="_blank" rel="noopener">${esc(u)}</a>`
  :"โ€”";
let CATS=null, ME={user:null}, BOARDS={}, L=null, t=null;

/* ์–ธ์–ด ๊ฒฐ์ • ์ˆœ์„œ: ์ €์žฅ๋œ ์„ ํƒ โ†’ ๋ธŒ๋ผ์šฐ์ € ์„ค์ • โ†’ ์˜์–ด.
   ๋ธŒ๋ผ์šฐ์ €๋ฅผ ๋จผ์ € ๋ณด๋ฉด ํ•œ ๋ฒˆ ๊ณ ๋ฅธ ์„ ํƒ์ด ์ƒˆ๋กœ๊ณ ์นจ๋งˆ๋‹ค ๋’ค์ง‘ํžŒ๋‹ค. */
function pickLang(){
  const saved=localStorage.getItem("lb-lang");
  if(saved && window.T[saved]) return saved;
  return (navigator.language||"").toLowerCase().startsWith("ko") ? "ko" : "en";
}
function setLang(l){
  L=l; t=window.T[l];
  localStorage.setItem("lb-lang", l);
  document.documentElement.lang=t.htmlLang;
  document.title=t.title;
  $("#lang").textContent=t.langBtn;
  paintChrome();
  route();
}
function paintChrome(){
  $("#who").innerHTML=ME.user?`${esc(ME.user.user)} ยท <a href="/logout">${t.logout}</a>`
    :(ME.login_enabled?`<a href="/login?next=${encodeURIComponent(location.hash||"#/")}">${t.login}</a>`:"");
  $("#sibbar").innerHTML=`<span class="lb">${t.sib}</span>
    <a href="https://huggingface.co/spaces/FINAL-Bench/open-discovery-challenge">
      ๐Ÿงช Open Discovery Challenge <span>${t.sibOdc}</span></a>
    <a href="https://huggingface.co/spaces/FINAL-Bench/open-materials-challenge">
      ๐Ÿ”‹ Open Materials Challenge <span>${t.sibOmc}</span></a>`;
  $("#foot").innerHTML=`<span>LEADBOARD ยท FINAL-Bench / VIDRAFT</span>
    <span class="dim">${t.srcLabel} <a href="https://www.ebi.ac.uk/chembl/">ChEMBL</a> ยท
      <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA 3.0</a></span>
    <span class="sp"></span><a href="/api/health">API</a>
    <a href="https://huggingface.co/spaces/FINAL-Bench/open-discovery-challenge">ODC</a>
    <a href="https://huggingface.co/spaces/FINAL-Bench/open-materials-challenge">OMC</a>`;
}
async function j(u,o){const r=await fetch(u,o);if(!r.ok)throw new Error(await r.text());return r.json();}

/* โ•โ•โ• ์ธก์ • ํ•œ๊ณ„ ์ง€ํ˜• โ•โ•โ• */
function terrain(items,link){
  const MAX=3.0, pc=v=>Math.min(100,100*v/MAX);
  return `<div class="terr">${items.map(b=>{
    const inside=b.ratio<1.0;
    const nm=link?`<a href="#/b/${encodeURIComponent(b.board)}">${esc(b.board)}</a>`:esc(b.board);
    return `<div class="trow"><div class="nm">${nm}</div>
      <div class="trk"><div class="fill ${inside?"in":""}" style="width:${pc(b.ratio)}%"></div>
        <div class="one" style="left:${pc(1)}%"></div></div>
      <div class="v ${inside?"in":""}">${f(b.ratio,2)}ร—</div></div>`;}).join("")}
    <div class="taxis"><span></span><span class="lbl">
      <i>0</i><i>โ† ${t.terrLeft} ยท 1.0 ยท ${t.terrRight} โ†’</i><i>${MAX.toFixed(1)}</i>
    </span><span></span></div></div>`;
}
/* ๋ถ„๋ฅ˜ ์ „์šฉ ๋ถ€๋ฌธ์€ MAE ๊ธฐ์ค€์„ ์ด ์—†๋‹ค. ๊ทธ๋Ÿฐ ๋ถ€๋ฌธ์„ 0 ์œผ๋กœ ์ฒ˜๋ฆฌํ•˜๋ฉด ์ง€ํ˜•๋„ ๋งจ ์™ผ์ชฝ์—
   ๋ถ™์–ด "์ธก์ • ํ•œ๊ณ„์— ๋„๋‹ฌํ–ˆ๋‹ค"๋กœ ๋ณด์ธ๋‹ค. ์žฌ์ง€ ๋ชปํ•œ ๊ฒƒ๊ณผ ์žฌ์„œ ์ž‘์€ ๊ฒƒ์€ ๋‹ค๋ฅด๋ฏ€๋กœ ๋น„์šด๋‹ค. */
const blurb=b=>esc(L==="ko"?(b.blurb||""):(b.blurb_en||b.blurb||""));
/* ๋ถ€๋ฌธ๋งˆ๋‹ค ์ฃผ์ง€ํ‘œ๊ฐ€ ๋‹ค๋ฅด๋‹ค. ํŒ์ •์„ ํ•œ ๊ณณ์—๋งŒ ๋‘”๋‹ค.
   ํ™”๋ฉด์ด MAE ๋งŒ ์•Œ๊ณ  ์žˆ์–ด์„œ, ํ”„๋กœํŒŒ์ผ ์ƒ๊ด€์œผ๋กœ ์ฑ„์ ๋˜๋Š” Phenotype ์ด "ํ•™์Šต ๊ธฐ์ค€์„ ์ด
   ์ƒ์ˆ˜ ์˜ˆ์ธก์„ 0.003 ์ฐจ์ด๋กœ ๊ฐ„์‹ ํžˆ ์ด๊ธด๋‹ค"๋กœ ๋ณด์˜€๋‹ค. ์‹ค์ œ ์ง€ํ‘œ๋กœ๋Š” 0.092 ๋Œ€ 0.159 ๋กœ
   ์žก์Œ ๋ฐ”๋‹ฅ์˜ 7.6๋ฐฐ ์ฐจ์ด๋‹ค. ์ง€ํ‘œ๋ฅผ ์ž˜๋ชป ๋„์šฐ๋ฉด ๋ถ€๋ฌธ์ด ๊ณ ์žฅ ๋‚œ ๊ฒƒ์ฒ˜๋Ÿผ ์ฝํžŒ๋‹ค. */
const metricOf=b=>{
  if((b||{}).metric==="profile_corr") return {key:"profile_corr",hb:true,label:"ํ”„๋กœํŒŒ์ผ ์ƒ๊ด€"};
  const bl=Object.values((b||{}).baselines||{});
  if(bl.length&&bl.every(v=>v.mae==null)&&bl.some(v=>v.auroc!=null))
    return {key:"auroc",hb:true,label:"AUROC"};
  return {key:"mae",hb:false,label:"MAE"};
};
const metricLabel=b=>{const m=metricOf(b);
  return L==="ko"?(m.label+" ("+(m.hb?"๋†’์„์ˆ˜๋ก":"๋‚ฎ์„์ˆ˜๋ก")+" ์ข‹์Œ)")
                 :(m.label+" ("+(m.hb?"higher":"lower")+" is better)");};
const blScore=(b,v)=>v?v[metricOf(b).key]:null;
/* ์ธก์ • ํ•œ๊ณ„๋น„๋Š” ์˜ค์ฐจ ์ง€ํ‘œ ์œ„์—์„œ๋งŒ ๋œป์ด ์žˆ๋‹ค. ์ƒ๊ด€ ๋ถ€๋ฌธ์—์„œ MAE ๋กœ ๊ณ„์‚ฐํ•˜๋ฉด
   3.40/0.0088 = 385 ๊ฐ™์€ ๋ฌด์˜๋ฏธํ•œ ์ˆ˜๊ฐ€ ๋‚˜์˜จ๋‹ค. ์žฌ์ง€ ๋ชปํ•œ ๊ฒƒ์€ ๋น„์šด๋‹ค. */
const ratioOf=b=>{
  const nf=(b.noise_floor||{}).sd_single;
  if(metricOf(b).key!=="mae"||!nf) return null;
  const maes=Object.values(b.baselines||{}).map(v=>v.mae).filter(v=>v!=null);
  if(!maes.length) return null;
  return Math.min(...maes)/nf;
};

async function boot(){
  try{ME=await j("/api/me");}catch(e){}
  CATS=await j("/api/categories");
  CATS.categories.forEach(c=>(c.board_cards||[]).forEach(b=>BOARDS[b.board]=b));
  $("#spec").textContent=CATS.spec;
  $("#lang").onclick=()=>setLang(L==="ko"?"en":"ko");
  setLang(pickLang());
}
addEventListener("hashchange",route);
function route(){
  if(!t)return;
  const p=(location.hash||"#/").slice(2).split("/").filter(Boolean);scrollTo(0,0);
  if(!p.length)return hub();
  if(p[0]==="c")return category(p[1]);
  if(p[0]==="b")return board(decodeURIComponent(p[1]),p[2]||"rank");
  hub();
}

/* โ•โ•โ• ํ—ˆ๋ธŒ โ•โ•โ• */
function hub(){
  const T0=CATS.totals, bs=Object.values(BOARDS);
  const items=bs.map(b=>({board:b.board,ratio:ratioOf(b)}))
    .filter(x=>x.ratio!=null).sort((a,b)=>a.ratio-b.ratio);
  const inside=items.filter(x=>x.ratio<1.3).length;
  const lost=bs.filter(b=>b.beats_constant===false).length;
  app.innerHTML=W(`
  <div class="hero">
    <h1 class="brand">LEAD<i>BOARD</i></h1>
    <p class="subttl">${t.heroKicker}</p>
    <p class="tag">${t.heroTag}</p>
    <p class="lede">${t.heroLede}</p>
    <div class="stats">
      <div class="stat"><b id="st_subs">โ€”</b><span>${t.statSubs}</span></div>
      <div class="stat"><b>${T0.open}</b><span>${t.statBoards}</span></div>
      <div class="stat"><b>${bs.reduce((s,b)=>s+b.n_test,0).toLocaleString()}</b><span>${t.statCompounds}</span></div>
      <div class="stat"><b>${CATS.categories.filter(c=>c.open).length}</b><span>${t.statFields}</span></div>
      <div class="stat"><b>8</b><span>${t.statClauses}</span></div>
      <div class="stat"><b>${T0.planned}</b><span>${t.statPlanned}</span></div>
    </div>
  </div>

  <div class="sec"><h2>${t.secWhy}</h2>
    <div class="prose"><p>${t.why1}</p><p>${t.why2}</p><p>${t.why3}</p>
      <p class="cite">${t.whyCite}</p></div></div>

  <div class="sec"><h2>${t.secFound}</h2>
    <p class="lead2">${t.secFoundLead}</p>
    <div class="finds">
      <div class="find"><b>${t.found1t}</b><p>${t.found1d}</p></div>
      <div class="find"><b>${t.found2t}</b><p>${t.found2d}</p></div>
      <div class="find"><b>${t.found3t}</b><p>${t.found3d}</p></div>
    </div></div>

  <div class="sec"><h2>${t.secLeaders}</h2><p class="lead2">${t.secLeadersLead}</p>
    <div id="leaders"><div class="skel" style="height:200px"></div></div></div>

  <div class="sec prizebox" id="prizebox"></div>

  <div class="sec"><h2>${t.secBrowse}</h2><p class="lead2">${t.secBrowseLead}</p>
    <div class="grid">${CATS.categories.map(cardHTML).join("")}</div></div>

  <div class="sec"><h2>${t.secEvidence}</h2>
    <p class="lead2">${t.secEvidenceLead} ${t.insideCount(inside)}</p>
    ${terrain(items,true)}
    ${lost?`<div class="note">${t.lostNote(lost)}</div>`:""}</div>

  <div class="sec"><h2>${t.secHow}</h2>
    <ol class="steps">
      <li><b>${t.how1t}</b><p class="dim" style="font-size:14px">${t.how1d}</p></li>
      <li><b>${t.how2t}</b><p class="dim" style="font-size:14px">${t.how2d}</p></li>
      <li><b>${t.how3t}</b><p class="dim" style="font-size:14px">${t.how3d}</p></li>
    </ol></div>

  <div class="sec"><h2>${t.secMetric}</h2>
    <dl class="defs">
      <dt>MAE</dt><dd>${t.mMae}</dd>
      <dt>AUROC</dt><dd>${t.mAuroc}</dd>
      <dt>PR-AUC</dt><dd>${t.mPrauc}</dd>
      <dt>${t.noiseH}</dt><dd>${t.mNoise}</dd>
      <dt>${t.ratioLabel}</dt><dd>${t.mRatio}</dd>
      <dt>${t.thLeak}</dt><dd>${t.mLeak}</dd>
    </dl></div>

  <div class="sec"><h2>${t.secMethod}</h2><p class="lead2">${t.secMethodLead}</p>
    <ol class="cl">${t.clauses.map(([a,b])=>`<li><b>${a}</b><span>${b}</span></li>`).join("")}</ol></div>

  <div class="sec"><h2>${t.secOwn}</h2>
    <div class="prose"><p>${t.own1}</p><p>${t.own2}</p><p>${t.own3}</p></div></div>

  <div class="sec"><h2>${t.secData}</h2>
    <div class="note n">${t.dataNote}<br><br>
      ${t.srcLabel} ยท <a href="https://www.ebi.ac.uk/chembl/">ChEMBL_37 (EMBL-EBI)</a> ยท
      <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA 3.0 Unported</a></div></div>`);
  paintLeaders();
}

/* ๋ถ€๋ฌธ๋ณ„ 1์œ„ ํ‘œ. ๋น„๋™๊ธฐ๋กœ ์ฑ„์šด๋‹ค - ์›์žฅ์„ ๋ถ€๋ฌธ ์ˆ˜๋งŒํผ ์ฝ์–ด์•ผ ํ•ด์„œ ์ฒซ ๊ทธ๋ฆผ์„ ๋ง‰์œผ๋ฉด ์•ˆ ๋œ๋‹ค. */
/* ์ƒ๊ธˆ ์•ˆ๋‚ด. ์ˆœ์œ„ํ‘œ๋งŒ ์žˆ๊ณ  ์™œ ์ง€๊ธˆ ํ•ด์•ผ ํ•˜๋Š”์ง€๊ฐ€ ์—†์–ด 29๋ถ€๋ฌธ์ด ๋น„์–ด ์žˆ์—ˆ๋‹ค. */
function renderPrize(d){
  const el=$("#prizebox"); if(!el||!d||!d.prize) return;
  const p=d.prize, s=d.standing||[];
  el.innerHTML=`<h2>${t.prizeH}</h2>
    <div class="amt">$${p.amount_usd.toLocaleString()} <small>USD</small></div>
    <p>${t.prizeLead(p.amount_usd.toLocaleString(), p.closes)}</p>
    <p>${t.prizeRule(p.n_boards)}</p>
    <div class="cand"><b>${t.prizeStanding}</b> โ€” ${
      s.length? s.slice(0,6).map(x=>`${esc(x.user)} <span class="dim">(${t.prizeFirsts(x.firsts)})</span>`).join(" ยท ")
              : t.prizeNone}</div>
    <div class="fine">${t.prizeHost}</div>`;
}

async function paintLeaders(){
  const el=$("#leaders"); if(!el)return;
  let d; try{ d=await j("/api/leaders"); }catch(e){ el.innerHTML=""; return; }
  renderPrize(d);
  // ์ œ์ถœ ์ˆ˜๋Š” ์›์žฅ์„ ํ›‘์–ด์•ผ ๋‚˜์˜ค๋ฏ€๋กœ ์ˆœ์œ„ ์‘๋‹ต์— ์‹ค๋ ค ์˜จ๋‹ค. ์‹คํŒจํ•˜๋ฉด - ๋กœ ๋‘”๋‹ค.
  // 0 ์œผ๋กœ ๋‘๋ฉด "์•„๋ฌด๋„ ์•ˆ ๋ƒˆ๋‹ค"๋กœ ์ฝํžˆ๋Š”๋ฐ, ๊ทธ๊ฒƒ๊ณผ "๋ชป ์…Œ๋‹ค"๋Š” ๋‹ค๋ฅด๋‹ค.
  const se = $("#st_subs");
  if (se) se.textContent = (d.submissions==null) ? "โ€”" : d.submissions.toLocaleString();
  const rows=d.rows.map(r=>{
    const ld=r.leader;   // ์ „์—ญ L ์€ ์–ธ์–ด๋‹ค. ๊ฐ€๋ฆฌ์ง€ ์•Š๋Š”๋‹ค
    // ์ ์ˆ˜๋Š” ๋ถ€๋ฌธ๋งˆ๋‹ค ์ฃผ์ง€ํ‘œ๊ฐ€ ๋‹ค๋ฅด๋‹ค. ํšŒ๊ท€ ๋ถ€๋ฌธ์€ MAE, ๋ถ„๋ฅ˜ ์ „์šฉ ๋ถ€๋ฌธ์€ AUROC.
    const hb=!!r.higher_better;
    const score=ld?(ld.score!=null?ld.score:(hb?ld.auroc:ld.mae)):null;
    const bas=r.baseline_best_score!=null?r.baseline_best_score
             :(hb?r.baseline_best_auroc:r.baseline_best);
    let vs="โ€”";
    if(ld&&score!=null&&bas!=null){
      const better=hb?score>bas:score<bas;
      const gap=hb?(score-bas):(bas-score);
      vs=`<span class="${better?"gain":"loss"}">${better?"โ–ฒ":"โ–ผ"} ${Math.abs(gap).toFixed(3)}</span>`;
    }
    return `<tr>
      <td style="text-align:left"><a href="#/b/${encodeURIComponent(r.board)}">${esc(r.board)}</a>
        <span class="chip g" style="margin-left:6px">${r.split_grade}/${r.answer_grade}</span>
        <div class="sub2">${esc(L==="ko"?(r.blurb||""):(r.blurb_en||r.blurb||""))}</div></td>
      <td style="text-align:left">${ld?esc(ld.method):`<span class="dim">${t.noLeader}</span>`}</td>
      <td style="text-align:left">${ld?hfUser(ld.user):"โ€”"}</td>
      <td>${score!=null?f(score):"โ€”"}</td>
      <td>${vs}</td>
      <td>${(r.n_test||0).toLocaleString()}</td></tr>`;}).join("");
  el.innerHTML=`<div class="tw"><table><thead><tr>
      <th style="text-align:left;width:auto">${t.thBoard}</th>
      <th style="text-align:left">${t.thBest}</th><th style="text-align:left">${t.thUser}</th>
      <th>${t.thScore}</th><th>${t.thVs}</th><th>${t.thN}</th></tr></thead>
    <tbody>${rows}</tbody></table></div>
    <p class="dim" style="font-size:13px">${d.held?t.leadersSome(d.held,d.n):t.leadersEmpty(d.n)}</p>`;
}

function cardHTML(c){
  const on=c.open>0, bs=c.board_cards||[];
  const tot=bs.reduce((s,b)=>s+b.n_test,0);
  const inner=`<div class="ico">${c.icon}</div>
    <div class="nm">${esc(L==="ko"?c.name:c.en)}
      <span class="chip ${on?"ok":"g"}">${on?t.openN(c.open):t.prep}</span></div>
    <div class="ds">${esc(L==="ko"?c.desc:(c.desc_en||c.desc))}</div>
    <div class="mt"><span>${t.cardBoards(c.open,c.planned)}</span>
      <span>${tot?t.cardCompounds(tot.toLocaleString()):"โ€”"}</span></div>`;
  return on?`<a class="cc" href="#/c/${c.id}">${inner}</a>`:`<div class="cc off">${inner}</div>`;
}

/* โ•โ•โ• ๋ถ„์•ผ โ•โ•โ• */
function category(id){
  const c=CATS.categories.find(x=>x.id===id); if(!c)return hub();
  const bs=(c.board_cards||[]).slice().sort((a,b)=>b.n_test-a.n_test);
  const items=bs.map(b=>({board:b.board,ratio:ratioOf(b)}))
    .filter(x=>x.ratio!=null).sort((a,b)=>a.ratio-b.ratio);
  const nm=L==="ko"?c.name:c.en;
  app.innerHTML=W(`
    <div class="crumb"><a href="#/">${t.all}</a> โ€บ ${esc(nm)}</div>
    <h1 class="ttl">${c.icon} ${esc(nm)}</h1>
    <p class="lede">${esc(L==="ko"?c.desc:(c.desc_en||c.desc))}</p>
    <div class="stats" style="margin-top:26px">
      <div class="stat"><b>${c.open}</b><span>${t.statBoards}</span></div>
      <div class="stat"><b>${bs.reduce((s,b)=>s+b.n_test,0).toLocaleString()}</b><span>${t.statCompounds}</span></div>
      <div class="stat"><b>${c.planned}</b><span>${t.statPlanned}</span></div></div>
    ${bs.length?`
      <div class="sec"><h2>${t.secBrowse}</h2>
        ${bs.some(x=>x.starter)?`<p class="lead2">${t.starterLead}</p>`:""}
        <div class="grid">${bs.slice().sort((a,b)=>(b.starter?1:0)-(a.starter?1:0)).map(boardMini).join("")}</div></div>
      <div class="sec"><h2>${t.secEvidence}</h2><p class="lead2">${t.secEvidenceLead}</p>
        ${terrain(items,true)}</div>`
     :`<div class="note">${t.emptyCat}</div>`}`);
}
function boardMini(b){
  const bl=b.baselines[b.best_baseline]||{};
  return `<a class="cc" href="#/b/${encodeURIComponent(b.board)}">
    <div class="nm">${esc(b.board)}<span class="chip">${b.split_grade}/${b.answer_grade}</span>${
      b.starter?`<span class="chip st1">${t.starterTag}</span>`:""}</div>
    <div class="bl">${blurb(b)}</div>
    <div class="ds">${t.cardCompounds(b.n_test.toLocaleString())} ยท ${t.noiseH} ${f((b.noise_floor||{}).sd_single)}<br>
      ${esc(b.best_baseline)} ${f(blScore(b,bl))}</div>
    <div class="mt"><span>${esc(b.source)}</span><span>${ratioOf(b)==null?"โ€”":f(ratioOf(b),2)+"ร—"}</span></div></a>`;
}

/* โ•โ•โ• ๋ถ€๋ฌธ โ•โ•โ• */
async function board(name,tab){
  const b=BOARDS[name]||await j("/api/board/"+encodeURIComponent(name));
  const cat=CATS.categories.find(c=>(c.boards||[]).includes(name));
  const cn=cat?(L==="ko"?cat.name:cat.en):"";
  const TT=[["rank",t.tabRank],["submit",t.tabSubmit],["guide",t.tabGuide],["info",t.tabInfo]];
  app.innerHTML=W(`
    <div class="crumb"><a href="#/">${t.all}</a> โ€บ <a href="#/c/${cat?cat.id:""}">${esc(cn)}</a> โ€บ ${esc(b.board)}</div>
    <h1 class="ttl">${esc(b.board)}<span class="chip">${b.split_grade}/${b.answer_grade}</span></h1>
    <p class="blurbig">${blurb(b)}</p>
    <p class="lede">${esc(b.source)} ยท ${esc(b.type)} ยท
      ${t.cardCompounds(b.n_test.toLocaleString())} ยท ${t.noiseH} <b>${f(b.noise_floor.sd_single)}</b></p>
    <div class="pills">${TT.map(([k,l])=>
      `<a class="pilltab ${k===tab?"on":""}" href="#/b/${encodeURIComponent(name)}/${k}">${l}</a>`).join("")}</div>
    <div id="pane"><div class="skel" style="margin-top:20px"></div></div>`);
  if(tab==="rank")return paneRank(b);
  if(tab==="submit")return paneSubmit(b);
  if(tab==="guide")return paneGuide(b);
  paneInfo(b);
}

async function paneRank(b){
  const d=await j(`/api/board/${encodeURIComponent(b.board)}/leaderboard`);
  const nf=d.noise_floor, ent=d.rows.filter(r=>r.kind!=="baseline");
  const worst=Math.max(...d.rows.map(r=>r.mae||0))||1;
  const leak=l=>l==="high"?`<span class="chip bd">${t.leakHigh}</span>`
    :l==="elevated"?`<span class="chip wr">${t.leakElev}</span>`:`<span class="chip g">โ€”</span>`;
  const rows=d.rows.map(r=>{
    const g=r.rank&&r.rank<=3?` g${r.rank}`:"";
    const w=Math.max(4,58*(r.mae||0)/worst);
    return `<tr class="${r.kind!=="entry"?"base":""}">
      <td>${r.rank?`<span class="rk${g}">${r.rank}</span>`:"ยท"}</td>
      <td>${esc(r.method)}</td><td>${r.kind==="entry"?hfUser(r.user):esc(r.user)}</td>
      <td><span class="mini" style="width:${w}px"></span>${f(r.mae)}</td>
      <td>${f(r.auroc)}</td><td>${f(r.prauc)}</td>
      <td>${r.kind==="baseline"?`<span class="chip g">${t.baseline}</span>`:leak(r.leak)}</td>
      <td>${r.kind==="baseline"?"โ€”":r.kind==="reference"?`<span class="chip wr">${t.reference}</span>`
            :(r.verified?`<span class="chip ok">${t.verified}</span>`
            :`<span class="chip g">${t.submitted}</span>`)}</td></tr>`;}).join("");
  $("#pane").innerHTML=`
    <div class="tw"><table><thead><tr><th>${t.thRank}</th><th>${t.thMethod}</th><th>${t.thUser}</th>
      <th>MAE</th><th>AUROC</th><th>PR-AUC</th><th>${t.thLeak}</th><th>${t.thGrade}</th></tr></thead>
      <tbody>${rows}</tbody></table></div>
    <div class="note">${t.noiseNote(f(nf))}</div>
    <p class="dim" style="font-size:13px">${ent.length
      ? t.updated(new Date(d.updated*1000).toLocaleString(L==="ko"?"ko-KR":"en-GB"))
      : t.noEntries}</p>`;
}

/* ๋ถ€๋ฌธ ๊ฐ’์ด ์ฑ„์›Œ์ง„ ์ฐธ์—ฌ ๊ฐ€์ด๋“œ. ์ผ๋ฐ˜๋ฌธ์œผ๋กœ ๋‘๋ฉด ์ฐธ๊ฐ€์ž๊ฐ€ ์ž๊ธฐ ๋ถ€๋ฌธ์— ๋งž๊ฒŒ ๊ณ ์ณ์•ผ ํ•˜๊ณ ,
   ๋Œ€๋ถ€๋ถ„ ๊ทธ ๋‹จ๊ณ„์—์„œ ๋–จ์–ด์ง„๋‹ค. */
/* ์˜ˆ์ธก ํŒŒ์ผ์„ ์“ฐ๋Š” ๋ถ€๋ถ„. ๋ถ€๋ฌธ์ด ์ถ•์„ ์—ฌ๋Ÿฌ ๊ฐœ ์š”๊ตฌํ•˜๋ฉด CSV ํ•œ ์นธ์— ๋‹ด์„ ์ˆ˜ ์—†๋‹ค.
   ์ „์—๋Š” ๋„ค ๊ฐœ์˜ ์Šคํƒ€ํ„ฐ๊ฐ€ ๋ชจ๋‘ ์Šค์นผ๋ผ CSV ๋ฅผ ์ฐ์–ด์„œ, ์ถ• ๋ถ€๋ฌธ ์ฐธ๊ฐ€์ž๋Š” ์˜ˆ์ œ๋ฅผ
   ๊ทธ๋Œ€๋กœ ๋”ฐ๋ผ ํ•˜๋ฉด ๋ฐ˜๋“œ์‹œ ๋ง‰ํ˜”๋‹ค (2026-09-08 ์ฐธ๊ฐ€์ž ์ œ๋ณด). ํ•œ ๊ณณ์— ๋ชจ์€๋‹ค. */
function saveBlock(b){
  if(!b.axes) return [
    `with open("predictions.csv", "w") as f:`,
    `    f.write("compound_id,prediction\\n")`,
    `    for c, v in zip(test["compounds"], p):`,
    `        f.write("%s,%.4f\\n" % (c["compound_id"], v))`];
  return [
    `# ์ด ๋ถ€๋ฌธ์€ ํ™”ํ•ฉ๋ฌผ๋งˆ๋‹ค ์ถ•์ด ${b.axes}๊ฐœ๋‹ค. ๋ชจ๋ธ๋„ ${b.axes}๊ฐœ๋ฅผ ๋‚ด์•ผ ํ•œ๋‹ค`,
    `# (์˜ˆ: MultiOutputRegressor ๋กœ ๊ฐ์‹ธ๊ฑฐ๋‚˜ ์ถ•๋งˆ๋‹ค ๋”ฐ๋กœ ํ•™์Šต).`,
    `out = {c["compound_id"]: [round(float(x), 4) for x in v]`,
    `       for c, v in zip(test["compounds"], p)}`,
    `json.dump(out, open("predictions.json", "w"))`];
}

function promptFor(b){
  const nf=(b.noise_floor||{}).sd_single;
  const mk=metricOf(b);
  const bl=Object.entries(b.baselines||{})
    .map(([k,v])=>`  ${k}: ${mk.label} ${f(v[mk.key])}`).join("\n");
  const unit = b.type && b.type.indexOf("logS")>=0
    ? "logS = log10(์šฉํ•ด๋„ in mol/L)"
    : b.threshold==null ? "๋ถ€๋ฌธ ์ •์˜๊ฐ’" : "p ์Šค์ผ€์ผ = -log10(๋†๋„ in M)";
  return [
`๋‚˜๋Š” ์‹ ์•ฝ ์˜ˆ์ธก ๋„๊ตฌ ์‹œํ—˜๋Œ€ LEADBOARD ์˜ "${b.board}" ๋ถ€๋ฌธ์— ์ฐธ๊ฐ€ํ•œ๋‹ค.`,
`์•„๋ž˜ ์กฐ๊ฑด๋Œ€๋กœ ์˜ˆ์ธก ํŒŒ์ผ์„ ๋งŒ๋“œ๋Š” Python ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ž‘์„ฑํ•ด ๋‹ฌ๋ผ.`,
``,
`[๊ณผ์ œ]`,
`  ์ž…๋ ฅ   ${b.board.toLowerCase()}_test.json  โ€” compound_id ์™€ SMILES ๋งŒ ๋“ค์–ด ์žˆ๋‹ค (${b.n_test}๊ฐœ)`,
b.axes ? `  ์ถœ๋ ฅ   predictions.json โ€” {compound_id: [์ˆซ์ž ${b.axes}๊ฐœ]} ํ˜•ํƒœ`
        : `  ์ถœ๋ ฅ   predictions.csv โ€” ๋‘ ์—ด: compound_id,prediction`,
`  ์˜ˆ์ธก๊ฐ’  ${unit}`,
b.target && b.target!=="โ€”" ? `  ๋Œ€์ƒ   ${b.target} ยท ${b.type}` : `  ๋Œ€์ƒ   ${b.type}`,
``,
`[ํ•™์Šต ์ž๋ฃŒ]`,
b.cut ? `  ChEMBL ์—์„œ ${b.target} ์˜ ${b.type} ํ™œ์„ฑ์„ ๋ฐ›์•„ ์“ด๋‹ค.` : `  ๊ณต๊ฐœ ์ž๋ฃŒ๋ฅผ ์ง์ ‘ ํ๋ ˆ์ด์…˜ํ•ด ์“ด๋‹ค.`,
b.cut ? `  โ˜… ${b.cut}๋…„ ์ดํ›„ ์ฒ˜์Œ ๋ณด๊ณ ๋œ ํ™”ํ•ฉ๋ฌผ์€ ํ•™์Šต์— ๋„ฃ์ง€ ๋ง ๊ฒƒ โ€” ๊ทธ๊ฒƒ์ด ํ…Œ์ŠคํŠธ์…‹์ด๋‹ค.` : ``,
`  ๊ฐ™์€ ํ™”ํ•ฉ๋ฌผ์ด ์—ฌ๋Ÿฌ ๋…ผ๋ฌธ์— ์žˆ์œผ๋ฉด InChIKey ๋กœ ์ ‘์–ด ์ค‘์•™๊ฐ’์„ ์“ธ ๊ฒƒ.`,
``,
`[์ œ์•ฝ]`,
`  ๋ฐฉ๋ฒ•์— ์ œํ•œ์€ ์—†๋‹ค. ์ง€๋ฌธ+ํŠธ๋ฆฌ, ๊ทธ๋ž˜ํ”„ ์‹ ๊ฒฝ๋ง, ์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ, ๋ฌผ๋ฆฌ ๊ณ„์‚ฐ ๋ชจ๋‘ ๊ฐ€๋Šฅ.`,
`  ์ •๋‹ต์„ ์กฐํšŒํ•ด ์ฑ„์šฐ์ง€ ๋ง ๊ฒƒ. ์˜ˆ์ธก๊ฐ’์ด ์‹ค์ธก๊ณผ ์†Œ์ˆ˜ ์ž๋ฆฌ๊นŒ์ง€ ์ผ์น˜ํ•˜๋Š” ๋ฐ€๋„๋ฅผ ๊ฒ€์‚ฌํ•œ๋‹ค.`,
``,
`[ํ‰๊ฐ€]`,
`  ์ฃผ์ง€ํ‘œ ${metricLabel(b)}`,
nf ? `  ์ด ๋ถ€๋ฌธ์˜ ์‹คํ—˜ ์žฌํ˜„ ์˜ค์ฐจ๋Š” ${f(nf)} ์ด๋‹ค. ๊ทธ๋ณด๋‹ค ์ž‘์€ ์ฐจ์ด๋Š” ์ˆœ์œ„๋กœ ์ธ์ •๋˜์ง€ ์•Š๋Š”๋‹ค.` : ``,
`  ๋„˜์–ด์•ผ ํ•  ๊ธฐ์ค€์„ :`,
bl,
``,
`์Šคํฌ๋ฆฝํŠธ๋Š” ์ž๋ฃŒ ์ˆ˜์ง‘ โ†’ ์ •์ œ โ†’ ํŠน์ง• โ†’ ํ•™์Šต โ†’ ์˜ˆ์ธก โ†’ CSV ์ €์žฅ๊นŒ์ง€ ํ•œ ํŒŒ์ผ๋กœ ์ž‘์„ฑํ•ด ๋‹ฌ๋ผ.`
].filter(x=>x!==``||true).join("\n");
}

function starterFor(b){
  /* ๋ถ€๋ฌธ์€ ์„ธ ์ข…๋ฅ˜๋‹ค. ํ•˜๋‚˜์˜ ๋ผˆ๋Œ€๋กœ ๋ฎ์œผ๋ฉด ๋‚˜๋จธ์ง€ ๋‘˜์€ ๋Œ์•„๊ฐ€์ง€ ์•Š๋Š”๋‹ค.

     ChEMBL ํ‘œ์  ํ™œ์„ฑ  target_chembl_id + standard_type ์œผ๋กœ ์กฐํšŒํ•œ๋‹ค.
     ChEMBL ๋ฌผ์„ฑยท์ „์„ธํฌ  ํ‘œ์ ์ด ์—†๊ฑฐ๋‚˜ ๊ท ์ด๋‹ค. standard_type ๊ณผ assay ์„ค๋ช…์œผ๋กœ ๊ณ ๋ฅธ๋‹ค.
     ๊ทธ ์™ธ (JUMP ๋“ฑ)   ChEMBL ์— ์—†๋‹ค. ์กฐํšŒ๋ฌธ์„ ์ง€์–ด๋‚ด์ง€ ์•Š๋Š”๋‹ค.

     ์„ธ ๋ฒˆ์งธ๋ฅผ ์ฒซ ๋ฒˆ์งธ ๋ผˆ๋Œ€๋กœ ๋‚ด๋ณด๋‚ด๋‹ค๊ฐ€, ํ‘œ์  ์ž๋ฆฌ์— em dash ๊ฐ€ ๋ฐ•ํžŒ ์ฝ”๋“œ๋ฅผ
     ์ฐธ๊ฐ€์ž์—๊ฒŒ ์ฃผ๊ณ  ์žˆ์—ˆ๋‹ค. ๊ทธ๋Œ€๋กœ ๋Œ๋ฆฌ๋ฉด ๋นˆ ํ›ˆ๋ จ์…‹์ด ๋‚˜์˜จ๋‹ค. */
  const isChembl=/^CHEMBL[0-9]+$/.test(String(b.target||""));
  const stype=b.stype||b.type;
  /* ํ™œ์„ฑ ์กฐํšŒ๋กœ ๋งŒ๋“ค์–ด์ง€์ง€ ์•Š๋Š” ๋ถ€๋ฌธ์ด ๋‘ ์ข…๋ฅ˜ ๋” ์žˆ๋‹ค. ์Šน์ธยทํ‡ด์ถœ ๋ถ€๋ฌธ์€ molecule
     ์—”๋“œํฌ์ธํŠธ๋ฅผ ์“ฐ๊ณ , ์•ˆ์ „์—ญ ๋ถ€๋ฌธ์€ ๋‘ ๊ฐ’์˜ ์ฐจ์ด๋‹ค. ์ด ์…‹์„ ํ•œ ๋ฉ์–ด๋ฆฌ๋กœ ๋ฌถ์–ด
     "ChEMBL ์—์„œ ๋‚˜์˜ค์ง€ ์•Š๋Š”๋‹ค"๊ณ  ์ ์œผ๋ฉด ์‚ฌ์‹ค์ด ์•„๋‹Œ ์•ˆ๋‚ด๊ฐ€ ๋œ๋‹ค - ์…‹ ๋‹ค ChEMBL ์ด๋‹ค. */
  if(b.query_kind==="molecule") return starterMolecule(b);
  if(b.query_kind==="derived") return starterDerived(b);
  if(!isChembl && !b.stype) return starterNoChembl(b);
  const q=[`    q = {"standard_type": "${stype}", "standard_relation": "=",`];
  if(isChembl) q.push(`         "target_chembl_id": "${b.target}",`);
  q.push(`         "limit": 1000, "offset": off}`);
  const filt=[];
  if(b.assay_keep) filt.push(`ak = re.compile(r"${b.assay_keep}", re.I)`);
  if(b.assay_drop) filt.push(`ad = re.compile(r"${b.assay_drop}", re.I)`);
  return [
`# ${b.board} ์ œ์ถœ ๋ผˆ๋Œ€`,
`import json, math, re, requests, numpy as np`,
`from rdkit import Chem`,
`from rdkit.Chem import rdFingerprintGenerator`,
`import lightgbm as lgb`,
``,
`# 1) ํ›ˆ๋ จ ์ž๋ฃŒ  (ChEMBL ์—์„œ ๋ฐ›๋Š”๋‹ค)`,
`API = "https://www.ebi.ac.uk/chembl/api/data/activity.json"`,
`rows, off = [], 0`,
`while True:`,
...q,
`    d = requests.get(API, params=q, timeout=120).json()`,
`    rows += d["activities"]; off += 1000`,
`    if off >= d["page_meta"]["total_count"]: break`,
``,
filt.length?`# 2) ์‹คํ—˜๋ฒ• ์„ ๋ณ„ โ€” ๊ฐ™์€ ์ด๋ฆ„์˜ ์ธก์ •๋„ ์กฐ๊ฑด์ด ๋‹ค๋ฅด๋ฉด ๊ฐ’์ด ๋‹ค๋ฅด๋‹ค`:``,
...filt,
``,
`# 3) ์ •์ œ โ€” InChIKey ๋กœ ์ ‘๊ณ , ๊ธฐ์ค€์ผ ์ดํ›„๋Š” ๋ฒ„๋ฆฐ๋‹ค`,
`rec = {}`,
`for r in rows:`,
`    s, v, u, y = r["canonical_smiles"], r["standard_value"], r["standard_units"], r["document_year"]`,
`    if not (s and v and y): continue`,
b.assay_keep?`    if not ak.search(r.get("assay_description") or ""): continue`:``,
b.assay_drop?`    if ad.search(r.get("assay_description") or ""): continue`:``,
b.log===false?`    if u not in (None, ""): continue   # ์ด ๋ถ€๋ฌธ ๊ฐ’์€ ๋ฌด๋‹จ์œ„๋‹ค`
             :`    if u != "nM": continue`,
`    m = Chem.MolFromSmiles(s)`,
`    if m is None or float(v) <= 0: continue`,
`    k = Chem.MolToInchiKey(m)`,
`    rec.setdefault(k, {"y": [], "p": [], "m": m})`,
b.log===false?`    rec[k]["y"].append(int(y)); rec[k]["p"].append(float(v))`
             :`    rec[k]["y"].append(int(y)); rec[k]["p"].append(9.0 - math.log10(float(v)))`,
b.clip?`rec = {k: v for k, v in rec.items()`:``,
b.clip?`       if ${b.clip[0]} <= float(np.median(v["p"])) <= ${b.clip[1]}}   # ๋ฌผ๋ฆฌ์  ๋ฒ”์œ„ ๋ฐ–์€ ์ž…๋ ฅ ์˜ค๋ฅ˜๋‹ค`:``,
`train = {k: v for k, v in rec.items() if min(v["y"]) < ${b.cut||2022}}   # โ˜… ํ…Œ์ŠคํŠธ์…‹ ์ œ์™ธ`,
``,
`# 4) ํŠน์ง• ยท ํ•™์Šต`,
`gen = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048)`,
`X = np.array([gen.GetFingerprintAsNumPy(v["m"]) for v in train.values()])`,
`Y = np.array([float(np.median(v["p"])) for v in train.values()])`,
`model = lgb.LGBMRegressor(n_estimators=500, learning_rate=0.05).fit(X, Y)`,
``,
`# 5) ์˜ˆ์ธก ยท ์ €์žฅ`,
`test = json.load(open("${b.board.toLowerCase()}_test.json", encoding="utf-8"))`,
`Xt = np.array([gen.GetFingerprintAsNumPy(Chem.MolFromSmiles(c["smiles"]))`,
`               for c in test["compounds"]])`,
`p = model.predict(Xt)`,
...saveBlock(b)
].filter(x=>x!==``||true).join("\n");
}

/* ChEMBL ์—์„œ ๋‚˜์˜ค์ง€ ์•Š๋Š” ๋ถ€๋ฌธ. ์กฐํšŒ๋ฌธ์„ ์ง€์–ด๋‚ด์ง€ ์•Š๊ณ , ์ž๋ฃŒ๊ฐ€ ์–ด๋”” ์žˆ๋Š”์ง€ ๋ฐํžŒ๋‹ค.
   ํ›ˆ๋ จ ๋ผ๋ฒจ์€ ์šฐ๋ฆฌ๊ฐ€ ๋งŒ๋“  ํŒ๋ณธ์ด๋ฏ€๋กœ ๋Œ€์‹  ๋งŒ๋“ค์–ด ์ค„ ์ˆ˜ ์—†๋‹ค - ๊ทœ์น™ ๊ทธ๋Œ€๋กœ,
   ์ฐธ๊ฐ€์ž๊ฐ€ ๊ณต๊ฐœ ์ž๋ฃŒ๋ฅผ ์ง์ ‘ ํ๋ ˆ์ด์…˜ํ•œ๋‹ค. */
function starterMolecule(b){
  /* ์Šน์ธยทํ‡ด์ถœ ๋ถ€๋ฌธ. ํ™œ์„ฑ ์กฐํšŒ๊ฐ€ ์•„๋‹ˆ๋ผ molecule ์—”๋“œํฌ์ธํŠธ์—์„œ ์Šน์ธ ์†Œ๋ถ„์ž๋ฅผ ๋ฐ›๋Š”๋‹ค. */
  return [
`# ${b.board} ์ œ์ถœ ๋ผˆ๋Œ€`,
`#`,
`# ${b.query_note||"ํ™œ์„ฑ ์กฐํšŒ๊ฐ€ ์•„๋‹ˆ๋ผ molecule ์—”๋“œํฌ์ธํŠธ๋ฅผ ์“ด๋‹ค."}`,
``,
`import json, requests, numpy as np`,
`from rdkit import Chem`,
`from rdkit.Chem import rdFingerprintGenerator`,
`import lightgbm as lgb`,
``,
`# 1) ์Šน์ธ ์†Œ๋ถ„์ž ๋ชฉ๋ก  (ํ™œ์„ฑ์ด ์•„๋‹ˆ๋ผ ๋ถ„์ž ์ž์ฒด๋ฅผ ๋ฐ›๋Š”๋‹ค)`,
`API = "https://www.ebi.ac.uk/chembl/api/data/molecule.json"`,
`rows, off = [], 0`,
`while True:`,
`    q = {"max_phase": 4, "molecule_type": "Small molecule",`,
`         "limit": 1000, "offset": off}`,
`    d = requests.get(API, params=q, timeout=180).json()`,
`    rows += d["molecules"]; off += 1000`,
`    if off >= d["page_meta"]["total_count"]: break`,
``,
`# 2) ๋ผ๋ฒจ โ€” withdrawn_flag`,
`pairs = []`,
`for m in rows:`,
`    s = (m.get("molecule_structures") or {}).get("canonical_smiles")`,
`    if not (s and m.get("first_approval")): continue`,
`    pairs.append((s, 1 if m.get("withdrawn_flag") else 0, m["first_approval"]))`,
`# โ˜… ์‹œํ—˜ ํ™”ํ•ฉ๋ฌผ๊ณผ ๊ฒน์น˜์ง€ ์•Š๊ฒŒ ๊ตฌ์„ฑํ•  ๊ฒƒ. ์Šน์ธ ์—ฐ๋„๋กœ ๋น„๊ต๊ตฐ์„ ๋งž์ถ”๋ฉด ๋‹ฌ๋ ฅ์ด ๋‹ต์„ ์ค€๋‹ค.`,
``,
`gen = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048)`,
`mols = [Chem.MolFromSmiles(s) for s, _, _ in pairs]`,
`X = np.array([gen.GetFingerprintAsNumPy(m) for m in mols if m is not None])`,
`Y = np.array([y for (s, y, _), m in zip(pairs, mols) if m is not None])`,
`model = lgb.LGBMClassifier(n_estimators=500, learning_rate=0.05).fit(X, Y)`,
``,
`test = json.load(open("${b.board.toLowerCase()}_test.json", encoding="utf-8"))`,
`Xt = np.array([gen.GetFingerprintAsNumPy(Chem.MolFromSmiles(c["smiles"]))`,
`               for c in test["compounds"]])`,
`p = model.predict_proba(Xt)[:, 1]`,
...saveBlock(b)
].join("\n");
}


function starterDerived(b){
  /* ์•ˆ์ „์—ญ ๋ถ€๋ฌธ. ๋‹จ์ผ ์ธก์ •์ด ์•„๋‹ˆ๋ผ ๋‘ ๊ฐ’์˜ ์ฐจ์ด๋‹ค. */
  return [
`# ${b.board} ์ œ์ถœ ๋ผˆ๋Œ€`,
`#`,
`# ${b.query_note||"๋‘ ๊ฐ’์˜ ์ฐจ์ด๋กœ ๋งŒ๋“ค์–ด์ง€๋Š” ๋ถ€๋ฌธ์ด๋‹ค."}`,
`#`,
`# ์‹ค์ธก ์ฐธ๊ณ : ์–‘์ชฝ์„ ๋”ฐ๋กœ ์˜ˆ์ธกํ•ด ๋นผ๋Š” ์ชฝ์ด, ์ฐจ์ด๋ฅผ ์ง์ ‘ ํ•™์Šตํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค ์ข‹์•˜๋‹ค.`,
``,
`import json, math, requests, numpy as np`,
`from rdkit import Chem`,
`from rdkit.Chem import rdFingerprintGenerator`,
`import lightgbm as lgb`,
``,
`API = "https://www.ebi.ac.uk/chembl/api/data/activity.json"`,
``,
`def pull(target):`,
`    rows, off = [], 0`,
`    while True:`,
`        q = {"target_chembl_id": target, "standard_type": "IC50",`,
`             "standard_relation": "=", "limit": 1000, "offset": off}`,
`        d = requests.get(API, params=q, timeout=120).json()`,
`        rows += d["activities"]; off += 1000`,
`        if off >= d["page_meta"]["total_count"]: break`,
`    rec = {}`,
`    for r in rows:`,
`        s, v, u = r["canonical_smiles"], r["standard_value"], r["standard_units"]`,
`        if not (s and v and u == "nM") or float(v) <= 0: continue`,
`        m = Chem.MolFromSmiles(s)`,
`        if m is None: continue`,
`        rec.setdefault(Chem.MolToInchiKey(m), {"m": m, "p": []})`,
`        rec[Chem.MolToInchiKey(m)]["p"].append(9.0 - math.log10(float(v)))`,
`    return rec`,
``,
`herg = pull("CHEMBL240")          # ์‹ฌ์žฅ ์ชฝ`,
`tgt  = pull("CHEMBL_ํ‘œ์ _ID")      # โ† ์ด ๋ถ€๋ฌธ์˜ ํ‘œ์ ์œผ๋กœ ๋ฐ”๊พผ๋‹ค`,
``,
`# ์•ˆ์ „์—ญ = ํ‘œ์  ํ™œ์„ฑ - hERG ํ™œ์„ฑ. ๊ฐ๊ฐ ์˜ˆ์ธก๊ธฐ๋ฅผ ๋งŒ๋“ค๊ณ  ์˜ˆ์ธก๊ฐ’์„ ๋บ€๋‹ค.`,
`gen = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048)`,
``,
`def fit(rec):`,
`    X = np.array([gen.GetFingerprintAsNumPy(v["m"]) for v in rec.values()])`,
`    Y = np.array([float(np.median(v["p"])) for v in rec.values()])`,
`    return lgb.LGBMRegressor(n_estimators=500, learning_rate=0.05).fit(X, Y)`,
``,
`m_t, m_h = fit(tgt), fit(herg)`,
`test = json.load(open("${b.board.toLowerCase()}_test.json", encoding="utf-8"))`,
`Xt = np.array([gen.GetFingerprintAsNumPy(Chem.MolFromSmiles(c["smiles"]))`,
`               for c in test["compounds"]])`,
`p = m_t.predict(Xt) - m_h.predict(Xt)`,
...saveBlock(b)
].join("\n");
}


function starterNoChembl(b){
  return [
`# ${b.board} ์ œ์ถœ ๋ผˆ๋Œ€`,
`#`,
`# ์ด ๋ถ€๋ฌธ์€ ChEMBL ํ™œ์„ฑ ์กฐํšŒ๋กœ ๋งŒ๋“ค์–ด์ง€์ง€ ์•Š๋Š”๋‹ค. ์ถœ์ฒ˜: ${b.source}`,
`# ํ›ˆ๋ จ ๋ผ๋ฒจ์€ ๋ณธ ์‹œํ—˜๋Œ€๊ฐ€ ๋งŒ๋“  ํŒ๋ณธ์ด๋ผ ๋ฐฐํฌํ•˜์ง€ ์•Š๋Š”๋‹ค. ๊ทœ์น™ 3์กฐ๋Œ€๋กœ`,
`# ๊ณต๊ฐœ ์›์ž๋ฃŒ์—์„œ ์ง์ ‘ ๋งŒ๋“ค์–ด ์จ์•ผ ํ•œ๋‹ค.`,
`#`,
`# ์•„๋ž˜๋Š” ํ•™์Šตยท์˜ˆ์ธกยท์ €์žฅ ๋ถ€๋ถ„์ด๋‹ค. load_training() ๋งŒ ์ฑ„์šฐ๋ฉด ๋œ๋‹ค.`,
``,
`import json, numpy as np`,
`from rdkit import Chem`,
`from rdkit.Chem import rdFingerprintGenerator`,
`import lightgbm as lgb`,
``,
`def load_training():`,
`    """(SMILES, ๋ชฉํ‘œ๊ฐ’) ๋ชฉ๋ก์„ ๋‚ธ๋‹ค.`,
`    ์ถœ์ฒ˜: ${b.source}`,
`    ${b.cut?("โ˜… "+b.cut+"๋…„ ์ดํ›„ ์ฒ˜์Œ ๋ณด๊ณ ๋œ ํ™”ํ•ฉ๋ฌผ์€ ๋„ฃ์ง€ ๋ง ๊ฒƒ โ€” ๊ทธ๊ฒƒ์ด ํ…Œ์ŠคํŠธ์…‹์ด๋‹ค."):"์‹œํ—˜ ํ™”ํ•ฉ๋ฌผ๊ณผ ๊ฒน์น˜์ง€ ์•Š๊ฒŒ ๊ตฌ์„ฑํ•  ๊ฒƒ."}`,
`    """`,
`    raise NotImplementedError("๊ณต๊ฐœ ์›์ž๋ฃŒ์—์„œ ์ง์ ‘ ๊ตฌ์„ฑํ•œ๋‹ค")`,
``,
`pairs = load_training()`,
`gen = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048)`,
`mols = [Chem.MolFromSmiles(s) for s, _ in pairs]`,
`X = np.array([gen.GetFingerprintAsNumPy(m) for m in mols if m is not None])`,
`Y = np.array([y for (s, y), m in zip(pairs, mols) if m is not None])`,
`model = lgb.LGBMRegressor(n_estimators=500, learning_rate=0.05).fit(X, Y)`,
``,
`test = json.load(open("${b.board.toLowerCase()}_test.json", encoding="utf-8"))`,
`Xt = np.array([gen.GetFingerprintAsNumPy(Chem.MolFromSmiles(c["smiles"]))`,
`               for c in test["compounds"]])`,
`p = model.predict(Xt)`,
...saveBlock(b)
].join("\n");
}

function paneGuide(b){
  const pr=promptFor(b), sk=starterFor(b);
  const mk=metricOf(b);
  const bl=Object.entries(b.baselines||{}).sort((x,y)=>
    (mk.hb?-1:1)*((x[1][mk.key]??0)-(y[1][mk.key]??0)));
  $("#pane").innerHTML=`
    <p class="lede" style="margin:6px 0 18px">${t.gdIntro}</p>
    <h3>${t.gdWhat}</h3><p class="dim" style="font-size:14.5px">${t.gdWhatD}</p>
    <h3>${t.gdPrompt}</h3><p class="dim" style="font-size:14px">${t.gdPromptD}</p>
    <div style="position:relative">
      <button class="btn" id="cp1" style="position:absolute;right:12px;top:12px;padding:6px 13px;font-size:12px">${t.gdCopy}</button>
      <pre class="fig" style="white-space:pre-wrap;margin:0">${esc(pr)}</pre></div>
    <h3>${t.gdStarter}</h3><p class="dim" style="font-size:14px">${t.gdStarterD}</p>
    <div style="position:relative">
      <button class="btn" id="cp2" style="position:absolute;right:12px;top:12px;padding:6px 13px;font-size:12px">${t.gdCopy}</button>
      <pre class="fig" style="white-space:pre;overflow-x:auto;margin:0;font-size:12px">${esc(sk)}</pre></div>
    <h3>${t.gdTarget}</h3><p class="dim" style="font-size:14px">${t.gdTargetD}</p>
    <div class="tw"><table><thead><tr><th style="text-align:left;width:auto">${t.baseH}</th>
      <th>${esc(metricLabel(b))}</th></tr></thead><tbody>
      ${bl.map(([k,v])=>`<tr><td style="text-align:left">${esc(k)}</td>
        <td>${v[mk.key]!=null?f(v[mk.key]):"โ€”"}</td></tr>`).join("")}
      </tbody></table></div>
    <h3>${t.gdRules}</h3>
    <ol class="cl" style="grid-template-columns:1fr">
      ${[t.gdR1,t.gdR2,t.gdR3,t.gdR4].map(x=>`<li><span>${x}</span></li>`).join("")}
    </ol>`;
  const wireCopy=(id,txt)=>{const el=$("#"+id); if(!el)return;
    el.onclick=async()=>{try{await navigator.clipboard.writeText(txt);
      el.textContent=t.gdCopied; setTimeout(()=>el.textContent=t.gdCopy,1600);}catch(e){}};};
  wireCopy("cp1",pr); wireCopy("cp2",sk);
}

function paneInfo(b){
  const nf=b.noise_floor, bl=b.baselines;
  $("#pane").innerHTML=`
    <h3>${t.gradeH}</h3>
    <dl class="kv">
      <dt>${t.splitGrade} <b>${b.split_grade}</b></dt>
      <dd>${esc(t.gradeNote[b.split_grade]||b.split_grade_note||"")}</dd>
      <dt>${t.answerGrade} <b>${b.answer_grade}</b></dt>
      <dd>${esc(t.gradeNote[b.answer_grade]||b.answer_grade_note||"")}</dd></dl>
    <h3>${t.holdoutH}</h3>
    <dl class="kv">
      <dt>${t.kSource}</dt><dd>${esc(b.source)} ยท ${esc(b.target)} ยท ${esc(b.type)}</dd>
      <dt>${t.kCut}</dt><dd>${b.cut} โ€” ${t.cutNote}</dd>
      <dt>${t.kTrainTest}</dt><dd>${b.n_train.toLocaleString()} / ${b.n_test.toLocaleString()}</dd>
      <dt>${t.kOverlap}</dt><dd>${t.overlapNote}</dd>
      <dt>${t.kThr}</dt><dd>${b.threshold} ยท ${t.posRate((b.positive_rate*100).toFixed(1))}</dd>
      <dt>${t.kSha}</dt><dd>${esc(b.dataset_sha)}</dd>
      <dt>${t.kLicense}</dt><dd>${/JUMP/i.test(b.source||"")
        ? "JUMP Cell Painting ยท CC0"
        : "ChEMBL ยท CC BY-SA 3.0"}</dd></dl>
    <h3>${t.noiseH} <span class="dim" style="font-weight:400;font-size:14px">(4)</span></h3>
    <div class="fig">${t.noiseDesc}<br>
${t.noisePairs(nf.pairs.toLocaleString(),nf.compounds.toLocaleString())}<br>
median ${f(nf.median)} ยท mean ${f(nf.mean)} ยท p90 ${f(nf.p90)}<br>
<b>${t.noiseSd} <span class="n">${f(nf.sd_single)}</span></b></div>
    <div class="note">${t.nearNote(b.near_pct,b.near_pct>45)}</div>
    <h3>${t.baseH} <span class="dim" style="font-weight:400;font-size:14px">(3)</span></h3>
    <div class="tw"><table><thead><tr><th style="width:auto">ยท</th><th>${t.baseH}</th><th>MAE</th>
      <th>AUROC</th><th>PR-AUC</th></tr></thead><tbody>
      ${Object.entries(bl).map(([k,v])=>`<tr><td>ยท</td><td>${esc(k)}</td><td>${f(v.mae)}</td>
        <td>${f(v.auroc)}</td><td>${f(v.prauc)}</td></tr>`).join("")}
      <tr class="base"><td>ยท</td><td>${t.noiseFloorRow}</td><td>${f(nf.sd_single)}</td><td>โ€”</td><td>โ€”</td></tr>
      </tbody></table></div>
    <div class="note ${b.beats_constant?"ok":""}">${b.beats_constant?t.beatsYes:t.beatsNo}</div>`;
}

function paneSubmit(b){
  const url=`/api/board/${encodeURIComponent(b.board)}/testset`;
  $("#pane").innerHTML=`
  <ol class="steps">
    <li><b>${t.step1}</b>
      <p class="dim" style="font-size:13.5px">${t.step1d(b.n_test.toLocaleString())}<br>${t.licLine}</p>
      <a class="btn" href="${url}" download>${t.dl}</a>
      <span class="hint">&nbsp;${esc(b.board.toLowerCase())}_test.json</span></li>
    <li><b>${t.step2}</b>
      ${ME.user?`
        <label>${t.fMethod} <span class="hint">${t.fMethodH}</span></label>
        <input type="text" id="m" maxlength="60">
        <label>${t.fTrain} <span class="hint">${t.fTrainH}</span></label>
        <input type="text" id="td">
        <label>${t.fPred} <span class="hint">${b.axes?t.fPredAx(b.axes):t.fPredH}</span></label>
        <div class="drop" id="drop">${t.drop}<input type="file" id="file" accept=".json,.csv,.txt" hidden></div>
        <textarea id="p" rows="6" style="margin-top:11px"></textarea>
        <p style="margin-top:15px"><button class="btn" id="go">${t.send}</button>
          <span class="hint" id="msg"></span></p>`
       :`<div class="note">${t.needLogin}
          <a href="/login?next=${encodeURIComponent(location.hash)}">${t.login}</a></div>`}</li>
    <li><b>${t.step3}</b><p class="dim" style="font-size:13.5px">${t.step3d}</p></li>
  </ol>
  <div class="note">${t.ladderNote(f(b.noise_floor.sd_single),ME.daily_cap||5)}</div>`;
  wire(b);
}
function parsePred(x){
  x=x.trim(); if(x.startsWith("{"))return JSON.parse(x);
  const o={};
  x.split(/\r?\n/).forEach((ln,i)=>{const p=ln.split(/[,\t]/);if(p.length<2)return;
    const k=p[0].trim();if(!k||(i===0&&isNaN(parseFloat(p[1]))))return;
    const v=parseFloat(p[1]);if(!isNaN(v))o[k]=v;});
  if(!Object.keys(o).length)throw new Error("no readable entries");
  return o;
}
function wire(b){
  const drop=$("#drop"),file=$("#file"),ta=$("#p"),go=$("#go");
  const load=f0=>{const r=new FileReader();r.onload=()=>{ta.value=r.result;
    drop.textContent=`${f0.name} โ€” ${(f0.size/1024).toFixed(0)} KB`;};r.readAsText(f0);};
  if(drop){
    drop.onclick=()=>file.click();
    file.onchange=e=>e.target.files[0]&&load(e.target.files[0]);
    ["dragenter","dragover"].forEach(v=>drop.addEventListener(v,e=>{e.preventDefault();drop.classList.add("hot");}));
    ["dragleave","drop"].forEach(v=>drop.addEventListener(v,e=>{e.preventDefault();drop.classList.remove("hot");}));
    drop.addEventListener("drop",e=>e.dataTransfer.files[0]&&load(e.dataTransfer.files[0]));
  }
  if(!go)return;
  go.onclick=async()=>{
    const msg=$("#msg");let preds;
    try{preds=parsePred(ta.value);}catch(e){msg.textContent=t.parseFail(e.message);return;}
    msg.textContent=t.sending(Object.keys(preds).length.toLocaleString());go.disabled=true;
    try{const r=await j("/api/submit",{method:"POST",headers:{"Content-Type":"application/json"},
      body:JSON.stringify({board:b.board,method:($("#m").value||"").trim(),
        predictions:preds,training_data:($("#td").value||"").trim()})});
      msg.textContent=t.accepted(r.submission_id);
    }catch(e){let x=String(e.message||e);try{x=JSON.parse(x).detail||x;}catch(_){}msg.textContent=x;}
    go.disabled=false;
  };
}
boot().catch(e=>{app.innerHTML=W(`<div class="note" style="margin-top:50px">
  ${(window.T&&window.T.en.loadFail)||"Load failed."} ${esc(e.message||e)}</div>`);});
</script>
</body>
</html>