mihalykiss commited on
Commit
65e7b5a
·
verified ·
1 Parent(s): 78d0699

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +181 -188
app.py CHANGED
@@ -4,7 +4,7 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
4
  import re
5
  from tokenizers import normalizers # For isinstance check
6
  from tokenizers.normalizers import Sequence, Replace, Strip
7
- from tokenizers import Regex # For the Regex class
8
  import os
9
 
10
 
@@ -56,32 +56,27 @@ def clean_text(text: str) -> str:
56
  return text
57
 
58
  if tokenizer:
59
- # Define the new normalizers to add
60
  custom_normalizers_to_add = [
61
- Replace(Regex(r'(\w+)[--]\s*\n\s*(\w+)'), r"\1\2"), # join_hyphen_break
62
- Replace(Regex(r'\s*\n\s*'), " "), # newline_to_space
63
  Strip()
64
  ]
65
-
66
- # Get the current normalizer from the backend tokenizer
67
  current_backend_normalizer = tokenizer.backend_tokenizer.normalizer
68
 
69
  if current_backend_normalizer is None:
70
- # If no existing normalizer, just use the new ones in a Sequence
71
  tokenizer.backend_tokenizer.normalizer = Sequence(custom_normalizers_to_add)
72
  elif isinstance(current_backend_normalizer, normalizers.Sequence):
73
- # If existing is a Sequence, extend its list of normalizers
74
- # The .normalizers attribute of a Sequence is a list, so we can extend it
75
  current_backend_normalizer.normalizers.extend(custom_normalizers_to_add)
76
- # Re-assign to ensure change is registered if Sequence behaves immutably (though it likely modifies in place)
77
- tokenizer.backend_tokenizer.normalizer = Sequence(current_backend_normalizer.normalizers)
78
- else:
79
- # If existing is a single normalizer (not None and not a Sequence), create a new Sequence
 
 
80
  tokenizer.backend_tokenizer.normalizer = Sequence([current_backend_normalizer] + custom_normalizers_to_add)
81
-
82
  # --- End Model & Tokenizer Configuration ---
83
 
84
-
85
  title_md = """
86
  <h1 style="text-align: center; margin-bottom: 5px;">AI Text Detector</h1>
87
  <p style="text-align: center; font-size: 0.9em; color: var(--text-secondary); margin-top: 0; margin-bottom: 20px;">Developed by SzegedAI</p>
@@ -168,86 +163,134 @@ def classify_text_interface(text):
168
  modern_css = """
169
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
170
 
171
- /* Light Theme (Default) */
172
  :root {
173
- --primary-bg: #F4F7FC; /* Lighter body background */
174
- --app-bg: #FFFFFF;
175
- --text-primary: #2C3E50;
176
- --text-secondary: #7F8C8D;
177
- --accent-color: #1ABC9C;
178
- --accent-color-darker: #16A085;
179
- --border-color: #E0E6ED; /* Slightly softer border */
180
- --input-bg: #FFFFFF;
181
- --input-focus-border: var(--accent-color);
182
- --human-color: #2ECC71;
183
- --human-bg: rgba(46, 204, 113, 0.1);
184
- --ai-color: #E74C3C;
185
- --ai-bg: rgba(231, 76, 60, 0.1);
186
- --shadow-color: rgba(44, 62, 80, 0.1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  --container-max-width: 800px;
188
  --border-radius-md: 8px;
189
  --border-radius-lg: 12px;
190
- --examples-bg: #F8F9FA; /* Light background for examples area */
191
- --placeholder-color: #B0BEC5;
192
- --accordion-label-color: var(--text-primary);
193
- --accordion-bg: var(--app-bg); /* Accordion bg same as app-bg for seamless look */
194
- --accordion-border: var(--border-color);
195
- --sample-textbox-bg: var(--input-bg);
196
  }
197
 
198
- /* Dark Theme Overrides */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  @media (prefers-color-scheme: dark) {
200
- :root {
201
- --primary-bg: #1A1D2E; /* Dark Blue/Charcoal for body */
202
- --app-bg: #252936; /* Slightly lighter dark for main container */
203
- --text-primary: #EAEAF1; /* Off-white for primary text */
204
- --text-secondary: #A0A3AF; /* Lighter gray for secondary text */
205
- --accent-color: #1DE9B6; /* Brighter Teal for dark mode */
206
- --accent-color-darker: #00BFA5;
207
- --border-color: #3A3E4F; /* Darker, less prominent border */
208
- --input-bg: #2C3040; /* Darker input background */
209
- /* --input-focus-border: var(--accent-color); /* Can remain the same or use a brighter version */
210
- --human-color: #69F0AE; /* Brighter Green */
211
- --human-bg: rgba(105, 240, 174, 0.15); /* Slightly more opaque for dark bg */
212
- --ai-color: #FF8A80; /* Brighter Red */
213
- --ai-bg: rgba(255, 138, 128, 0.15); /* Slightly more opaque for dark bg */
214
- --shadow-color: rgba(0, 0, 0, 0.25); /* Shadow on dark bg */
215
- --examples-bg: #2A2E3B; /* Dark background for examples area */
216
- --placeholder-color: #7A7D8A;
217
- --accordion-label-color: var(--text-primary);
218
- --accordion-bg: var(--app-bg); /* Keep accordion bg consistent with app */
219
- --accordion-border: var(--border-color);
220
- --sample-textbox-bg: var(--input-bg);
221
- }
222
-
223
- body { /* Ensure body background changes for dark mode */
224
- background: var(--primary-bg);
225
- }
226
-
227
- /* Specific component adjustments for dark mode if needed */
228
- #text_input_box textarea::placeholder {
229
- color: var(--placeholder-color);
230
- }
231
- .gr-accordion > .label-wrap button {
232
- color: var(--accordion-label-color) !important; /* Ensure it uses the dark mode text color */
233
- }
234
- .learn-more-link, .learn-more-link b { /* Ensure link color adapts */
235
- color: var(--accent-color) !important;
236
- }
237
- .learn-more-link:hover, .learn-more-link:hover b {
238
- color: var(--accent-color-darker) !important;
239
  }
240
  }
241
 
242
  .features-list strong::after {
243
  content: " ";
244
  display: inline-block;
245
- width: 0.2em; /* Adds a small space after the bolded part like "Verification: " */
246
  }
247
 
248
  body {
249
  font-family: 'Inter', sans-serif;
250
- background: var(--primary-bg); /* Use CSS variable */
251
  color: var(--text-primary);
252
  margin: 0;
253
  padding: 20px;
@@ -257,7 +300,7 @@ body {
257
  min-height: 100vh;
258
  box-sizing: border-box;
259
  overflow-y: auto;
260
- transition: background-color 0.3s ease, color 0.3s ease; /* Smooth theme transition */
261
  }
262
 
263
  .gradio-container {
@@ -268,53 +311,56 @@ body {
268
  max-width: var(--container-max-width);
269
  width: 100%;
270
  margin: 20px auto;
271
- border: none; /* Gradio might add its own border, ensure it's controlled or removed */
272
- transition: background-color 0.3s ease, box-shadow 0.3s ease;
273
  }
274
 
275
- .form.svelte-633qhp, .block.svelte-11xb1hd, .gradio-html .block {
 
276
  background: none !important;
277
  border: none !important;
278
  box-shadow: none !important;
279
- padding: 0 !important;
 
280
  }
281
-
282
- /* Title and subtitle are handled by title_md */
283
- h1 { /* Fallback or for other h1s if any */
284
- color: var(--text-primary);
285
- font-size: clamp(24px, 5vw, 30px);
286
- font-weight: 700;
287
- text-align: center;
288
- margin-bottom: 20px;
289
- letter-spacing: -0.5px;
290
  }
 
 
 
 
291
 
292
  .app-description p {
293
  color: var(--text-secondary);
294
  font-size: clamp(14px, 2.5vw, 16px);
295
  line-height: 1.7;
296
- margin-bottom: 15px;
297
  }
298
 
299
  .app-description .instruction-text {
300
  font-weight: 500;
301
  color: var(--text-primary);
302
- margin-top: 20px;
303
  text-align: center;
304
  }
305
 
306
  .features-list {
307
  list-style: none;
308
  padding-left: 0;
309
- margin: 20px 0;
310
  }
311
 
312
  .features-list li {
313
  display: flex;
314
- align-items: center; /* Align icon with the first line of text */
315
  font-size: clamp(14px, 2.5vw, 16px);
316
  color: var(--text-secondary);
317
- margin-bottom: 12px;
318
  line-height: 1.6;
319
  }
320
 
@@ -322,17 +368,7 @@ h1 { /* Fallback or for other h1s if any */
322
  margin-right: 12px;
323
  font-size: 1.2em;
324
  color: var(--accent-color);
325
- flex-shrink: 0; /* Prevent icon from shrinking */
326
- }
327
-
328
- .learn-more-link, .learn-more-link b {
329
- color: var(--accent-color) !important;
330
- text-decoration: none;
331
- font-weight: 600;
332
- }
333
- .learn-more-link:hover, .learn-more-link:hover b {
334
- color: var(--accent-color-darker) !important;
335
- text-decoration: underline;
336
  }
337
 
338
  #text_input_box textarea {
@@ -344,19 +380,19 @@ h1 { /* Fallback or for other h1s if any */
344
  width: 100%;
345
  box-sizing: border-box;
346
  color: var(--text-primary);
347
- transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
348
  min-height: 120px;
349
- box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Subtle shadow for light mode */
350
  }
351
 
352
  #text_input_box textarea::placeholder {
353
  color: var(--placeholder-color);
354
- transition: color 0.3s ease;
355
  }
356
 
357
  #text_input_box textarea:focus {
358
  border-color: var(--input-focus-border);
359
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--input-focus-border) 25%, transparent); /* Use color-mix for focus shadow */
360
  outline: none;
361
  }
362
 
@@ -365,131 +401,88 @@ h1 { /* Fallback or for other h1s if any */
365
  border: 1px solid var(--border-color);
366
  border-radius: var(--border-radius-md);
367
  padding: 20px;
368
- margin-top: 25px;
369
  width: 100%;
370
  box-sizing: border-box;
371
  text-align: center;
372
  font-size: clamp(16px, 3vw, 17px);
373
- box-shadow: 0 4px 8px rgba(0,0,0,0.05); /* Subtle shadow for light mode */
374
  min-height: 80px;
375
  display: flex;
376
  flex-direction: column;
377
  justify-content: center;
378
- transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
379
  }
380
  #result_output_box p {
381
- margin-bottom: 8px;
382
  line-height: 1.6;
383
- color: var(--text-primary); /* Ensure text inside result box also adapts */
384
  }
385
  #result_output_box p:last-child {
386
- margin-bottom: 0;
387
  }
388
- #result_output_box strong { /* Ensure bold text also adapts color */
389
- color: var(--text-primary);
390
  }
391
 
392
-
393
- .highlight-human, .highlight-ai { /* These are spans, color is set by their own var */
394
  font-weight: 600;
395
  padding: 5px 10px;
396
  border-radius: var(--border-radius-md);
397
  display: inline-block;
398
  font-size: 1.05em;
399
- transition: background-color 0.3s ease, color 0.3s ease;
400
- }
401
-
402
- .highlight-human {
403
- color: var(--human-color);
404
- background-color: var(--human-bg);
405
- }
406
-
407
- .highlight-ai {
408
- color: var(--ai-color);
409
- background-color: var(--ai-bg);
410
- }
411
-
412
- /* Gradio specific Tab styling (if you were to use Tabs) */
413
- .tabs > div:first-child button {
414
- background-color: transparent !important;
415
- color: var(--text-secondary) !important;
416
- border: none !important;
417
- border-bottom: 2px solid transparent !important;
418
- border-radius: 0 !important;
419
- padding: 10px 15px !important;
420
- font-weight: 500 !important;
421
- transition: color 0.3s ease, border-bottom-color 0.3s ease !important;
422
- }
423
-
424
- .tabs > div:first-child button.selected {
425
- color: var(--accent-color) !important;
426
- border-bottom-color: var(--accent-color) !important;
427
- font-weight: 600 !important;
428
  }
 
 
429
 
430
- /* Accordion and Examples Styling */
431
  .gr-accordion {
432
  border: 1px solid var(--accordion-border) !important;
433
  border-radius: var(--border-radius-lg) !important;
434
  box-shadow: none !important;
435
  padding: 0 15px 15px 15px !important;
436
- margin-bottom: 20px !important; /* Increased space below each accordion */
437
- background-color: var(--accordion-bg) !important; /* Use variable for accordion background */
438
- transition: background-color 0.3s ease, border-color 0.3s ease;
439
  }
440
-
441
  .gr-accordion > .label-wrap button {
442
  font-weight: 600 !important;
443
  color: var(--accordion-label-color) !important;
444
- padding: 15px 0px !important; /* More padding for label */
445
  font-size: 1.05em !important;
446
- transition: color 0.3s ease;
447
  }
448
- .gr-accordion > .label-wrap { /* Remove default Gradio accordion label border */
449
- border-bottom: none !important;
450
- }
451
-
452
 
453
- .gr-examples { /* Wrapper for the examples content */
454
- padding: 15px 0px 0px 0px !important; /* Adjust padding, top padding handled by accordion */
455
- border: none !important; /* Border is on accordion now */
456
- border-radius: 0 !important; /* Rounded corners on accordion */
457
- background-color: transparent !important; /* Examples area transparent, accordion has bg */
458
- margin-top: 0px !important; /* No extra margin, accordion handles it */
459
  }
460
- .gr-sample-textbox { /* Individual example textboxes */
461
  border: 1px solid var(--border-color) !important;
462
  border-radius: var(--border-radius-md) !important;
463
  font-size: 14px !important;
464
  background-color: var(--sample-textbox-bg) !important;
465
- color: var(--text-primary) !important; /* Text color for example text */
466
- transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
467
  }
468
- .gr-sample-textbox:hover {
469
- border-color: var(--accent-color) !important; /* Highlight on hover */
470
- }
471
-
472
 
473
  .footer-text, #bottom_text {
474
  text-align: center;
475
- margin-top: 40px; /* Keep space above footer */
476
  font-size: clamp(13px, 2vw, 14px);
477
  color: var(--text-secondary);
478
  }
479
- #bottom_text p {
480
- margin: 0;
481
- }
482
 
483
  @media (max-width: 768px) {
484
- body {
485
- padding: 10px;
486
- align-items: flex-start;
487
- }
488
- .gradio-container {
489
- padding: 20px;
490
- margin: 10px;
491
- }
492
- h1 { font-size: 22px; }
493
  .app-description p, .features-list li { font-size: 14px; }
494
  #text_input_box textarea { font-size: 15px; min-height: 100px; }
495
  #result_output_box { font-size: 15px; padding: 15px; }
 
4
  import re
5
  from tokenizers import normalizers # For isinstance check
6
  from tokenizers.normalizers import Sequence, Replace, Strip
7
+ from tokenizers import Regex
8
  import os
9
 
10
 
 
56
  return text
57
 
58
  if tokenizer:
 
59
  custom_normalizers_to_add = [
60
+ Replace(Regex(r'(\w+)[--]\s*\n\s*(\w+)'), r"\1\2"),
61
+ Replace(Regex(r'\s*\n\s*'), " "),
62
  Strip()
63
  ]
 
 
64
  current_backend_normalizer = tokenizer.backend_tokenizer.normalizer
65
 
66
  if current_backend_normalizer is None:
 
67
  tokenizer.backend_tokenizer.normalizer = Sequence(custom_normalizers_to_add)
68
  elif isinstance(current_backend_normalizer, normalizers.Sequence):
69
+ # Extend the existing list of normalizers within the Sequence object
 
70
  current_backend_normalizer.normalizers.extend(custom_normalizers_to_add)
71
+ # Re-assign if `extend` doesn't modify in place or if Sequence needs explicit update
72
+ # For `tokenizers.normalizers.Sequence`, `normalizers` is a list and `extend` modifies it in place.
73
+ # No explicit re-assignment of tokenizer.backend_tokenizer.normalizer needed here unless Sequence is immutable.
74
+ # To be safe, one might re-create:
75
+ # tokenizer.backend_tokenizer.normalizer = Sequence(current_backend_normalizer.normalizers)
76
+ else: # It's a single normalizer object, not a Sequence
77
  tokenizer.backend_tokenizer.normalizer = Sequence([current_backend_normalizer] + custom_normalizers_to_add)
 
78
  # --- End Model & Tokenizer Configuration ---
79
 
 
80
  title_md = """
81
  <h1 style="text-align: center; margin-bottom: 5px;">AI Text Detector</h1>
82
  <p style="text-align: center; font-size: 0.9em; color: var(--text-secondary); margin-top: 0; margin-bottom: 20px;">Developed by SzegedAI</p>
 
163
  modern_css = """
164
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
165
 
166
+ /* Define values for light and dark themes */
167
  :root {
168
+ --primary-bg-light: #F4F7FC;
169
+ --app-bg-light: #FFFFFF;
170
+ --text-primary-light: #2C3E50;
171
+ --text-secondary-light: #7F8C8D;
172
+ --accent-color-light: #1ABC9C;
173
+ --accent-color-darker-light: #16A085;
174
+ --border-color-light: #E0E6ED;
175
+ --input-bg-light: #FFFFFF;
176
+ --human-color-light: #2ECC71;
177
+ --human-bg-light: rgba(46, 204, 113, 0.1);
178
+ --ai-color-light: #E74C3C;
179
+ --ai-bg-light: rgba(231, 76, 60, 0.1);
180
+ --shadow-color-light: rgba(44, 62, 80, 0.1);
181
+ --examples-bg-light: #F8F9FA;
182
+ --placeholder-color-light: #B0BEC5;
183
+ --accordion-label-color-light: var(--text-primary-light);
184
+ --accordion-bg-light: var(--app-bg-light);
185
+ --accordion-border-light: var(--border-color-light);
186
+ --sample-textbox-bg-light: var(--input-bg-light);
187
+
188
+ --primary-bg-dark: #121828; /* Even darker body for more contrast */
189
+ --app-bg-dark: #1B2134; /* Darker app container */
190
+ --text-primary-dark: #E0E7FF; /* Lighter text for dark mode */
191
+ --text-secondary-dark: #98A0B3; /* Softer secondary text */
192
+ --accent-color-dark: #2CE1C7; /* Brighter accent */
193
+ --accent-color-darker-dark: #15B8A5;
194
+ --border-color-dark: #2F364D; /* Subtle borders */
195
+ --input-bg-dark: #22283E; /* Dark input fields */
196
+ --human-color-dark: #50FA7B; /* Brighter lime green */
197
+ --human-bg-dark: rgba(80, 250, 123, 0.15);
198
+ --ai-color-dark: #FF79C6; /* Bright pink/magenta for AI */
199
+ --ai-bg-dark: rgba(255, 121, 198, 0.15);
200
+ --shadow-color-dark: rgba(0, 0, 0, 0.3); /* Shadow for dark mode */
201
+ --examples-bg-dark: #22283E; /* Examples bg same as input */
202
+ --placeholder-color-dark: #687083;
203
+ --accordion-label-color-dark: var(--text-primary-dark);
204
+ --accordion-bg-dark: var(--app-bg-dark);
205
+ --accordion-border-dark: var(--border-color-dark);
206
+ --sample-textbox-bg-dark: var(--input-bg-dark);
207
+
208
+ /* Default to light theme variables */
209
+ --primary-bg: var(--primary-bg-light);
210
+ --app-bg: var(--app-bg-light);
211
+ --text-primary: var(--text-primary-light);
212
+ --text-secondary: var(--text-secondary-light);
213
+ --accent-color: var(--accent-color-light);
214
+ --accent-color-darker: var(--accent-color-darker-light);
215
+ --border-color: var(--border-color-light);
216
+ --input-bg: var(--input-bg-light);
217
+ --input-focus-border: var(--accent-color-light); /* Default focus for light */
218
+ --human-color: var(--human-color-light);
219
+ --human-bg: var(--human-bg-light);
220
+ --ai-color: var(--ai-color-light);
221
+ --ai-bg: var(--ai-bg-light);
222
+ --shadow-color: var(--shadow-color-light);
223
+ --examples-bg: var(--examples-bg-light);
224
+ --placeholder-color: var(--placeholder-color-light);
225
+ --accordion-label-color: var(--accordion-label-color-light);
226
+ --accordion-bg: var(--accordion-bg-light);
227
+ --accordion-border: var(--accordion-border-light);
228
+ --sample-textbox-bg: var(--sample-textbox-bg-light);
229
+
230
  --container-max-width: 800px;
231
  --border-radius-md: 8px;
232
  --border-radius-lg: 12px;
 
 
 
 
 
 
233
  }
234
 
235
+ /* Apply Dark Theme when html.dark class is present (Hugging Face Spaces) */
236
+ html.dark {
237
+ --primary-bg: var(--primary-bg-dark);
238
+ --app-bg: var(--app-bg-dark);
239
+ --text-primary: var(--text-primary-dark);
240
+ --text-secondary: var(--text-secondary-dark);
241
+ --accent-color: var(--accent-color-dark);
242
+ --accent-color-darker: var(--accent-color-darker-dark);
243
+ --border-color: var(--border-color-dark);
244
+ --input-bg: var(--input-bg-dark);
245
+ --input-focus-border: var(--accent-color-dark); /* Focus for dark */
246
+ --human-color: var(--human-color-dark);
247
+ --human-bg: var(--human-bg-dark);
248
+ --ai-color: var(--ai-color-dark);
249
+ --ai-bg: var(--ai-bg-dark);
250
+ --shadow-color: var(--shadow-color-dark);
251
+ --examples-bg: var(--examples-bg-dark);
252
+ --placeholder-color: var(--placeholder-color-dark);
253
+ --accordion-label-color: var(--accordion-label-color-dark);
254
+ --accordion-bg: var(--accordion-bg-dark);
255
+ --accordion-border: var(--accordion-border-dark);
256
+ --sample-textbox-bg: var(--sample-textbox-bg-dark);
257
+ }
258
+
259
+ /* Fallback for system preference if html.dark is not set */
260
  @media (prefers-color-scheme: dark) {
261
+ html:not(.dark) :root { /* Apply only if HF class is not already active */
262
+ --primary-bg: var(--primary-bg-dark);
263
+ --app-bg: var(--app-bg-dark);
264
+ --text-primary: var(--text-primary-dark);
265
+ --text-secondary: var(--text-secondary-dark);
266
+ --accent-color: var(--accent-color-dark);
267
+ --accent-color-darker: var(--accent-color-darker-dark);
268
+ --border-color: var(--border-color-dark);
269
+ --input-bg: var(--input-bg-dark);
270
+ --input-focus-border: var(--accent-color-dark);
271
+ --human-color: var(--human-color-dark);
272
+ --human-bg: var(--human-bg-dark);
273
+ --ai-color: var(--ai-color-dark);
274
+ --ai-bg: var(--ai-bg-dark);
275
+ --shadow-color: var(--shadow-color-dark);
276
+ --examples-bg: var(--examples-bg-dark);
277
+ --placeholder-color: var(--placeholder-color-dark);
278
+ --accordion-label-color: var(--accordion-label-color-dark);
279
+ --accordion-bg: var(--accordion-bg-dark);
280
+ --accordion-border: var(--accordion-border-dark);
281
+ --sample-textbox-bg: var(--sample-textbox-bg-dark);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  }
283
  }
284
 
285
  .features-list strong::after {
286
  content: " ";
287
  display: inline-block;
288
+ width: 0.2em;
289
  }
290
 
291
  body {
292
  font-family: 'Inter', sans-serif;
293
+ background: var(--primary-bg);
294
  color: var(--text-primary);
295
  margin: 0;
296
  padding: 20px;
 
300
  min-height: 100vh;
301
  box-sizing: border-box;
302
  overflow-y: auto;
303
+ transition: background-color 0.2s ease-out, color 0.2s ease-out;
304
  }
305
 
306
  .gradio-container {
 
311
  max-width: var(--container-max-width);
312
  width: 100%;
313
  margin: 20px auto;
314
+ border: 1px solid var(--border-color); /* Add subtle border consistent with theme */
315
+ transition: background-color 0.2s ease-out, box-shadow 0.2s ease-out, border-color 0.2s ease-out;
316
  }
317
 
318
+ /* Reset Gradio default styles that might interfere */
319
+ .form.svelte-633qhp, .block.svelte-11xb1hd, .gradio-html .block, .gradio-markdown > *:first-child {
320
  background: none !important;
321
  border: none !important;
322
  box-shadow: none !important;
323
+ padding: 0 !important; /* Reset padding if it causes issues */
324
+ margin: 0 !important; /* Reset margin for Markdown wrapper */
325
  }
326
+ /* Ensure Markdown text color inherits correctly */
327
+ .gradio-markdown p, .gradio-markdown ul, .gradio-markdown li, .gradio-markdown h1, .gradio-markdown h2 {
328
+ color: inherit !important;
329
+ }
330
+ .gradio-markdown a {
331
+ color: var(--accent-color) !important;
 
 
 
332
  }
333
+ .gradio-markdown a:hover {
334
+ color: var(--accent-color-darker) !important;
335
+ }
336
+
337
 
338
  .app-description p {
339
  color: var(--text-secondary);
340
  font-size: clamp(14px, 2.5vw, 16px);
341
  line-height: 1.7;
342
+ margin-bottom: 15px !important; /* Override Gradio's specific p margin */
343
  }
344
 
345
  .app-description .instruction-text {
346
  font-weight: 500;
347
  color: var(--text-primary);
348
+ margin-top: 20px !important;
349
  text-align: center;
350
  }
351
 
352
  .features-list {
353
  list-style: none;
354
  padding-left: 0;
355
+ margin: 20px 0 !important;
356
  }
357
 
358
  .features-list li {
359
  display: flex;
360
+ align-items: center;
361
  font-size: clamp(14px, 2.5vw, 16px);
362
  color: var(--text-secondary);
363
+ margin-bottom: 12px !important;
364
  line-height: 1.6;
365
  }
366
 
 
368
  margin-right: 12px;
369
  font-size: 1.2em;
370
  color: var(--accent-color);
371
+ flex-shrink: 0;
 
 
 
 
 
 
 
 
 
 
372
  }
373
 
374
  #text_input_box textarea {
 
380
  width: 100%;
381
  box-sizing: border-box;
382
  color: var(--text-primary);
383
+ transition: background-color 0.2s ease-out, border-color 0.2s ease-out, box-shadow 0.2s ease-out, color 0.2s ease-out;
384
  min-height: 120px;
385
+ box-shadow: 0 1px 3px rgba(0,0,0,0.03); /* Softer shadow */
386
  }
387
 
388
  #text_input_box textarea::placeholder {
389
  color: var(--placeholder-color);
390
+ transition: color 0.2s ease-out;
391
  }
392
 
393
  #text_input_box textarea:focus {
394
  border-color: var(--input-focus-border);
395
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--input-focus-border) 20%, transparent);
396
  outline: none;
397
  }
398
 
 
401
  border: 1px solid var(--border-color);
402
  border-radius: var(--border-radius-md);
403
  padding: 20px;
404
+ margin-top: 25px !important; /* Override Gradio */
405
  width: 100%;
406
  box-sizing: border-box;
407
  text-align: center;
408
  font-size: clamp(16px, 3vw, 17px);
409
+ box-shadow: 0 1px 3px rgba(0,0,0,0.03);
410
  min-height: 80px;
411
  display: flex;
412
  flex-direction: column;
413
  justify-content: center;
414
+ transition: background-color 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out;
415
  }
416
  #result_output_box p {
417
+ margin-bottom: 8px !important;
418
  line-height: 1.6;
419
+ color: var(--text-primary) !important;
420
  }
421
  #result_output_box p:last-child {
422
+ margin-bottom: 0 !important;
423
  }
424
+ #result_output_box strong {
425
+ color: var(--text-primary) !important;
426
  }
427
 
428
+ .highlight-human, .highlight-ai {
 
429
  font-weight: 600;
430
  padding: 5px 10px;
431
  border-radius: var(--border-radius-md);
432
  display: inline-block;
433
  font-size: 1.05em;
434
+ transition: background-color 0.2s ease-out, color 0.2s ease-out;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  }
436
+ .highlight-human { color: var(--human-color); background-color: var(--human-bg); }
437
+ .highlight-ai { color: var(--ai-color); background-color: var(--ai-bg); }
438
 
 
439
  .gr-accordion {
440
  border: 1px solid var(--accordion-border) !important;
441
  border-radius: var(--border-radius-lg) !important;
442
  box-shadow: none !important;
443
  padding: 0 15px 15px 15px !important;
444
+ margin-bottom: 20px !important;
445
+ background-color: var(--accordion-bg) !important;
446
+ transition: background-color 0.2s ease-out, border-color 0.2s ease-out;
447
  }
 
448
  .gr-accordion > .label-wrap button {
449
  font-weight: 600 !important;
450
  color: var(--accordion-label-color) !important;
451
+ padding: 15px 0px !important;
452
  font-size: 1.05em !important;
453
+ transition: color 0.2s ease-out;
454
  }
455
+ .gr-accordion > .label-wrap { border-bottom: none !important; }
 
 
 
456
 
457
+ .gr-examples {
458
+ padding: 15px 0px 0px 0px !important;
459
+ border: none !important;
460
+ border-radius: 0 !important;
461
+ background-color: transparent !important;
462
+ margin-top: 0px !important;
463
  }
464
+ .gr-sample-textbox {
465
  border: 1px solid var(--border-color) !important;
466
  border-radius: var(--border-radius-md) !important;
467
  font-size: 14px !important;
468
  background-color: var(--sample-textbox-bg) !important;
469
+ color: var(--text-primary) !important;
470
+ transition: background-color 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out;
471
  }
472
+ .gr-sample-textbox:hover { border-color: var(--accent-color) !important; }
 
 
 
473
 
474
  .footer-text, #bottom_text {
475
  text-align: center;
476
+ margin-top: 40px !important;
477
  font-size: clamp(13px, 2vw, 14px);
478
  color: var(--text-secondary);
479
  }
480
+ #bottom_text p { margin: 0 !important; }
 
 
481
 
482
  @media (max-width: 768px) {
483
+ body { padding: 10px; align-items: flex-start; }
484
+ .gradio-container { padding: 20px; margin: 10px; }
485
+ /* h1 { font-size: 22px; } Handled by Markdown inline style which uses clamp */
 
 
 
 
 
 
486
  .app-description p, .features-list li { font-size: 14px; }
487
  #text_input_box textarea { font-size: 15px; min-height: 100px; }
488
  #result_output_box { font-size: 15px; padding: 15px; }