File size: 7,752 Bytes
71e4446
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
/* ─────────────────────────────────────────────────────────────────────────
 * Floating panels: tool-call input area + HTML preview modal.
 *
 * #tool-area lives inside the Gradio tree, so it still needs !important to
 * win the cascade against framework styles.
 *
 * .html-preview-* lives directly under <body> (appended by static/app.js)
 * so it can use plain specificity.
 * ───────────────────────────────────────────────────────────────────────── */

/* ── tool area (inside Gradio) ─────────────────────────────────────────── */
#tool-area {
    position: fixed !important;
    bottom: 120px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: min(600px, 55%) !important;
    z-index: 999 !important;
    background: var(--hy-bg) !important;
    border: 1px solid var(--hy-border) !important;
    border-radius: 12px !important;
    padding: 16px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08) !important;
}
.dark #tool-area {
    background: var(--hy-bg-soft) !important;
    border-color: var(--hy-border) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5) !important;
}
.dark #tool-area *:not(button):not(button *) {
    background: transparent !important;
    border-color: var(--hy-border-strong) !important;
}
.dark #tool-area textarea,
.dark #tool-area input[type="text"] {
    background: var(--hy-bg-muted) !important;
    color: var(--hy-text) !important;
    border: 1px solid var(--hy-border-strong) !important;
}
.dark #tool-area textarea::placeholder,
.dark #tool-area input[type="text"]::placeholder {
    color: var(--hy-text-muted) !important;
}

/* ── Code-block card (header w/ language label + copy button) ──────────
 *
 * Each fenced code block is wrapped by static/app.js:
 *
 *   <div class="hy-codeblock">
 *     <div class="hy-codeblock-header">
 *       <span class="hy-codeblock-lang">python</span>
 *       <button class="code-copy-btn">…</button>
 *     </div>
 *     <pre><code class="hljs language-…">…</code></pre>
 *   </div>
 *
 * The wrapper owns the rounded border and background so the inner <pre>
 * can be flush with the header (no double border / gap). */
#hy-chat .hy-codeblock {
    margin: 0.9em 0;
    border: 1px solid var(--hy-border);
    border-radius: 10px;
    overflow: hidden;
    background: #f6f7f9;
}
.dark #hy-chat .hy-codeblock {
    border-color: #2a2a2a;
    background: #0f1115;
}

#hy-chat .hy-codeblock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px 6px 14px;
    background: #ececef;
    border-bottom: 1px solid var(--hy-border);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    line-height: 1;
    color: #6b6b6b;
    user-select: none;
}
.dark #hy-chat .hy-codeblock-header {
    background: #1a1d22;
    border-bottom-color: #262a30;
    color: #9ca3af;
}

#hy-chat .hy-codeblock-lang {
    text-transform: lowercase;
    letter-spacing: 0.02em;
    font-weight: 500;
}
#hy-chat .hy-codeblock-lang:empty::before {
    content: "text";
    opacity: 0.7;
}

/* Strip the standalone <pre> chrome from _misc.css when nested in a
 * .hy-codeblock — the wrapper provides the border/radius/background. */
#hy-chat .hy-codeblock pre {
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 12px 16px !important;
}

/* Copy button — lives in the header, simple icon button. */
#hy-chat .hy-codeblock-header .code-copy-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
#hy-chat .hy-codeblock-header .code-copy-btn svg {
    display: block;
    width: 14px;
    height: 14px;
}
#hy-chat .hy-codeblock-header .code-copy-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #111;
}
#hy-chat .hy-codeblock-header .code-copy-btn:focus {
    outline: none;
}
#hy-chat .hy-codeblock-header .code-copy-btn:focus-visible {
    outline: 2px solid var(--hy-accent, #2563eb);
    outline-offset: 1px;
}
#hy-chat .hy-codeblock-header .code-copy-btn.copied,
#hy-chat .hy-codeblock-header .code-copy-btn.copied:hover {
    color: #0a7f3f;
    background: transparent;
}
.dark #hy-chat .hy-codeblock-header .code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f5;
}
.dark #hy-chat .hy-codeblock-header .code-copy-btn.copied,
.dark #hy-chat .hy-codeblock-header .code-copy-btn.copied:hover {
    color: #4ade80;
    background: transparent;
}

/* ── HTML preview play button (under code blocks) ─────────────────────── */
.html-preview-btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    padding: 2px 0;
    margin: 2px 0 6px;
    cursor: pointer;
    font-size: 0;
    line-height: 1;
    transition: opacity 0.15s ease;
}
.html-preview-btn::before {
    content: "▶ html preview";
    font-size: 12px;
    color: var(--hy-accent);
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}
.html-preview-btn:hover {
    opacity: 0.7;
}

/* ── HTML preview modal (outside Gradio, under <body>) ────────────────── */
.html-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.html-preview-modal {
    width: 90vw;
    height: 85vh;
    background: var(--hy-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.25s ease;
}
.dark .html-preview-modal {
    background: var(--hy-bg-soft);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
@keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.html-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--hy-border);
    background: var(--hy-bg-soft);
    flex-shrink: 0;
}
.dark .html-preview-header {
    background: var(--hy-bg-muted);
}

.html-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--hy-text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.html-preview-title::before {
    content: "⬡";
    color: var(--hy-accent);
}

.html-preview-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--hy-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.15s ease;
}
.html-preview-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

.html-preview-iframe {
    flex: 1;
    border: none;
    width: 100%;
    background: var(--hy-bg);
}