YugJ commited on
Commit
e684a7a
·
verified ·
1 Parent(s): 32ecc14

Upload styles.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. styles.py +430 -0
styles.py ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Stylesheet for the interface.
2
+
3
+ Design notes, so future edits do not quietly undo the reasoning:
4
+
5
+ * Aurora over void. A near-black indigo ground with three slow colour fields
6
+ bleeding across it. Flat #111 with one grey border on everything is what
7
+ made the earlier pass read as bland.
8
+ * Panels are glass: translucent fill, blurred backdrop, a bright top hairline
9
+ to catch the light. Depth comes from light, not from outlines.
10
+ * Three saturated hues carry meaning and nothing else does - cyan is always
11
+ Python, amber is always the compiled target, violet is the one action that
12
+ costs something. Colour as a code, not decoration.
13
+ * Timing rows are CSS grid with a dedicated numeral column and a separate unit
14
+ column, so decimal points align down the stack. Right-aligning "24.739 s"
15
+ against "337.20 ms" as whole strings makes the digits jitter.
16
+ * Radii are generous and consistent: 22px panels, 16px controls, pills for
17
+ buttons.
18
+ """
19
+
20
+ CSS = """
21
+ :root {
22
+ --void: #06040f;
23
+ --ink: #0b0818;
24
+
25
+ --glass: rgba(28, 24, 48, .55);
26
+ --glass-2: rgba(38, 33, 64, .58);
27
+ --glass-3: rgba(50, 44, 82, .5);
28
+ --edge: rgba(160, 140, 255, .13);
29
+ --edge-lit: rgba(190, 175, 255, .28);
30
+
31
+ --text: #f0ecff;
32
+ --text-dim: #a49dc4;
33
+ --text-faint: #6f6892;
34
+
35
+ --py: #22d3ee;
36
+ --py-deep: #0e9bb8;
37
+ --target: #fb923c;
38
+ --target-deep: #ea6f18;
39
+ --accent: #a855f7;
40
+ --accent-2: #ec4899;
41
+
42
+ --ok: #34d399;
43
+ --warn: #fbbf24;
44
+ --err: #fb7185;
45
+
46
+ --r-xl: 24px;
47
+ --r-lg: 18px;
48
+ --r-md: 14px;
49
+ --r-sm: 10px;
50
+ }
51
+
52
+ /* ---------- ground ---------- */
53
+
54
+ .gradio-container {
55
+ max-width: 1520px !important;
56
+ margin: 0 auto !important;
57
+ padding: 0 30px 60px !important;
58
+ color: var(--text) !important;
59
+ background:
60
+ radial-gradient(1200px 620px at 8% -12%, rgba(34,211,238,.15), transparent 60%),
61
+ radial-gradient(1000px 560px at 96% -4%, rgba(168,85,247,.18), transparent 58%),
62
+ radial-gradient(1100px 700px at 52% 108%, rgba(236,72,153,.10), transparent 62%),
63
+ linear-gradient(178deg, var(--ink), var(--void) 70%) !important;
64
+ background-attachment: fixed !important;
65
+ }
66
+
67
+ .gradio-container .prose,
68
+ .gradio-container .prose * { color: var(--text); }
69
+
70
+ /* Neutralise Gradio's own block chrome; our panels carry the structure. */
71
+ .gradio-container .block,
72
+ .gradio-container .form {
73
+ background: transparent !important;
74
+ border-color: var(--edge) !important;
75
+ border-radius: var(--r-lg) !important;
76
+ }
77
+
78
+ /* ---------- masthead ---------- */
79
+
80
+ .masthead { padding: 44px 0 26px; }
81
+ .masthead h1 {
82
+ margin: 0 0 13px;
83
+ font-size: clamp(1.75rem, 3.2vw, 2.45rem);
84
+ font-weight: 800;
85
+ letter-spacing: -0.035em;
86
+ line-height: 1.08;
87
+ }
88
+ /* display:inline-block is required - an inline span has a fragmented
89
+ background box, so background-clip:text clips against nothing and the
90
+ transparent fill renders the word invisible. */
91
+ .masthead h1 .py,
92
+ .masthead h1 .rs {
93
+ display: inline-block;
94
+ -webkit-background-clip: text; background-clip: text;
95
+ -webkit-text-fill-color: transparent;
96
+ color: var(--py); /* fallback if background-clip is unsupported */
97
+ }
98
+ .masthead h1 .py { background-image: linear-gradient(92deg, #67e8f9, var(--py)); }
99
+ .masthead h1 .rs {
100
+ background-image: linear-gradient(92deg, var(--target), #f472b6);
101
+ color: var(--target);
102
+ }
103
+ .masthead h1 .arrow { color: var(--text-faint); font-weight: 300; margin: 0 10px; }
104
+ .masthead p {
105
+ margin: 0;
106
+ color: var(--text-dim);
107
+ font-size: 1.03rem;
108
+ max-width: 68ch;
109
+ line-height: 1.62;
110
+ }
111
+ .masthead .links { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
112
+ .masthead .links a {
113
+ font-size: .84rem;
114
+ font-weight: 500;
115
+ color: var(--text-dim);
116
+ text-decoration: none;
117
+ border: 1px solid var(--edge);
118
+ background: var(--glass);
119
+ backdrop-filter: blur(12px);
120
+ border-radius: 999px;
121
+ padding: 8px 17px;
122
+ transition: all .2s cubic-bezier(.22,1,.36,1);
123
+ }
124
+ .masthead .links a:hover {
125
+ color: #fff;
126
+ border-color: var(--edge-lit);
127
+ background: rgba(168,85,247,.18);
128
+ transform: translateY(-1px);
129
+ box-shadow: 0 6px 20px -8px rgba(168,85,247,.7);
130
+ }
131
+
132
+ /* ---------- glass panel base ---------- */
133
+
134
+ .verdict,
135
+ .picker > *,
136
+ .gradio-container .accordion,
137
+ .gradio-container details {
138
+ background: var(--glass) !important;
139
+ backdrop-filter: blur(16px) saturate(140%);
140
+ -webkit-backdrop-filter: blur(16px) saturate(140%);
141
+ border: 1px solid var(--edge) !important;
142
+ box-shadow:
143
+ 0 1px 0 rgba(255,255,255,.07) inset,
144
+ 0 24px 60px -34px rgba(0,0,0,.95);
145
+ }
146
+
147
+ /* ---------- verdict ---------- */
148
+
149
+ .verdict {
150
+ border-radius: var(--r-xl) !important;
151
+ padding: 24px 30px;
152
+ margin-bottom: 22px;
153
+ position: relative;
154
+ overflow: hidden;
155
+ }
156
+ /* a thin lit seam across the top edge */
157
+ .verdict::before {
158
+ content: "";
159
+ position: absolute; inset: 0 0 auto 0; height: 1px;
160
+ background: linear-gradient(90deg, transparent, var(--edge-lit) 22%,
161
+ rgba(236,72,153,.4) 52%, var(--edge-lit) 78%, transparent);
162
+ }
163
+ .verdict:has(.idle) { padding: 17px 26px; }
164
+ .verdict .idle {
165
+ color: var(--text-faint);
166
+ font-size: .9rem;
167
+ margin: 0;
168
+ text-align: center;
169
+ }
170
+
171
+ .verdict-grid {
172
+ display: grid;
173
+ grid-template-columns: auto minmax(280px, 1fr) auto;
174
+ align-items: center;
175
+ gap: 36px;
176
+ }
177
+
178
+ .speedup {
179
+ font-size: clamp(2.6rem, 4.8vw, 3.5rem);
180
+ font-weight: 900;
181
+ line-height: .92;
182
+ letter-spacing: -0.05em;
183
+ background: linear-gradient(96deg, var(--target) 4%, var(--accent-2) 52%, var(--accent) 96%);
184
+ -webkit-background-clip: text; background-clip: text;
185
+ -webkit-text-fill-color: transparent;
186
+ white-space: nowrap;
187
+ filter: drop-shadow(0 4px 18px rgba(236,72,153,.35));
188
+ }
189
+ .speedup-label {
190
+ font-size: .68rem;
191
+ text-transform: uppercase;
192
+ letter-spacing: .15em;
193
+ color: var(--text-faint);
194
+ margin-top: 10px;
195
+ -webkit-text-fill-color: var(--text-faint);
196
+ }
197
+
198
+ /* Grid, not flex - guarantees the digits line up between rows. */
199
+ .timing-row {
200
+ display: grid;
201
+ grid-template-columns: 66px 1fr 78px 30px;
202
+ align-items: center;
203
+ gap: 14px;
204
+ margin-bottom: 12px;
205
+ font-size: .87rem;
206
+ }
207
+ .timing-row:last-child { margin-bottom: 0; }
208
+ .timing-row .name { color: var(--text-dim); }
209
+ .timing-row .bar-track {
210
+ display: block; /* spans are inline; height would be dropped */
211
+ height: 11px;
212
+ background: rgba(255,255,255,.055);
213
+ border-radius: 999px;
214
+ overflow: hidden;
215
+ box-shadow: 0 1px 2px rgba(0,0,0,.4) inset;
216
+ }
217
+ .timing-row .bar {
218
+ display: block; /* same reason - the fill would never paint */
219
+ height: 100%;
220
+ min-width: 5px;
221
+ border-radius: 999px;
222
+ transition: width .6s cubic-bezier(.22,1,.36,1);
223
+ }
224
+ .timing-row.py .bar {
225
+ background: linear-gradient(90deg, var(--py-deep), var(--py));
226
+ box-shadow: 0 0 14px rgba(34,211,238,.55);
227
+ }
228
+ .timing-row.target .bar {
229
+ background: linear-gradient(90deg, var(--target-deep), var(--target));
230
+ box-shadow: 0 0 14px rgba(251,146,60,.6);
231
+ }
232
+ .timing-row .num {
233
+ text-align: right;
234
+ font-variant-numeric: tabular-nums;
235
+ font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
236
+ color: var(--text);
237
+ }
238
+ .timing-row .unit {
239
+ text-align: left;
240
+ font-size: .78rem;
241
+ color: var(--text-faint);
242
+ font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
243
+ }
244
+
245
+ .badge {
246
+ display: inline-flex;
247
+ align-items: center;
248
+ gap: 8px;
249
+ font-size: .81rem;
250
+ font-weight: 600;
251
+ padding: 10px 18px;
252
+ border-radius: 999px;
253
+ white-space: nowrap;
254
+ backdrop-filter: blur(8px);
255
+ }
256
+ .badge.match {
257
+ background: rgba(52,211,153,.14); color: var(--ok);
258
+ border: 1px solid rgba(52,211,153,.36);
259
+ box-shadow: 0 0 22px -6px rgba(52,211,153,.5);
260
+ }
261
+ .badge.mismatch {
262
+ background: rgba(251,113,133,.14); color: var(--err);
263
+ border: 1px solid rgba(251,113,133,.36);
264
+ box-shadow: 0 0 22px -6px rgba(251,113,133,.5);
265
+ }
266
+ .badge.unknown {
267
+ background: rgba(251,191,36,.13); color: var(--warn);
268
+ border: 1px solid rgba(251,191,36,.34);
269
+ }
270
+
271
+ /* ---------- picker row ---------- */
272
+
273
+ /* Gradio renders Row children flush, which reads as one bar sliced by seams.
274
+ Separate cards are most of the difference between designed and default. */
275
+ .picker { gap: 15px !important; background: transparent !important; border: none !important; }
276
+ .picker > * {
277
+ border-radius: var(--r-lg) !important;
278
+ padding: 6px 8px 8px !important;
279
+ transition: border-color .2s ease, box-shadow .2s ease;
280
+ }
281
+ .picker > *:focus-within {
282
+ border-color: rgba(168,85,247,.55) !important;
283
+ box-shadow: 0 0 0 3px rgba(168,85,247,.13), 0 24px 60px -34px rgba(0,0,0,.95) !important;
284
+ }
285
+ .picker .block, .picker .form {
286
+ background: transparent !important; border: none !important; box-shadow: none !important;
287
+ }
288
+ .picker input, .picker .wrap { border-radius: var(--r-md) !important; }
289
+ .picker span[data-testid="block-info"],
290
+ .picker label > span,
291
+ .picker label span {
292
+ font-size: .71rem !important;
293
+ text-transform: uppercase !important;
294
+ letter-spacing: .13em !important;
295
+ color: var(--text-faint) !important;
296
+ font-weight: 700 !important;
297
+ }
298
+
299
+ .status-line { font-size: .86rem; color: var(--text-dim); margin: 6px 0 18px; padding-left: 3px; }
300
+ .status-line strong { color: var(--py); font-weight: 600; }
301
+
302
+ /* ---------- code panes ---------- */
303
+
304
+ .pane .block { border-radius: var(--r-xl) !important; overflow: hidden; }
305
+ .pane .cm-editor, .pane textarea {
306
+ background: rgba(10,8,22,.72) !important;
307
+ border-radius: var(--r-xl) !important;
308
+ }
309
+ .pane label span { font-weight: 600 !important; }
310
+
311
+ /* ---------- outputs ---------- */
312
+
313
+ .out-box textarea {
314
+ font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace !important;
315
+ font-size: .845rem !important;
316
+ line-height: 1.62 !important;
317
+ border-radius: var(--r-lg) !important;
318
+ background: rgba(10,8,22,.72) !important;
319
+ backdrop-filter: blur(8px);
320
+ }
321
+ .py-out textarea {
322
+ border: 1px solid rgba(34,211,238,.3) !important;
323
+ color: #a5f3fc !important;
324
+ box-shadow: 0 0 26px -12px rgba(34,211,238,.6) !important;
325
+ }
326
+ .rust-out textarea {
327
+ border: 1px solid rgba(251,146,60,.3) !important;
328
+ color: #fed7aa !important;
329
+ box-shadow: 0 0 26px -12px rgba(251,146,60,.6) !important;
330
+ }
331
+
332
+ /* ---------- controls ---------- */
333
+
334
+ .controls { gap: 14px !important; align-items: stretch !important; margin: 8px 0 6px; }
335
+
336
+ /* elem_classes lands on the <button> for Buttons but a wrapper <div> for most
337
+ other components, so both are matched. */
338
+ .btn-convert, .btn-convert button {
339
+ background-image: linear-gradient(96deg, var(--accent) 0%, var(--accent-2) 100%) !important;
340
+ color: #fff !important;
341
+ font-weight: 700 !important;
342
+ border: none !important;
343
+ border-radius: 999px !important;
344
+ padding: 14px 24px !important;
345
+ letter-spacing: .012em;
346
+ box-shadow: 0 8px 28px -10px rgba(192,60,190,.9),
347
+ 0 1px 0 rgba(255,255,255,.22) inset !important;
348
+ transition: transform .18s cubic-bezier(.22,1,.36,1), box-shadow .18s ease, filter .18s ease;
349
+ }
350
+ .btn-convert:hover, .btn-convert button:hover {
351
+ filter: brightness(1.12) saturate(1.1);
352
+ transform: translateY(-2px);
353
+ box-shadow: 0 14px 36px -10px rgba(192,60,190,1),
354
+ 0 1px 0 rgba(255,255,255,.3) inset !important;
355
+ }
356
+ .btn-convert:active, .btn-convert button:active { transform: translateY(0); }
357
+
358
+ .btn-run, .btn-run button {
359
+ background: var(--glass-2) !important;
360
+ background-image: none !important;
361
+ backdrop-filter: blur(12px);
362
+ color: var(--text) !important;
363
+ border: 1px solid var(--edge) !important;
364
+ border-radius: 999px !important;
365
+ padding: 14px 24px !important;
366
+ font-weight: 600 !important;
367
+ transition: all .18s cubic-bezier(.22,1,.36,1);
368
+ }
369
+ .btn-run.py:hover, .btn-run.py button:hover {
370
+ border-color: var(--py) !important; color: var(--py) !important;
371
+ background: rgba(34,211,238,.13) !important;
372
+ box-shadow: 0 8px 26px -12px rgba(34,211,238,.9) !important;
373
+ transform: translateY(-2px);
374
+ }
375
+ .btn-run.rust:hover, .btn-run.rust button:hover {
376
+ border-color: var(--target) !important; color: var(--target) !important;
377
+ background: rgba(251,146,60,.13) !important;
378
+ box-shadow: 0 8px 26px -12px rgba(251,146,60,.9) !important;
379
+ transform: translateY(-2px);
380
+ }
381
+ .btn-run[disabled], .btn-run button[disabled] {
382
+ opacity: .35 !important; cursor: not-allowed !important; transform: none !important;
383
+ }
384
+
385
+ /* ---------- key panel ---------- */
386
+
387
+ .gradio-container .accordion,
388
+ .gradio-container details { border-radius: var(--r-lg) !important; }
389
+ .keybox, .keybox input {
390
+ border-radius: var(--r-md) !important;
391
+ background: rgba(10,8,22,.6) !important;
392
+ }
393
+ .key-note { font-size: .855rem; color: var(--text-dim); line-height: 1.68; }
394
+ .key-note strong { color: var(--text); }
395
+ .key-note code {
396
+ background: var(--glass-3); padding: 2px 7px;
397
+ border-radius: var(--r-sm); font-size: .93em;
398
+ }
399
+
400
+ /* ---------- footer ---------- */
401
+
402
+ .footer {
403
+ margin-top: 40px; padding-top: 26px;
404
+ border-top: 1px solid var(--edge);
405
+ color: var(--text-faint);
406
+ font-size: .82rem; line-height: 1.78;
407
+ }
408
+ .footer strong { color: var(--text-dim); }
409
+ .footer code {
410
+ background: var(--glass-3); padding: 2px 7px;
411
+ border-radius: var(--r-sm); color: var(--text-dim);
412
+ }
413
+
414
+ /* Gradio's own footer advertises Gradio; the project's footer replaces it. */
415
+ footer { display: none !important; }
416
+
417
+ @media (prefers-reduced-motion: reduce) {
418
+ * { transition: none !important; animation: none !important; }
419
+ }
420
+
421
+ @media (max-width: 980px) {
422
+ .verdict-grid { grid-template-columns: 1fr; gap: 20px; }
423
+ .badge-cell { justify-self: start; }
424
+ }
425
+ @media (max-width: 880px) {
426
+ .gradio-container { padding: 0 15px 40px !important; }
427
+ .verdict { padding: 20px; }
428
+ .timing-row { grid-template-columns: 56px 1fr 66px 26px; gap: 10px; }
429
+ }
430
+ """