File size: 37,271 Bytes
f145097
 
eec3fb0
f145097
437df61
 
 
 
 
2158e23
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f145097
437df61
f145097
437df61
 
 
 
 
 
 
 
 
 
 
 
f145097
437df61
 
f145097
437df61
 
 
 
f145097
 
437df61
 
 
f145097
 
437df61
 
f145097
 
437df61
 
f145097
 
437df61
 
 
 
f145097
 
437df61
 
 
 
f145097
 
437df61
 
 
 
f145097
 
437df61
 
 
 
f145097
 
437df61
 
 
f145097
437df61
 
f145097
 
437df61
 
 
f145097
 
437df61
 
f145097
 
437df61
eec3fb0
437df61
eec3fb0
 
 
437df61
eec3fb0
f145097
 
437df61
 
 
eec3fb0
 
 
437df61
eec3fb0
f145097
437df61
 
 
f145097
 
437df61
 
f145097
 
437df61
 
f145097
 
437df61
 
 
993e34a
 
437df61
 
993e34a
 
437df61
 
993e34a
 
437df61
 
 
993e34a
 
437df61
993e34a
 
437df61
 
 
 
 
 
 
993e34a
 
 
 
 
 
 
437df61
993e34a
437df61
 
7f595cd
 
437df61
 
 
993e34a
 
437df61
 
 
 
 
 
 
 
 
993e34a
 
 
437df61
 
993e34a
 
 
437df61
7f595cd
993e34a
 
437df61
 
 
 
 
993e34a
 
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
993e34a
437df61
993e34a
 
437df61
 
993e34a
 
 
437df61
 
 
 
 
 
 
 
993e34a
 
 
 
437df61
993e34a
 
437df61
 
 
 
 
993e34a
 
437df61
 
 
 
 
 
 
 
 
 
993e34a
437df61
 
 
 
 
 
 
 
 
 
 
 
 
7f595cd
437df61
 
 
 
 
 
 
 
7f595cd
437df61
 
 
 
 
 
f145097
 
437df61
 
f145097
 
437df61
 
 
 
eec3fb0
437df61
 
 
 
f145097
 
437df61
 
 
f145097
 
 
eec3fb0
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3773265
f145097
 
 
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f145097
 
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d38aef
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d38aef
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71f88b8
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f145097
437df61
 
 
3122991
437df61
 
 
 
f145097
437df61
 
 
 
 
 
 
993e34a
437df61
 
 
993e34a
437df61
 
 
 
 
 
 
 
 
 
 
 
993e34a
437df61
 
 
 
 
993e34a
437df61
 
993e34a
 
 
 
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f145097
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f145097
437df61
 
 
f145097
437df61
 
 
 
 
 
 
 
 
f145097
437df61
 
 
 
 
 
 
 
f145097
437df61
f145097
437df61
 
25bb60f
437df61
 
f145097
 
437df61
993e34a
f145097
437df61
 
 
 
 
 
 
f145097
437df61
 
f145097
437df61
 
 
 
f145097
25bb60f
 
437df61
f145097
437df61
 
 
eec3fb0
437df61
b0d8269
437df61
 
 
 
 
b0d8269
437df61
 
 
 
f145097
 
 
437df61
993e34a
437df61
 
 
 
 
 
 
993e34a
437df61
 
 
993e34a
 
 
437df61
 
 
 
 
f145097
eec3fb0
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f145097
 
437df61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f145097
 
eec3fb0
f145097
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
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <title>STT - Speech to Text</title>

    <!-- External Assets -->
    <script src="/static/js/tailwind.min.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Fredoka:wght@300..700&family=Caveat:wght@400..700&display=swap"
        rel="stylesheet" />
    <link
        href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&amp;display=swap"
        rel="stylesheet" />

    <!-- Tailwind Configuration -->
    <script id="tailwind-config">
        tailwind.config = {
            darkMode: "class",
            theme: {
                extend: {
                    colors: {
                        surface: "#e6f0fd",
                        "crayon-blue": "#2563eb",
                        "crayon-red": "#dc2626",
                        "crayon-green": "#16a34a",
                        "crayon-yellow": "#ca8a04",
                        "crayon-orange": "#ea580c",
                        "crayon-purple": "#7c3aed",
                        "crayon-dark": "#1A1A1A"
                    },
                    fontFamily: {
                        "fredoka": ["Fredoka", "sans-serif"],
                        "caveat": ["Caveat", "cursive"]
                    },
                    fontSize: {
                        "headline-lg": ["42px", { lineHeight: "1.1", fontWeight: "700" }],
                        "headline-md": ["28px", { lineHeight: "1.2", fontWeight: "600" }],
                        "body-lg": ["24px", { lineHeight: "1.5", fontWeight: "500" }],
                        "label-sm": ["18px", { lineHeight: "1.2", letterSpacing: "0.01em", fontWeight: "500" }],
                        "body-md": ["20px", { lineHeight: "1.5", fontWeight: "400" }]
                    }
                },
            },
        }
    </script>

    <svg height="0" style="position: absolute;" width="0">
        <filter height="120%" id="crayon-texture" width="120%" x="-10%" y="-10%">
            <feTurbulence baseFrequency="0.4" numOctaves="3" result="noise" type="fractalNoise"></feTurbulence>
            <feDisplacementMap in="SourceGraphic" in2="noise" scale="2.5" xChannelSelector="R" yChannelSelector="G">
            </feDisplacementMap>
        </filter>
        <filter height="120%" id="crayon-heavy" width="120%" x="-10%" y="-10%">
            <feTurbulence baseFrequency="0.5" numOctaves="4" result="noise" type="fractalNoise"></feTurbulence>
            <feDisplacementMap in="SourceGraphic" in2="noise" scale="4" xChannelSelector="R" yChannelSelector="G">
            </feDisplacementMap>
        </filter>
    </svg>

    <style>
        /* Sketchbook Styles */
        body {
            background-color: #e6f0fd;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
            color: #1A1A1A;
            font-family: 'Fredoka', sans-serif;
        }

        .bg-surface {
            background-color: rgb(255 255 255 / 0%) !important;
            backdrop-filter: blur(2px);
        }

        .crayon-filter {
            filter: url('#crayon-texture');
        }

        .crayon-heavy {
            filter: url('#crayon-heavy');
        }

        .crayon-border-green {
            border: 4px solid #16a34a;
            border-radius: 12px 8px 15px 10px / 8px 14px 10px 12px;
            filter: url('#crayon-texture');
        }

        .task-card {
            border: 3px solid rgba(124, 58, 237, 0.4);
            border-radius: 20px 15px 25px 18px / 18px 25px 15px 20px;
            filter: url('#crayon-texture');
        }

        .crayon-border-blue {
            border: 4px dashed #2563eb;
            border-radius: 15px 10px 12px 18px / 12px 18px 15px 10px;
            filter: url('#crayon-texture');
        }

        .crayon-border-purple {
            border: 4px solid #7c3aed;
            border-radius: 10px 16px 12px 14px / 16px 12px 14px 10px;
            filter: url('#crayon-texture');
        }

        .crayon-button {
            border: 4px solid #2563eb;
            border-radius: 12px 8px 14px 10px / 8px 14px 10px 12px;
            transition: all 0.2s ease;
            filter: url('#crayon-texture');
            cursor: pointer;
        }

        .crayon-button:hover {
            transform: scale(1.05) rotate(1deg);
            box-shadow: 6px 6px 0px 0px rgba(0, 0, 0, 0.1);
        }

        .crayon-button:hover .material-symbols-outlined.spin-on-hover {
            animation: spin 2s linear infinite;
        }

        @keyframes spin {
            from {
                transform: rotate(0deg);
            }

            to {
                transform: rotate(360deg);
            }
        }

        @keyframes drift {
            0% {
                transform: translateX(0);
            }

            50% {
                transform: translateX(20px);
            }

            100% {
                transform: translateX(0);
            }
        }

        .drift-slow {
            animation: drift 8s ease-in-out infinite;
        }

        .drift-medium {
            animation: drift 5s ease-in-out infinite;
        }

        .organic-shape {
            border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
            filter: url('#crayon-texture');
        }

        .scribble-fill-green {
            background: repeating-linear-gradient(60deg, #16a34a, #16a34a 2px, #15803d 3px, #16a34a 4px);
        }

        .progress-fill {
            background: repeating-linear-gradient(80deg, #2563eb, #2563eb 2px, #1d4ed8 3px, #2563eb 5px);
        }

        .material-symbols-outlined {
            font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 48;
            filter: url('#crayon-texture');
        }

        /* --- Modals --- */
        .modal {
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.6);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 100;
            padding: 2rem;
        }

        .modal.active {
            display: flex;
        }

        .modal-content {
            border: 4px solid #2563eb;
            width: 100%;
            max-width: 900px;
            border-radius: 24px;
            display: flex;
            flex-direction: column;
            max-height: 85vh;
            box-shadow: 12px 12px 0px 0px rgba(0, 0, 0, 0.1);
            position: relative;
        }

        .modal-sketch-bg {
            position: absolute;
            inset: -8px;
            border: 6px solid #2563eb;
            backdrop-filter: blur(10px);
            border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
            z-index: -1;
            filter: url('#crayon-texture');
            pointer-events: none;
        }

        .modal-header {
            padding: 1.5rem 2rem;
            border-bottom: 3px dashed #adc6ff;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: relative;
            z-index: 10;
        }

        .modal-body {
            padding: 2rem;
            overflow-y: auto;
            position: relative;
            z-index: 10;
        }

        #resultText,
        pre {
            border: 3px dashed #adc6ff !important;
            padding: 2rem !important;
            border-radius: 20px !important;
            font-family: 'Fredoka', sans-serif !important;
            font-size: 1.5rem !important;
            font-weight: 600 !important;
            color: #fff !important;
            white-space: pre-wrap !important;
            word-break: break-all !important;
            line-height: 1.6 !important;
            filter: url('#crayon-texture');
        }

        .close-modal {
            background: transparent;
            border: none;
            color: #dc2626;
            font-size: 3rem;
            cursor: pointer;
            font-weight: 700;
        }

        .text-headline-lg {
            filter: url('#crayon-texture');
        }

        .copy-btn {
            background: #16a34a;
            color: white;
            padding: 0.5rem 1.5rem;
            border-radius: 12px;
            font-weight: 700;
            box-shadow: 4px 4px 0px 0px #15803d;
            transition: all 0.2s;
            filter: url('#crayon-texture');
        }

        .copy-btn:hover {
            transform: translate(-2px, -2px);
            box-shadow: 6px 6px 0px 0px #15803d;
        }

        /* --- Specific UI Elements --- */
        .status-modal-content {
            max-width: 450px;
            text-align: center;
            padding: 3rem 2rem;
        }

        .status-modal-bg {
            position: absolute;
            inset: -12px;
            border: 8px solid #2563eb;
            background: #e6f0fd;
            border-radius: 20px 40px 15px 35px / 35px 15px 40px 20px;
            z-index: -1;
            filter: url('#crayon-texture');
            pointer-events: none;
        }

        .status-icon-container {
            width: 100px;
            height: 100px;
            margin: 0 auto 1.5rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 20px 15px 25px 18px / 18px 25px 15px 20px;
            border: 4px solid currentColor;
            filter: url('#crayon-texture');
            position: relative;
            z-index: 20;
        }

        .status-icon-bg {
            position: absolute;
            inset: 0;
            background: currentColor;
            opacity: 0.15;
            z-index: -1;
            border-radius: inherit;
        }

        .modal-decoration {
            position: absolute;
            pointer-events: none;
            opacity: 0.3;
            z-index: 5;
            filter: url('#crayon-texture');
        }

        .table-container::-webkit-scrollbar {
            width: 10px;
        }

        .table-container::-webkit-scrollbar-track {
            background: #f1f5f9;
            border-radius: 10px;
        }

        .table-container::-webkit-scrollbar-thumb {
            background: #cbd5e1;
            border-radius: 10px;
            border: 2px solid #f1f5f9;
        }

        .dragging {
            border-color: #16a34a !important;
            background-color: #f0fdf4 !important;
        }
    </style>
</head>

<body class="h-screen flex flex-col overflow-hidden relative">
    <!-- Main Background Decorations -->
    <div class="fixed inset-0 pointer-events-none overflow-hidden -z-10 opacity-40">
        <!-- Stars -->
        <span
            class="material-symbols-outlined absolute text-5xl text-crayon-yellow top-20 left-[10%] rotate-12 crayon-heavy animate-pulse">star</span>
        <span
            class="material-symbols-outlined absolute text-3xl text-crayon-orange top-[40%] left-[5%] -rotate-12 crayon-filter">star</span>
        <span
            class="material-symbols-outlined absolute text-4xl text-crayon-yellow bottom-[20%] left-[15%] rotate-45 animate-pulse">star</span>
        <span
            class="material-symbols-outlined absolute text-6xl text-crayon-orange top-[15%] right-[15%] rotate-[-15deg] crayon-heavy">star</span>
        <span
            class="material-symbols-outlined absolute text-3xl text-crayon-yellow bottom-[30%] right-[10%] rotate-12 animate-pulse">star</span>

        <!-- Clouds -->
        <span
            class="material-symbols-outlined absolute text-[120px] text-crayon-blue top-[10%] left-[25%] opacity-20 drift-slow">cloud</span>
        <span
            class="material-symbols-outlined absolute text-[80px] text-crayon-purple bottom-[15%] left-[40%] opacity-10 drift-medium">cloud</span>
        <span
            class="material-symbols-outlined absolute text-[100px] text-crayon-blue top-[60%] right-[25%] opacity-15 drift-slow">cloud</span>
        <span
            class="material-symbols-outlined absolute text-[150px] text-crayon-purple top-[30%] right-[5%] opacity-10 drift-medium">cloud</span>

        <!-- Hearts -->
        <span
            class="material-symbols-outlined absolute text-4xl text-crayon-red top-[25%] left-[18%] rotate-[-15deg] crayon-filter animate-pulse">favorite</span>
        <span
            class="material-symbols-outlined absolute text-2xl text-crayon-red bottom-[10%] right-[20%] rotate-12 crayon-filter">favorite</span>
        <span
            class="material-symbols-outlined absolute text-5xl text-crayon-red top-[70%] left-[8%] rotate-[10deg] animate-pulse">favorite</span>
    </div>

    <!-- SVG Filters -->
    <svg height="0" width="0" style="position: absolute;">
        <filter id="crayon-texture" x="-10%" y="-10%" width="120%" height="120%">
            <feTurbulence type="fractalNoise" baseFrequency="0.4" numOctaves="3" result="noise" />
            <feDisplacementMap in="SourceGraphic" in2="noise" scale="2.5" xChannelSelector="R" yChannelSelector="G" />
        </filter>
        <filter id="crayon-heavy" x="-10%" y="-10%" width="120%" height="120%">
            <feTurbulence type="fractalNoise" baseFrequency="0.5" numOctaves="4" result="noise" />
            <feDisplacementMap in="SourceGraphic" in2="noise" scale="4" xChannelSelector="R" yChannelSelector="G" />
        </filter>
    </svg>

    <!-- Header -->
    <header
        class="bg-surface flex justify-between items-center w-[calc(100%-48px)] mx-6 mt-6 px-8 py-5 crayon-border-green z-10 shrink-0 organic-shape shadow-sm">
        <div class="flex items-center gap-5">
            <div
                class="bg-crayon-green text-white w-14 h-14 rounded-2xl flex items-center justify-center border-[3px] border-crayon-green rotate-[-4deg] crayon-filter scribble-fill-green shadow-md">
                <span class="material-symbols-outlined text-4xl">mic</span>
            </div>
            <div class="flex flex-col -rotate-1">
                <h1 class="text-headline-lg text-[#4c1d95] leading-none mb-1">STT</h1>
                <span class="text-label-sm text-[#4b5563] font-bold">Speech to Text</span>
            </div>
        </div>

        <div class="flex items-center gap-10 relative">
            <div class="absolute -left-48 top-2 rotate-12 crayon-heavy">
                <span class="material-symbols-outlined text-4xl text-crayon-yellow">star</span>
            </div>
            <div class="absolute -left-24 top-0 -rotate-6 crayon-heavy opacity-80">
                <span class="material-symbols-outlined text-5xl text-crayon-blue">cloud</span>
            </div>
            <button id="apiDocBtn"
                class="flex items-center gap-2 text-headline-md text-crayon-purple px-8 py-3 bg-surface crayon-button rotate-1 shadow-md">
                <span class="material-symbols-outlined text-3xl">menu_book</span>
                API DOC
            </button>
            <div
                class="flex items-center gap-4 bg-surface px-6 py-3 rounded-full border-[4px] border-crayon-green organic-shape shadow-md">
                <div id="healthDot" class="w-4 h-4 rounded-full bg-crayon-green shadow-[0_0_12px_rgba(22,163,74,0.5)]">
                </div>
                <span id="healthText" class="text-headline-md text-crayon-green text-2xl">Service Online</span>
                <div class="text-crayon-orange flex items-center justify-center rotate-[15deg]">
                    <span class="material-symbols-outlined text-4xl">light_mode</span>
                </div>
            </div>
        </div>
    </header>

    <!-- Main Content -->
    <main class="flex-1 flex overflow-hidden p-8 gap-8 mx-auto w-full relative">
        <!-- Input Section -->
        <section class="w-[450px] flex flex-col gap-8">
            <div id="uploadZone"
                class="flex flex-col gap-6 p-8 bg-surface crayon-border-blue flex-1 relative organic-shape cursor-pointer group shadow-sm hover:shadow-md transition-shadow">
                <div class="flex items-center gap-4 mb-2 rotate-1">
                    <div
                        class="bg-crayon-blue text-white rounded-full w-14 h-14 flex items-center justify-center border-2 border-crayon-blue crayon-filter shadow-md">
                        <span class="material-symbols-outlined text-4xl">upload</span>
                    </div>
                    <div>
                        <h2 class="text-headline-md text-crayon-blue leading-none mb-1 flex items-center gap-2">
                            INPUT
                            <span class="material-symbols-outlined text-crayon-red text-2xl rotate-12">favorite</span>
                        </h2>
                        <p class="text-label-sm text-[#6b7280]">Upload your file</p>
                    </div>
                </div>

                <div
                    class="flex-1 flex flex-col items-center justify-center relative border-[4px] border-dashed border-[#adc6ff] rounded-[32px] bg-surface p-6 group-hover:bg-blue-50 transition-colors">
                    <div class="relative w-48 h-48 mb-8 flex items-center justify-center">
                        <div
                            class="absolute w-36 h-44 bg-blue-100 border-[3px] border-crayon-blue rounded-xl rotate-[12deg] right-4 bottom-4 organic-shape opacity-60">
                        </div>
                        <div
                            class="absolute w-36 h-44 bg-surface border-[3px] border-crayon-blue rounded-xl z-10 flex flex-col items-center p-4 organic-shape rotate-[-4deg] shadow-sm">
                            <div
                                class="w-8 h-8 rounded-full bg-crayon-yellow self-start mb-4 border-[2px] border-[#1A1A1A]">
                            </div>
                            <div class="w-full h-2 bg-[#adc6ff] rounded-full mb-3"></div>
                            <div class="w-2/3 h-2 bg-[#adc6ff] rounded-full self-start"></div>
                        </div>
                        <div
                            class="absolute -bottom-4 -right-4 bg-crayon-blue text-white rounded-full w-16 h-16 flex items-center justify-center border-[4px] border-white z-20 shadow-xl group-hover:scale-110 transition-transform rotate-12 crayon-filter">
                            <span class="material-symbols-outlined text-4xl">arrow_upward</span>
                        </div>
                    </div>
                    <p class="text-headline-md text-[#1A1A1A] mb-1 font-bold">Drag & drop here</p>
                    <p class="text-label-sm text-crayon-purple mb-8 font-bold">or click to browse</p>
                    <div class="flex gap-2 mt-auto w-full justify-center flex-wrap">
                        <span
                            class="px-4 py-1.5 bg-surface border-[2px] border-crayon-blue text-crayon-blue text-lg font-bold rounded-xl organic-shape -rotate-2">WAV</span>
                        <span
                            class="px-4 py-1.5 bg-surface border-[2px] border-crayon-green text-crayon-green text-lg font-bold rounded-xl organic-shape rotate-1">MP3</span>
                        <span
                            class="px-4 py-1.5 bg-surface border-[2px] border-crayon-red text-crayon-red text-lg font-bold rounded-xl organic-shape -rotate-1">FLAC</span>
                    </div>
                </div>
                <input type="file" id="fileInput" hidden accept="audio/*">
            </div>
        </section>

        <!-- Activity Section -->
        <section
            class="flex-1 flex flex-col bg-surface crayon-border-purple p-8 relative organic-shape overflow-hidden shadow-sm">
            <div class="flex items-center justify-between mb-8">
                <div class="flex items-center gap-4 rotate-1">
                    <div
                        class="bg-crayon-purple text-white rounded-full w-14 h-14 flex items-center justify-center border-[3px] border-crayon-purple shadow-md">
                        <span class="material-symbols-outlined text-4xl">schedule</span>
                    </div>
                    <div>
                        <h2 class="text-headline-lg text-[#4c1d95] leading-none mb-1">ACTIVITY</h2>
                        <p class="text-label-sm text-[#6b7280] font-bold">Recent tasks</p>
                    </div>
                </div>
                <div class="relative w-40 h-20 flex items-center">
                    <svg class="absolute left-[-30px] top-4 w-32 h-16 crayon-filter text-crayon-yellow" fill="none"
                        stroke="currentColor" stroke-dasharray="6 6" stroke-linecap="round" stroke-width="3"
                        viewBox="0 0 100 50">
                        <path d="M10,40 Q40,50 60,30 T90,10" />
                    </svg>
                    <span
                        class="material-symbols-outlined text-5xl text-crayon-orange absolute right-0 top-0 rotate-12">send</span>
                </div>
                <button onclick="loadTasks()"
                    class="flex items-center gap-2 text-headline-md text-crayon-blue px-8 py-3 bg-surface crayon-button border-[4px] -rotate-1 shadow-md">
                    <span class="material-symbols-outlined text-3xl spin-on-hover">sync</span>
                    Refresh
                </button>
            </div>

            <!-- List Header -->
            <div class="flex w-full px-6 pb-4 border-b-[5px] text-[#4c1d95] font-bold text-xl uppercase tracking-wider"
                style="border-color: rgba(124, 58, 237, 0.4); border-radius: 20px 15px 25px 18px / 18px 25px 15px 20px; filter: url(#crayon-texture);">
                <div class="w-1/2">CONTENT</div>
                <div class="w-1/6 text-center">STATUS</div>
                <div class="w-1/4 text-center">PROGRESS</div>
                <div class="w-[10%] text-center">ACTION</div>
            </div>

            <!-- Task List Body -->
            <div id="queueBody" class="flex flex-col gap-5 mt-6 overflow-y-auto flex-1 table-container pr-4">
                <div class="text-center py-32 text-headline-md text-[#94a3b8] font-bold opacity-60">No tasks found
                    yet...</div>
            </div>
        </section>
    </main>

    <!-- Modals -->
    <!-- Result & API Modal -->
    <div id="resultModal" class="modal">
        <div class="modal-content">
            <div class="modal-sketch-bg"></div>

            <!-- Decorations -->
            <span
                class="material-symbols-outlined modal-decoration text-6xl text-crayon-yellow top-4 left-4 -rotate-12">star</span>
            <span
                class="material-symbols-outlined modal-decoration text-8xl text-crayon-blue top-12 right-20 opacity-20">cloud</span>
            <span
                class="material-symbols-outlined modal-decoration text-4xl text-crayon-orange bottom-10 left-10 rotate-45">star</span>
            <span
                class="material-symbols-outlined modal-decoration text-7xl text-crayon-purple bottom-4 right-4 -rotate-6 opacity-40">cloud</span>

            <div class="modal-header">
                <div class="flex items-center gap-6">
                    <span id="modalTitle" class="text-headline-lg text-[#1e1b4b]">Transcription Result</span>
                    <button id="copyBtn" onclick="copyResult()" class="copy-btn">📋 Copy Text</button>
                </div>
                <button class="close-modal" onclick="closeModal()">&times;</button>
            </div>
            <div class="modal-body">
                <pre id="resultText"></pre>
            </div>
        </div>
    </div>

    <!-- Status Modal -->
    <div id="statusModal" class="modal">
        <div class="modal-content status-modal-content">
            <div id="statusBg" class="status-modal-bg"></div>

            <span
                class="material-symbols-outlined modal-decoration text-4xl text-crayon-yellow top-6 right-6 rotate-12">star</span>
            <span
                class="material-symbols-outlined modal-decoration text-6xl text-crayon-blue top-10 left-4 opacity-30">cloud</span>
            <span
                class="material-symbols-outlined modal-decoration text-3xl text-crayon-orange bottom-8 right-10 -rotate-12">star</span>
            <span
                class="material-symbols-outlined modal-decoration text-5xl text-crayon-purple bottom-10 left-8 rotate-6 opacity-30">cloud</span>

            <div id="statusIconContainer" class="status-icon-container text-crayon-blue">
                <div class="status-icon-bg"></div>
                <span id="statusIcon" class="material-symbols-outlined text-6xl animate-bounce">upload</span>
            </div>
            <h2 id="statusMessage" class="text-headline-lg text-crayon-blue mb-2">Uploading...</h2>
            <p id="statusSubMessage" class="text-body-lg text-[#4b5563]">Processing your request, please wait.</p>
        </div>
    </div>

    <!-- Application Logic -->
    <script>
        // --- Configuration ---
        const API_BASE = '/api';

        // --- DOM Elements ---
        const UI = {
            uploadZone: document.getElementById('uploadZone'),
            fileInput: document.getElementById('fileInput'),
            queueBody: document.getElementById('queueBody'),
            resultModal: document.getElementById('resultModal'),
            statusModal: document.getElementById('statusModal'),
            resultText: document.getElementById('resultText'),
            modalTitle: document.getElementById('modalTitle'),
            statusMessage: document.getElementById('statusMessage'),
            statusSubMessage: document.getElementById('statusSubMessage'),
            statusIcon: document.getElementById('statusIcon'),
            statusIconContainer: document.getElementById('statusIconContainer'),
            statusBg: document.getElementById('statusBg'),
            healthDot: document.getElementById('healthDot'),
            healthText: document.getElementById('healthText'),
            apiDocBtn: document.getElementById('apiDocBtn')
        };

        // --- UI Helpers ---
        function updateStatusModal(type, msg, subMsg) {
            UI.statusMessage.innerText = msg;
            UI.statusSubMessage.innerText = subMsg || "Processing your request, please wait.";
            UI.statusIconContainer.className = "status-icon-container";
            UI.statusIcon.className = "material-symbols-outlined text-6xl";
            UI.statusBg.style.borderColor = "";

            if (type === 'uploading') {
                UI.statusIconContainer.classList.add('text-crayon-blue');
                UI.statusIcon.innerText = "upload";
                UI.statusIcon.classList.add('animate-bounce');
                UI.statusBg.style.borderColor = "#2563eb";
            } else if (type === 'success') {
                UI.statusIconContainer.classList.add('text-crayon-green');
                UI.statusIcon.innerText = "check_circle";
                UI.statusBg.style.borderColor = "#16a34a";
            } else if (type === 'error') {
                UI.statusIconContainer.classList.add('text-crayon-red');
                UI.statusIcon.innerText = "error";
                UI.statusBg.style.borderColor = "#dc2626";
            }
        }

        function closeModal() {
            UI.resultModal.classList.remove('active');
        }

        function copyResult() {
            const text = UI.resultText.innerText;
            const btn = document.getElementById('copyBtn');
            navigator.clipboard.writeText(text).then(() => {
                const orig = btn.innerText;
                btn.innerText = '✓ Copied!';
                setTimeout(() => { btn.innerText = orig; }, 2000);
            });
        }

        // --- API Functions ---
        async function loadTasks() {
            try {
                const res = await fetch(`${API_BASE}/tasks`);
                const data = await res.json();
                renderQueue(data);
            } catch (err) {
                console.error("Load tasks error:", err);
            }
        }

        async function handleFile(file) {
            if (!file) return;

            UI.statusModal.classList.add('active');
            updateStatusModal('uploading', "Uploading...", "Sending file to server...");

            const formData = new FormData();
            formData.append('audio', file);

            try {
                const res = await fetch(`${API_BASE}/tasks/upload`, { method: 'POST', body: formData });
                if (res.ok) {
                    updateStatusModal('success', "Success! ✨", "File uploaded and task created.");
                    setTimeout(() => {
                        UI.statusModal.classList.remove('active');
                        loadTasks();
                    }, 1200);
                } else {
                    updateStatusModal('error', "Upload Failed ❌", "Something went wrong on our end.");
                    setTimeout(() => UI.statusModal.classList.remove('active'), 2000);
                }
            } catch (err) {
                console.error("Upload error:", err);
                updateStatusModal('error', "Connection Error ⚠️", "Could not reach the server.");
                setTimeout(() => UI.statusModal.classList.remove('active'), 2000);
            }
        }

        async function showResult(id) {
            try {
                const res = await fetch(`${API_BASE}/tasks/${id}`);
                const data = await res.json();
                const text = data.result;

                UI.modalTitle.innerText = "Transcription Result";

                let formatted = text;
                try {
                    const parsed = JSON.parse(text);
                    formatted = JSON.stringify(parsed, null, 2);
                } catch (e) { /* Not JSON, use raw text */ }

                UI.resultText.innerText = formatted;
                UI.resultModal.classList.add('active');
            } catch (err) {
                console.error("Show result error:", err);
            }
        }

        async function checkHealth() {
            try {
                const res = await fetch('/health');
                const data = await res.json();
                const healthy = data.status === 'healthy';

                UI.healthDot.className = `w-4 h-4 rounded-full ${healthy ? 'bg-crayon-green' : 'bg-crayon-red'} shadow-md`;
                UI.healthText.innerText = healthy ? 'Service Online' : 'Service Down';
                UI.healthText.className = `text-headline-md font-bold ${healthy ? 'text-crayon-green' : 'text-crayon-red'}`;
            } catch (e) {
                UI.healthDot.className = 'w-4 h-4 rounded-full bg-crayon-red shadow-md';
                UI.healthText.innerText = 'Connection Error';
                UI.healthText.className = 'text-headline-md font-bold text-crayon-red';
            }
        }

        // --- Renderers ---
        function renderQueue(tasks) {
            if (tasks.length === 0) {
                UI.queueBody.innerHTML = '<div class="text-center py-32 text-headline-md text-[#94a3b8] font-bold opacity-60">No tasks found yet...</div>';
                return;
            }

            UI.queueBody.innerHTML = tasks.map((t, i) => {
                const rotate = i % 2 === 0 ? 'rotate-[0.3deg]' : '-rotate-[0.3deg]';
                const status = t.status.toLowerCase();
                const colors = {
                    completed: { text: 'crayon-green', bg: 'bg-[#f0fdf4]' },
                    failed: { text: 'crayon-red', bg: 'bg-[#fef2f2]' },
                    processing: { text: 'crayon-blue', bg: 'bg-[#eff6ff]' },
                    pending: { text: 'crayon-purple', bg: 'bg-[#f5f3ff]' }
                };
                const theme = colors[status] || colors.pending;

                return `
                    <div class="task-card flex items-center p-6 bg-surface hover:border-crayon-purple transition-colors shadow-sm ${rotate}">
                        <div class="flex items-center gap-5 w-1/2">
                            <div class="w-16 h-20 border-[3px] border-crayon-blue rounded-xl p-2 bg-surface flex shadow-sm organic-shape rotate-[-3deg]">
                                <div class="w-1/2 h-full border-r-[2px] border-[#adc6ff] flex flex-col gap-1.5 p-0.5">
                                    <div class="w-full h-2 bg-[#adc6ff] rounded-sm"></div>
                                    <div class="w-full h-2 bg-[#adc6ff] rounded-sm"></div>
                                    <div class="w-full h-2 bg-[#adc6ff] rounded-sm"></div>
                                </div>
                                <div class="w-1/2 h-full flex flex-col gap-1.5 p-0.5 relative">
                                    <div class="w-full h-2 bg-[#adc6ff] rounded-sm"></div>
                                    <div class="mt-auto flex gap-1.5 bottom-1 absolute">
                                        <div class="w-2.5 h-2.5 bg-crayon-yellow rounded-sm"></div>
                                        <div class="w-2.5 h-2.5 bg-crayon-green rounded-sm"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="flex flex-col">
                                <span class="text-headline-md text-[#1A1A1A] leading-tight font-bold mb-1">${t.filename}</span>
                                <div class="text-label-sm text-[#94a3b8] font-bold">${t.id.substring(0, 12)}</div>
                            </div>
                        </div>
                        <div class="w-1/6 flex justify-center">
                            <div class="px-4 py-2 ${theme.bg} border-[3px] border-${theme.text} text-${theme.text} font-bold rounded-2xl uppercase tracking-tight crayon-filter">
                                ${status.replace('_', ' ')}
                            </div>
                        </div>
                        <div class="w-1/4 flex items-center justify-center gap-4">
                            <div class="flex-1 h-6 border-[3px] border-[#adc6ff] rounded-full overflow-hidden bg-surface p-[2px] crayon-filter">
                                <div class="h-full rounded-full progress-fill shadow-sm" style="width:${t.progress}%"></div>
                            </div>
                            <span class="text-headline-md text-2xl text-[#1A1A1A] font-bold w-12 text-right">${status === 'completed' ? '' : t.progress + '%'}</span>
                        </div>
                        <div class="w-[10%] flex justify-center">
                            ${status === 'completed' ? `
                                <button onclick="showResult('${t.id}')" class="flex items-center gap-2 px-5 py-2.5 bg-white border-[3px] border-crayon-blue text-crayon-blue font-bold rounded-2xl hover:bg-crayon-blue hover:text-white transition-all shadow-sm crayon-filter">
                                    <span class="material-symbols-outlined text-2xl">visibility</span>
                                    VIEW
                                </button>
                            ` : '—'}
                        </div>
                    </div>
                `;
            }).join('');
        }

        // --- Event Listeners ---
        UI.uploadZone.onclick = () => UI.fileInput.click();
        UI.uploadZone.ondragover = (e) => { e.preventDefault(); UI.uploadZone.classList.add('dragging'); };
        UI.uploadZone.ondragleave = () => UI.uploadZone.classList.remove('dragging');
        UI.uploadZone.ondrop = (e) => {
            e.preventDefault();
            UI.uploadZone.classList.remove('dragging');
            handleFile(e.dataTransfer.files[0]);
        };
        UI.fileInput.onchange = (e) => handleFile(e.target.files[0]);
        UI.apiDocBtn.onclick = () => {
            const doc = {
                base_url: window.location.origin,
                endpoints: [
                    { method: "POST", path: "/api/tasks/upload", desc: "Upload audio for STT" },
                    { method: "GET", path: "/api/tasks", desc: "List all tasks" },
                    { method: "GET", path: "/api/tasks/{task_id}", desc: "Get STT result" },
                    { method: "GET", path: "/health", desc: "Service health" }
                ],
                example_usage: `curl -X POST -F 'audio=@file.wav' ${window.location.origin}/api/tasks/upload`
            };
            UI.resultText.innerText = JSON.stringify(doc, null, 2);
            UI.modalTitle.innerText = "API Documentation";
            UI.resultModal.classList.add('active');
        };

        // --- Lifecycle ---
        loadTasks();
        setInterval(loadTasks, 5000);
        setInterval(checkHealth, 10000);
    </script>
</body>

</html>