protocol-jarvis commited on
Commit
fbc5f09
·
verified ·
1 Parent(s): b9fbf28

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +313 -845
index.html CHANGED
@@ -5,940 +5,408 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>CodeForge · AI Code Generator</title>
7
  <style>
8
- * {
9
- margin: 0;
10
- padding: 0;
11
- box-sizing: border-box;
 
 
 
 
 
 
 
12
  }
13
 
 
 
14
  body {
15
- background: #0a0a0f;
16
- font-family: 'Courier New', monospace;
17
- color: #e0e0e0;
18
  min-height: 100vh;
 
19
  }
20
 
21
- /* Animated grid background */
22
  .grid-bg {
23
  position: fixed;
24
  inset: 0;
25
- background-image: linear-gradient(rgba(255,140,0,0.03) 1px, transparent 1px),
26
- linear-gradient(90deg, rgba(255,140,0,0.03) 1px, transparent 1px);
27
- background-size: 50px 50px;
 
28
  pointer-events: none;
29
  z-index: 0;
30
  }
31
-
32
- /* Glow orbs */
33
- .glow-orb {
34
  position: fixed;
35
  border-radius: 50%;
36
- background: radial-gradient(circle, rgba(255,140,0,0.08) 0%, transparent 70%);
37
  pointer-events: none;
38
  z-index: 0;
 
39
  }
40
- .orb1 { top: 20%; left: 10%; width: 400px; height: 400px; }
41
- .orb2 { bottom: 20%; right: 10%; width: 350px; height: 350px; }
42
- .orb3 { top: 50%; right: 30%; width: 250px; height: 250px; }
43
 
44
- .container {
45
- max-width: 1000px;
46
- margin: 0 auto;
47
- padding: 20px;
48
  position: relative;
49
  z-index: 1;
 
 
 
 
 
 
50
  }
51
 
52
- /* Header */
53
  .header {
54
- text-align: center;
55
- padding: 30px 0 20px;
56
- border-bottom: 1px solid rgba(255, 140, 0, 0.15);
57
- margin-bottom: 30px;
58
- }
59
-
60
- .logo {
61
- font-size: 72px;
62
- color: #ff8c00;
63
- filter: drop-shadow(0 0 25px rgba(255, 140, 0, 0.6));
64
- animation: glow 2s ease-in-out infinite;
65
- display: inline-block;
66
- }
67
-
68
- @keyframes glow {
69
- 0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 140, 0, 0.5)); transform: scale(1); }
70
- 50% { filter: drop-shadow(0 0 35px rgba(255, 140, 0, 0.9)); transform: scale(1.02); }
71
- }
72
-
73
- h1 {
74
- font-size: 32px;
75
- color: #ff8c00;
76
- letter-spacing: 10px;
77
- margin: 10px 0 5px;
78
- font-weight: 900;
79
- }
80
-
81
- .subtitle {
82
- color: rgba(255, 140, 0, 0.5);
83
- letter-spacing: 5px;
84
- font-size: 11px;
85
- }
86
-
87
- /* Password Box */
88
- .password-box {
89
- background: rgba(255, 140, 0, 0.04);
90
- border: 1px solid rgba(255, 140, 0, 0.15);
91
- border-radius: 4px;
92
- padding: 45px;
93
- max-width: 420px;
94
- margin: 60px auto;
95
- backdrop-filter: blur(10px);
96
- text-align: center;
97
- }
98
-
99
- .password-box input {
100
- width: 100%;
101
- padding: 14px 16px;
102
- background: rgba(0, 0, 0, 0.5);
103
- border: 1px solid rgba(255, 140, 0, 0.2);
104
- border-radius: 2px;
105
- color: #ff8c00;
106
- font-family: 'Courier New', monospace;
107
- font-size: 14px;
108
- letter-spacing: 3px;
109
- margin: 25px 0;
110
- outline: none;
111
- transition: all 0.2s;
112
- text-align: center;
113
  }
114
-
115
- .password-box input:focus {
116
- border-color: rgba(255, 140, 0, 0.6);
117
- box-shadow: 0 0 15px rgba(255, 140, 0, 0.1);
 
 
 
 
118
  }
119
 
120
- /* Buttons */
121
  button {
122
- background: #ff8c00;
123
- color: #0a0a0f;
124
- padding: 12px 28px;
125
- border: none;
126
- font-weight: 900;
127
  cursor: pointer;
128
- font-family: 'Courier New', monospace;
129
- font-size: 12px;
130
- letter-spacing: 3px;
131
- transition: all 0.2s;
132
- border-radius: 2px;
133
  }
134
-
135
- button:hover:not(:disabled) {
 
 
 
 
 
 
 
136
  background: #ffaa33;
137
- box-shadow: 0 0 20px rgba(255, 140, 0, 0.4);
138
  transform: translateY(-1px);
139
  }
 
140
 
141
- button:disabled {
142
- opacity: 0.5;
143
- cursor: not-allowed;
144
- }
145
-
146
- .btn-secondary {
147
- background: rgba(255, 255, 255, 0.03);
148
- border: 1px solid rgba(255, 255, 255, 0.06);
149
- color: rgba(255, 255, 255, 0.5);
150
- letter-spacing: 2px;
151
- }
152
-
153
- .btn-secondary:hover {
154
- background: rgba(255, 255, 255, 0.08);
155
- box-shadow: none;
156
  }
 
157
 
158
- .btn-danger {
159
- background: rgba(255, 60, 60, 0.1);
160
- border: 1px solid rgba(255, 60, 60, 0.2);
161
- color: rgba(255, 100, 100, 0.8);
 
 
 
162
  }
163
-
164
- .btn-danger:hover {
165
- background: rgba(255, 60, 60, 0.2);
166
- box-shadow: none;
 
167
  }
168
 
169
- /* Language Bar */
170
- .language-bar {
171
- position: sticky;
172
- top: 0;
173
- background: rgba(10, 10, 15, 0.95);
174
- backdrop-filter: blur(12px);
175
- padding: 12px 0;
176
- margin-bottom: 25px;
177
- border-bottom: 1px solid rgba(255, 140, 0, 0.08);
178
- border-top: 1px solid rgba(255, 140, 0, 0.08);
179
- z-index: 10;
180
  }
181
-
182
- .lang-buttons {
183
  display: flex;
184
- flex-wrap: wrap;
185
- gap: 8px;
186
- justify-content: center;
187
  }
188
-
189
  .lang-btn {
190
- background: rgba(255, 255, 255, 0.03);
191
- border: 1px solid rgba(255, 255, 255, 0.06);
192
- color: rgba(255, 255, 255, 0.4);
193
- padding: 6px 16px;
194
- font-size: 11px;
195
- letter-spacing: 1px;
196
- width: auto;
 
 
197
  }
198
-
199
  .lang-btn.active {
200
- background: rgba(255, 140, 0, 0.15);
201
- border-color: rgba(255, 140, 0, 0.4);
202
- color: #ff8c00;
203
  font-weight: 700;
204
  }
205
 
206
- /* Stats */
207
- .stats {
208
- text-align: center;
209
- color: rgba(255, 255, 255, 0.2);
210
- font-size: 10px;
211
- letter-spacing: 2px;
212
- margin: 15px 0;
213
- }
214
-
215
- /* Example Buttons */
216
  .examples {
217
- display: flex;
218
- flex-wrap: wrap;
219
- gap: 10px;
220
- justify-content: center;
221
- margin: 20px 0 25px;
222
  }
223
-
224
- .example-btn {
225
- background: rgba(255, 140, 0, 0.05);
226
- border: 1px solid rgba(255, 140, 0, 0.15);
227
- color: rgba(255, 140, 0, 0.6);
228
- padding: 8px 16px;
229
- font-size: 11px;
230
- width: auto;
231
- letter-spacing: 0.5px;
232
  }
233
-
234
- .example-btn:hover {
235
- background: rgba(255, 140, 0, 0.1);
236
- color: #ff8c00;
237
- box-shadow: none;
238
- transform: none;
 
 
 
239
  }
 
240
 
241
- /* Chat Area */
242
  .chat-area {
243
- margin: 20px 0;
244
- max-height: 480px;
245
  overflow-y: auto;
246
- padding: 10px;
 
247
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
  .message {
250
- margin: 18px 0;
251
- padding: 14px 18px;
252
- border-radius: 8px;
253
- animation: slideIn 0.3s ease;
254
  }
255
-
256
- @keyframes slideIn {
257
- from {
258
- opacity: 0;
259
- transform: translateY(15px);
260
- }
261
- to {
262
- opacity: 1;
263
- transform: translateY(0);
264
- }
265
  }
 
266
 
267
- .user-message {
268
- background: rgba(255, 140, 0, 0.08);
269
- border: 1px solid rgba(255, 140, 0, 0.2);
270
- color: #ffb347;
271
- text-align: right;
272
- border-radius: 8px 2px 8px 8px;
 
 
 
 
273
  }
274
-
275
- .assistant-message {
276
- background: rgba(255, 255, 255, 0.02);
277
- border: 1px solid rgba(255, 255, 255, 0.05);
278
- color: #c8c8c8;
279
- border-radius: 2px 8px 8px 8px;
280
  }
281
-
282
- .message-avatar {
283
- display: inline-block;
284
- width: 34px;
285
- height: 34px;
286
- border-radius: 2px;
287
- background: rgba(255, 140, 0, 0.1);
288
- border: 1px solid rgba(255, 140, 0, 0.3);
289
- text-align: center;
290
- line-height: 32px;
291
- margin-right: 12px;
292
- font-size: 13px;
293
- font-weight: bold;
294
  }
295
 
296
- /* Code Blocks */
297
- pre {
298
- background: rgba(0, 0, 0, 0.6);
299
- padding: 16px;
300
- overflow-x: auto;
301
- margin: 12px 0;
302
  border-radius: 4px;
303
- border: 1px solid rgba(255, 140, 0, 0.12);
304
  font-size: 13px;
305
- line-height: 1.6;
 
306
  }
307
-
308
- code {
309
- font-family: 'Courier New', monospace;
310
- color: #d4d4d4;
 
311
  }
312
-
313
- /* Input Area */
314
- .input-area {
315
- position: sticky;
316
- bottom: 0;
317
- background: rgba(10, 10, 15, 0.98);
318
- backdrop-filter: blur(16px);
319
- padding: 20px 0;
320
- border-top: 1px solid rgba(255, 140, 0, 0.1);
321
- margin-top: 20px;
322
  }
323
 
324
- textarea {
325
- width: 100%;
326
- padding: 14px 18px;
327
- background: rgba(255, 255, 255, 0.04);
328
- border: 1px solid rgba(255, 140, 0, 0.15);
329
  border-radius: 4px;
330
- color: #e0e0e0;
331
- font-family: Georgia, serif;
332
- font-size: 14px;
333
- line-height: 1.6;
334
- resize: vertical;
335
- margin: 10px 0;
336
- outline: none;
337
- transition: all 0.2s;
338
  }
339
-
340
- textarea:focus {
341
- border-color: rgba(255, 140, 0, 0.4);
342
- box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.05);
343
- }
344
-
345
- .button-group {
346
  display: flex;
347
- gap: 12px;
348
- margin-top: 10px;
 
 
 
349
  }
350
-
351
- .button-group button {
352
- flex: 1;
 
 
 
353
  }
354
-
355
- /* Typing Indicator */
356
- .typing-indicator {
357
- display: inline-flex;
358
- gap: 5px;
359
- align-items: center;
360
- padding: 8px 0;
361
  }
362
-
363
- .typing-dot {
364
- width: 7px;
365
- height: 7px;
366
- background: #ff8c00;
367
- border-radius: 50%;
368
- animation: pulse 1.2s ease-in-out infinite;
369
  }
370
 
371
- @keyframes pulse {
372
- 0%, 100% { opacity: 0.2; transform: scale(0.8); }
373
- 50% { opacity: 1; transform: scale(1.2); }
374
- }
 
375
 
376
- /* Footer */
377
- .footer {
378
- text-align: center;
379
- color: rgba(255, 255, 255, 0.06);
380
- font-size: 9px;
381
- letter-spacing: 2px;
382
- margin-top: 20px;
383
- padding: 15px;
384
  }
385
 
386
- /* Scrollbar */
387
- ::-webkit-scrollbar {
388
- width: 5px;
389
- height: 5px;
390
- }
391
- ::-webkit-scrollbar-track {
392
- background: rgba(255, 255, 255, 0.02);
393
- }
394
- ::-webkit-scrollbar-thumb {
395
- background: rgba(255, 140, 0, 0.3);
396
- border-radius: 3px;
397
- }
398
 
399
- /* Mobile Responsive */
400
- @media (max-width: 768px) {
401
- .container {
402
- padding: 12px;
403
- }
404
- h1 {
405
- font-size: 22px;
406
- letter-spacing: 5px;
407
- }
408
- .logo {
409
- font-size: 52px;
410
- }
411
- .password-box {
412
- padding: 25px;
413
- margin: 30px auto;
414
- }
415
- .lang-btn {
416
- padding: 4px 10px;
417
- font-size: 9px;
418
- }
419
- }
420
  </style>
421
  </head>
422
  <body>
423
- <div class="grid-bg"></div>
424
- <div class="glow-orb orb1"></div>
425
- <div class="glow-orb orb2"></div>
426
- <div class="glow-orb orb3"></div>
427
-
428
- <div class="container" id="app"></div>
429
-
430
- <script>
431
- // ========== CONFIGURATION ==========
432
- const PASSWORD = "CodeForge#2026";
433
-
434
- const LANGUAGES = [
435
- { id: "auto", label: "✦ Auto Detect", short: "Auto" },
436
- { id: "javascript", label: "JS JavaScript", short: "JS" },
437
- { id: "typescript", label: "🔧 TypeScript", short: "TS" },
438
- { id: "python", label: "🐍 Python", short: "PY" },
439
- { id: "html", label: "🌐 HTML/CSS", short: "HTML" },
440
- { id: "react", label: "⚛️ React JSX", short: "React" },
441
- { id: "sql", label: "🗄️ SQL", short: "SQL" },
442
- { id: "bash", label: "🐚 Bash/Shell", short: "Bash" },
443
- { id: "rust", label: "🦀 Rust", short: "Rust" },
444
- { id: "go", label: "🐹 Go", short: "Go" },
445
- { id: "java", label: "☕ Java", short: "Java" },
446
- { id: "cpp", label: "⚡ C++", short: "C++" }
447
- ];
448
-
449
- const EXAMPLES = [
450
- "Build a REST API with authentication",
451
- "Create a responsive navbar component",
452
- "Write a binary search algorithm",
453
- "Make a SQL query for user analytics",
454
- "Build a Python web scraper",
455
- "Create a React counter component"
456
- ];
457
-
458
- // ========== APP STATE ==========
459
- let state = {
460
- unlocked: false,
461
- messages: [],
462
- selectedLang: "auto",
463
- promptCount: 0,
464
- loading: false
465
- };
466
-
467
- // ========== AI RESPONSE GENERATOR ==========
468
- async function generateResponse(prompt, language) {
469
- await new Promise(resolve => setTimeout(resolve, 900 + Math.random() * 400));
470
-
471
- const p = prompt.toLowerCase();
472
- let code = "", explanation = "";
473
- let detectedLang = language !== "auto" ? language : "javascript";
474
-
475
- // REST API
476
- if (p.includes("rest api") || p.includes("api with auth") || (p.includes("rest") && p.includes("api"))) {
477
- code = `const express = require('express');
478
- const jwt = require('jsonwebtoken');
479
- const app = express();
480
-
481
- app.use(express.json());
482
-
483
- // Auth middleware
484
- function authenticateToken(req, res, next) {
485
- const authHeader = req.headers['authorization'];
486
- const token = authHeader && authHeader.split(' ')[1];
487
- if (!token) return res.sendStatus(401);
488
-
489
- jwt.verify(token, 'secret-key', (err, user) => {
490
- if (err) return res.sendStatus(403);
491
- req.user = user;
492
- next();
493
- });
494
- }
495
-
496
- // Login endpoint
497
- app.post('/login', (req, res) => {
498
- const { username } = req.body;
499
- const token = jwt.sign({ username }, 'secret-key', { expiresIn: '1h' });
500
- res.json({ token });
501
- });
502
-
503
- // Protected route
504
- app.get('/protected', authenticateToken, (req, res) => {
505
- res.json({ message: 'Access granted', user: req.user });
506
- });
507
-
508
- app.listen(3000, () => console.log('Server running on port 3000'));`;
509
- explanation = "✅ **REST API with JWT Authentication** - Complete Express.js implementation";
510
- detectedLang = "javascript";
511
- }
512
- // Navbar
513
- else if (p.includes("navbar") || p.includes("nav bar") || p.includes("responsive nav")) {
514
- code = `<nav class="navbar">
515
- <div class="logo">⟨/⟩ CodeForge</div>
516
- <ul class="nav-links">
517
- <li><a href="#home">Home</a></li>
518
- <li><a href="#features">Features</a></li>
519
- <li><a href="#pricing">Pricing</a></li>
520
- <li><a href="#contact">Contact</a></li>
521
- </ul>
522
- <div class="burger" onclick="toggleMenu()">☰</div>
523
- </nav>
524
-
525
- <style>
526
- .navbar {
527
- display: flex;
528
- justify-content: space-between;
529
- align-items: center;
530
- background: linear-gradient(135deg, #1a1a2e, #16213e);
531
- padding: 1rem 2rem;
532
- box-shadow: 0 2px 10px rgba(0,0,0,0.3);
533
- }
534
- .logo {
535
- color: #ff8c00;
536
- font-size: 1.5rem;
537
- font-weight: bold;
538
- }
539
- .nav-links {
540
- display: flex;
541
- gap: 2rem;
542
- list-style: none;
543
- }
544
- .nav-links a {
545
- color: white;
546
- text-decoration: none;
547
- transition: color 0.3s;
548
- }
549
- .nav-links a:hover { color: #ff8c00; }
550
- .burger {
551
- display: none;
552
- font-size: 1.5rem;
553
- cursor: pointer;
554
- color: white;
555
- }
556
- @media (max-width: 768px) {
557
- .nav-links {
558
- display: none;
559
- position: absolute;
560
- top: 70px;
561
- left: 0;
562
- width: 100%;
563
- background: #1a1a2e;
564
- flex-direction: column;
565
- text-align: center;
566
- padding: 1rem;
567
- }
568
- .nav-links.active { display: flex; }
569
- .burger { display: block; }
570
- }
571
- </style>
572
- <script>
573
- function toggleMenu() {
574
- document.querySelector('.nav-links').classList.toggle('active');
575
- }
576
- </script>`;
577
- explanation = "🎨 **Responsive Navbar Component** - Mobile-friendly with hamburger menu";
578
- detectedLang = "html";
579
- }
580
- // Binary Search
581
- else if (p.includes("binary search") || p.includes("search algorithm")) {
582
- code = `function binarySearch(arr, target) {
583
- let left = 0;
584
- let right = arr.length - 1;
585
-
586
- while (left <= right) {
587
- const mid = Math.floor((left + right) / 2);
588
-
589
- if (arr[mid] === target) return mid;
590
- if (arr[mid] < target) left = mid + 1;
591
- else right = mid - 1;
592
- }
593
- return -1;
594
- }
595
-
596
- // Example
597
- const arr = [2, 5, 8, 12, 16, 23, 38, 56];
598
- const target = 23;
599
- const result = binarySearch(arr, target);
600
- console.log(\`Element found at index: \${result}\`);`;
601
- explanation = "🔍 **Binary Search Algorithm** - O(log n) time complexity";
602
- detectedLang = "javascript";
603
- }
604
- // SQL Query
605
- else if (p.includes("sql") || p.includes("query") || p.includes("analytics")) {
606
- code = `SELECT
607
- u.country,
608
- u.user_segment,
609
- COUNT(DISTINCT u.user_id) AS total_users,
610
- AVG(s.session_duration) AS avg_session_minutes,
611
- SUM(s.pages_viewed) AS total_pageviews,
612
- COUNT(DISTINCT DATE(s.session_date)) AS active_days
613
- FROM users u
614
- LEFT JOIN sessions s ON u.user_id = s.user_id
615
- WHERE s.session_date >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)
616
- AND u.status = 'active'
617
- GROUP BY u.country, u.user_segment
618
- HAVING total_users > 5
619
- ORDER BY total_users DESC, avg_session_minutes DESC
620
- LIMIT 20;`;
621
- explanation = "📊 **Advanced SQL Analytics Query** - User engagement metrics";
622
- detectedLang = "sql";
623
- }
624
- // Python Scraper
625
- else if (p.includes("scraper") || (p.includes("python") && p.includes("scrape"))) {
626
- code = `import requests
627
- from bs4 import BeautifulSoup
628
- import time
629
-
630
- def scrape_website(url, max_pages=5):
631
- headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'}
632
- results = []
633
-
634
- for page in range(1, max_pages + 1):
635
- try:
636
- page_url = f"{url}?page={page}" if page > 1 else url
637
- response = requests.get(page_url, headers=headers, timeout=10)
638
- response.raise_for_status()
639
-
640
- soup = BeautifulSoup(response.text, 'html.parser')
641
-
642
- for item in soup.select('.item'):
643
- results.append({
644
- 'title': item.select_one('.title')?.text or 'N/A',
645
- 'price': item.select_one('.price')?.text or 'N/A',
646
- })
647
-
648
- time.sleep(1) # Be respectful
649
- except Exception as e:
650
- print(f"Error: {e}")
651
- continue
652
-
653
- return results
654
-
655
- if __name__ == '__main__':
656
- data = scrape_website('https://example.com')
657
- print(f"Scraped {len(data)} items");`;
658
- explanation = "🕷️ **Python Web Scraper** - Production-ready with rate limiting";
659
- detectedLang = "python";
660
- }
661
- // React Counter
662
- else if (p.includes("react counter") || (p.includes("react") && p.includes("counter"))) {
663
- code = `import React, { useState } from 'react';
664
-
665
- const Counter = ({ initialValue = 0, step = 1 }) => {
666
- const [count, setCount] = useState(initialValue);
667
- const [history, setHistory] = useState([initialValue]);
668
-
669
- const increment = () => {
670
- const newCount = count + step;
671
- setCount(newCount);
672
- setHistory([...history, newCount]);
673
- };
674
-
675
- const decrement = () => {
676
- const newCount = count - step;
677
- setCount(newCount);
678
- setHistory([...history, newCount]);
679
- };
680
-
681
- const reset = () => {
682
- setCount(initialValue);
683
- setHistory([initialValue]);
684
- };
685
-
686
- return (
687
- <div style={{ textAlign: 'center', padding: '20px', background: 'linear-gradient(135deg, #667eea, #764ba2)', borderRadius: '10px' }}>
688
- <h2>Counter: {count}</h2>
689
- <div style={{ display: 'flex', gap: '10px', justifyContent: 'center' }}>
690
- <button onClick={decrement} style={{ padding: '10px 20px' }}>-{step}</button>
691
- <button onClick={reset} style={{ padding: '10px 20px' }}>Reset</button>
692
- <button onClick={increment} style={{ padding: '10px 20px' }}>+{step}</button>
693
- </div>
694
- <div style={{ marginTop: '15px' }}>
695
- <strong>History:</strong> {history.slice(-5).join(' → ')}
696
- </div>
697
- </div>
698
- );
699
- };
700
-
701
- export default Counter;`;
702
- explanation = "⚛️ **React Counter Component** - With history tracking";
703
- detectedLang = "react";
704
- }
705
- // Default
706
- else {
707
- code = `// CodeForge AI Response for: ${prompt.substring(0, 60)}${prompt.length > 60 ? '...' : ''}
708
- // Language: ${detectedLang.toUpperCase()}
709
-
710
- function solveChallenge(input) {
711
- // TODO: Implement your specific logic here
712
-
713
- if (!input) {
714
- throw new Error('Input is required');
715
- }
716
-
717
- // Process the data
718
- const result = processData(input);
719
-
720
- return {
721
- success: true,
722
- data: result,
723
- timestamp: new Date().toISOString()
724
- };
725
- }
726
-
727
- function processData(data) {
728
- // Add your custom processing logic
729
- return data;
730
- }
731
-
732
- // Example usage
733
- const testInput = { example: 'test value' };
734
- const output = solveChallenge(testInput);
735
- console.log(output);
736
 
737
- // 💡 Provide more specific requirements for a tailored solution!`;
738
- explanation = `💻 **Solution Template** - Customize based on your needs`;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
739
  }
740
-
741
- return `${explanation}\n\n\`\`\`${detectedLang}\n${code}\n\`\`\`\n\n✨ Need modifications? Just ask! I can adapt the code to your exact requirements.`;
742
- }
743
-
744
- // ========== HELPER FUNCTIONS ==========
745
- function escapeHtml(text) {
746
- const div = document.createElement('div');
747
- div.textContent = text;
748
- return div.innerHTML;
749
- }
750
 
751
- function renderContent(text) {
752
- const regex = /```(\w*)\n([\s\S]*?)```/g;
753
- let result = '';
754
- let lastIndex = 0;
755
- let match;
756
-
757
- while ((match = regex.exec(text)) !== null) {
758
- result += escapeHtml(text.substring(lastIndex, match.index)).replace(/\n/g, '<br>');
759
- result += `<pre><code>${escapeHtml(match[2].trim())}</code></pre>`;
760
- lastIndex = match.index + match[0].length;
761
- }
762
- result += escapeHtml(text.substring(lastIndex)).replace(/\n/g, '<br>');
763
- return result;
764
- }
765
 
766
- // ========== RENDER FUNCTION ==========
767
- function render() {
768
- const app = document.getElementById('app');
769
-
770
- // Password Gate
771
- if (!state.unlocked) {
772
- app.innerHTML = `
773
- <div class="header">
774
- <div class="logo">⟨/⟩</div>
775
- <h1>CODEFORGE</h1>
776
- <div class="subtitle">AI · CODE · GENERATOR</div>
777
- </div>
778
- <div class="password-box">
779
- <div style="color: rgba(255,140,0,0.4); font-size: 11px; letter-spacing: 3px;">🔐 ENTER ACCESS CODE</div>
780
- <input type="password" id="passwordInput" placeholder="••••••••••••••" autofocus onkeypress="if(event.key==='Enter') unlock()">
781
- <button onclick="unlock()">UNLOCK ACCESS →</button>
782
- </div>
783
- <div class="footer">PRIVATE ACCESS · AUTHORIZED ONLY</div>
784
- `;
785
- const input = document.getElementById('passwordInput');
786
- if (input) input.focus();
787
- return;
788
- }
789
-
790
- // Build messages HTML
791
- let messagesHtml = '';
792
- for (const msg of state.messages) {
793
- const isUser = msg.role === 'user';
794
- messagesHtml += `
795
- <div class="message ${isUser ? 'user-message' : 'assistant-message'}">
796
- <div style="display: flex; align-items: flex-start; gap: 12px;">
797
- <div class="message-avatar">${isUser ? '👤' : '⟨/⟩'}</div>
798
- <div style="flex: 1;">${renderContent(msg.content)}</div>
799
- </div>
800
- </div>
801
- `;
802
- }
803
-
804
- if (state.loading) {
805
- messagesHtml += `
806
- <div class="message assistant-message">
807
- <div style="display: flex; align-items: center; gap: 12px;">
808
- <div class="message-avatar">⟨/⟩</div>
809
- <div class="typing-indicator">
810
- <div class="typing-dot" style="animation-delay: 0s"></div>
811
- <div class="typing-dot" style="animation-delay: 0.2s"></div>
812
- <div class="typing-dot" style="animation-delay: 0.4s"></div>
813
- <span style="margin-left: 8px; color: rgba(255,140,0,0.5);">generating code...</span>
814
- </div>
815
- </div>
816
- </div>
817
- `;
818
- }
819
-
820
- const selectedLangLabel = LANGUAGES.find(l => l.id === state.selectedLang)?.label || '✦ Auto Detect';
821
-
822
- app.innerHTML = `
823
- <div class="header">
824
- <div class="logo">⟨/⟩</div>
825
- <h1>CODEFORGE</h1>
826
- </div>
827
-
828
- <div class="stats">⚡ ${state.promptCount} PROMPT${state.promptCount !== 1 ? 'S' : ''} · UNLIMITED · AI-POWERED</div>
829
-
830
- <div class="language-bar">
831
- <div class="lang-buttons">
832
- ${LANGUAGES.map(lang => `
833
- <button class="lang-btn ${state.selectedLang === lang.id ? 'active' : ''}" onclick="selectLang('${lang.id}')">
834
- ${lang.label}
835
- </button>
836
- `).join('')}
837
- </div>
838
- </div>
839
-
840
- <div class="examples">
841
- ${EXAMPLES.map(ex => `
842
- <button class="example-btn" onclick="useExample('${ex.replace(/'/g, "\\'")}')">▸ ${ex}</button>
843
- `).join('')}
844
- </div>
845
-
846
- <div class="chat-area" id="chatArea">
847
- ${messagesHtml || '<div style="text-align: center; color: rgba(255,255,255,0.12); padding: 50px;">✨ Describe the code you need to get started ✨</div>'}
848
- </div>
849
-
850
- <div class="input-area">
851
- <textarea id="userInput" rows="2" placeholder="Describe the code you need... (${selectedLangLabel})" onkeypress="handleKeyPress(event)"></textarea>
852
- <div class="button-group">
853
- <button onclick="sendMessage()" ${state.loading ? 'disabled' : ''}>▶ GENERATE CODE</button>
854
- <button class="btn-secondary" onclick="clearChat()">🗑️ CLEAR</button>
855
- <button class="btn-secondary" onclick="lockApp()">🔒 LOCK</button>
856
- </div>
857
- <div class="stats">⏎ ENTER to send · ⇧ ENTER for new line</div>
858
- </div>
859
-
860
- <div class="footer">CODEFORGE · ELITE AI CODE GENERATION · v2.0</div>
861
- `;
862
-
863
- // Scroll to bottom
864
- const chatArea = document.getElementById('chatArea');
865
- if (chatArea) chatArea.scrollTop = chatArea.scrollHeight;
866
-
867
- // Focus input
868
- const input = document.getElementById('userInput');
869
- if (input) input.focus();
870
- }
871
-
872
- // ========== EVENT HANDLERS ==========
873
- window.unlock = () => {
874
- const password = document.getElementById('passwordInput').value;
875
- if (password === PASSWORD) {
876
- state.unlocked = true;
877
  render();
878
- } else {
879
- alert('❌ ACCESS DENIED\nInvalid authorization code.');
880
- const input = document.getElementById('passwordInput');
881
- if (input) {
882
- input.value = '';
883
- input.focus();
884
- }
885
- }
886
- };
887
-
888
- window.selectLang = (langId) => {
889
- state.selectedLang = langId;
890
- render();
891
- };
892
-
893
- window.useExample = (example) => {
894
- const input = document.getElementById('userInput');
895
- if (input) input.value = example;
896
- };
897
-
898
- window.handleKeyPress = (event) => {
899
- if (event.key === 'Enter' && !event.shiftKey) {
900
- event.preventDefault();
901
- sendMessage();
902
- }
903
- };
904
-
905
- window.sendMessage = async () => {
906
- const input = document.getElementById('userInput');
907
- const text = input.value.trim();
908
- if (!text || state.loading) return;
909
-
910
- state.messages.push({ role: 'user', content: text });
911
- state.promptCount++;
912
- state.loading = true;
913
- render();
914
-
915
- input.value = '';
916
-
917
- const response = await generateResponse(text, state.selectedLang);
918
- state.messages.push({ role: 'assistant', content: response });
919
- state.loading = false;
920
  render();
921
- };
922
-
923
- window.clearChat = () => {
924
- if (confirm('Clear all messages? This cannot be undone.')) {
925
- state.messages = [];
926
- state.promptCount = 0;
927
- render();
928
- }
929
- };
930
-
931
- window.lockApp = () => {
932
- if (confirm('Lock the application? You will need the password again.')) {
933
- state.unlocked = false;
934
- state.messages = [];
935
- state.promptCount = 0;
936
- render();
937
- }
938
- };
939
-
940
- // ========== INITIAL RENDER ==========
941
- render();
942
- </script>
943
  </body>
944
- </html>
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>CodeForge · AI Code Generator</title>
7
  <style>
8
+ @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700;800&family=Space+Grotesk:wght@400;600&display=swap');
9
+
10
+ :root {
11
+ --accent: #ff8c00;
12
+ --accent-dim: rgba(255,140,0,0.15);
13
+ --accent-glow: rgba(255,140,0,0.5);
14
+ --bg: #09090e;
15
+ --surface: rgba(255,255,255,0.03);
16
+ --border: rgba(255,140,0,0.12);
17
+ --text: #d8d8d8;
18
+ --muted: rgba(255,255,255,0.25);
19
  }
20
 
21
+ * { margin: 0; padding: 0; box-sizing: border-box; }
22
+
23
  body {
24
+ background: var(--bg);
25
+ font-family: 'JetBrains Mono', monospace;
26
+ color: var(--text);
27
  min-height: 100vh;
28
+ overflow-x: hidden;
29
  }
30
 
 
31
  .grid-bg {
32
  position: fixed;
33
  inset: 0;
34
+ background-image:
35
+ linear-gradient(rgba(255,140,0,0.025) 1px, transparent 1px),
36
+ linear-gradient(90deg, rgba(255,140,0,0.025) 1px, transparent 1px);
37
+ background-size: 48px 48px;
38
  pointer-events: none;
39
  z-index: 0;
40
  }
41
+ .orb {
 
 
42
  position: fixed;
43
  border-radius: 50%;
 
44
  pointer-events: none;
45
  z-index: 0;
46
+ background: radial-gradient(circle, rgba(255,140,0,0.07) 0%, transparent 70%);
47
  }
48
+ .orb1 { top: 10%; left: 5%; width: 500px; height: 500px; }
49
+ .orb2 { bottom: 10%; right: 5%; width: 400px; height: 400px; }
 
50
 
51
+ .shell {
 
 
 
52
  position: relative;
53
  z-index: 1;
54
+ display: flex;
55
+ flex-direction: column;
56
+ height: 100dvh;
57
+ max-width: 920px;
58
+ margin: 0 auto;
59
+ padding: 0 16px;
60
  }
61
 
 
62
  .header {
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: space-between;
66
+ padding: 14px 0 12px;
67
+ border-bottom: 1px solid var(--border);
68
+ flex-shrink: 0;
69
+ }
70
+ .header-left { display: flex; align-items: center; gap: 12px; }
71
+ .logo-icon {
72
+ font-size: 26px;
73
+ color: var(--accent);
74
+ animation: logoPulse 3s ease-in-out infinite;
75
+ line-height: 1;
76
+ }
77
+ @keyframes logoPulse {
78
+ 0%,100% { filter: drop-shadow(0 0 6px var(--accent-glow)); }
79
+ 50% { filter: drop-shadow(0 0 18px var(--accent-glow)); }
80
+ }
81
+ .header h1 {
82
+ font-size: 17px;
83
+ font-weight: 800;
84
+ color: var(--accent);
85
+ letter-spacing: 6px;
86
+ }
87
+ .header-right {
88
+ display: flex;
89
+ align-items: center;
90
+ gap: 8px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
+ .stat-pill {
93
+ background: var(--accent-dim);
94
+ border: 1px solid var(--border);
95
+ border-radius: 20px;
96
+ color: rgba(255,140,0,0.7);
97
+ font-size: 10px;
98
+ letter-spacing: 1px;
99
+ padding: 4px 10px;
100
  }
101
 
 
102
  button {
103
+ font-family: 'JetBrains Mono', monospace;
 
 
 
 
104
  cursor: pointer;
105
+ border: none;
106
+ border-radius: 3px;
107
+ transition: all 0.18s;
 
 
108
  }
109
+ .btn-primary {
110
+ background: var(--accent);
111
+ color: #0a0a0f;
112
+ font-weight: 800;
113
+ font-size: 11px;
114
+ letter-spacing: 2px;
115
+ padding: 10px 22px;
116
+ }
117
+ .btn-primary:hover:not(:disabled) {
118
  background: #ffaa33;
119
+ box-shadow: 0 0 18px var(--accent-glow);
120
  transform: translateY(-1px);
121
  }
122
+ .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
123
 
124
+ .btn-ghost {
125
+ background: var(--surface);
126
+ border: 1px solid rgba(255,255,255,0.07);
127
+ color: var(--muted);
128
+ font-size: 10px;
129
+ letter-spacing: 1.5px;
130
+ padding: 8px 14px;
 
 
 
 
 
 
 
 
131
  }
132
+ .btn-ghost:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.6); }
133
 
134
+ .btn-copy {
135
+ background: rgba(255,140,0,0.08);
136
+ border: 1px solid rgba(255,140,0,0.2);
137
+ color: rgba(255,140,0,0.7);
138
+ font-size: 9px;
139
+ letter-spacing: 1px;
140
+ padding: 4px 10px;
141
  }
142
+ .btn-copy:hover { background: rgba(255,140,0,0.18); color: var(--accent); }
143
+ .btn-copy.copied {
144
+ background: rgba(80,220,100,0.1);
145
+ border-color: rgba(80,220,100,0.3);
146
+ color: rgba(80,220,100,0.9);
147
  }
148
 
149
+ .lang-bar {
150
+ flex-shrink: 0;
151
+ padding: 10px 0;
152
+ border-bottom: 1px solid rgba(255,140,0,0.07);
153
+ overflow-x: auto;
154
+ scrollbar-width: none;
 
 
 
 
 
155
  }
156
+ .lang-bar::-webkit-scrollbar { display: none; }
157
+ .lang-inner {
158
  display: flex;
159
+ gap: 6px;
160
+ white-space: nowrap;
 
161
  }
 
162
  .lang-btn {
163
+ background: var(--surface);
164
+ border: 1px solid rgba(255,255,255,0.06);
165
+ color: rgba(255,255,255,0.35);
166
+ font-size: 10px;
167
+ font-family: 'JetBrains Mono', monospace;
168
+ letter-spacing: 0.5px;
169
+ padding: 5px 13px;
170
+ border-radius: 2px;
171
+ transition: all 0.15s;
172
  }
173
+ .lang-btn:hover { color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.06); }
174
  .lang-btn.active {
175
+ background: var(--accent-dim);
176
+ border-color: rgba(255,140,0,0.35);
177
+ color: var(--accent);
178
  font-weight: 700;
179
  }
180
 
 
 
 
 
 
 
 
 
 
 
181
  .examples {
182
+ flex-shrink: 0;
183
+ padding: 10px 0;
184
+ overflow-x: auto;
185
+ scrollbar-width: none;
 
186
  }
187
+ .examples::-webkit-scrollbar { display: none; }
188
+ .examples-inner {
189
+ display: flex;
190
+ gap: 7px;
191
+ white-space: nowrap;
 
 
 
 
192
  }
193
+ .ex-btn {
194
+ background: rgba(255,140,0,0.04);
195
+ border: 1px solid rgba(255,140,0,0.13);
196
+ color: rgba(255,140,0,0.55);
197
+ font-size: 10px;
198
+ font-family: 'JetBrains Mono', monospace;
199
+ padding: 6px 13px;
200
+ border-radius: 2px;
201
+ transition: all 0.15s;
202
  }
203
+ .ex-btn:hover { background: rgba(255,140,0,0.1); color: var(--accent); }
204
 
 
205
  .chat-area {
206
+ flex: 1;
 
207
  overflow-y: auto;
208
+ padding: 16px 4px;
209
+ scroll-behavior: smooth;
210
  }
211
+ .empty-state {
212
+ display: flex;
213
+ flex-direction: column;
214
+ align-items: center;
215
+ justify-content: center;
216
+ height: 100%;
217
+ gap: 12px;
218
+ color: rgba(255,255,255,0.1);
219
+ font-size: 12px;
220
+ letter-spacing: 2px;
221
+ text-align: center;
222
+ }
223
+ .empty-state .big { font-size: 40px; opacity: 0.15; }
224
 
225
  .message {
226
+ display: flex;
227
+ gap: 10px;
228
+ margin-bottom: 16px;
229
+ animation: msgIn 0.28s ease forwards;
230
  }
231
+ @keyframes msgIn {
232
+ from { opacity: 0; transform: translateY(12px); }
233
+ to { opacity: 1; transform: translateY(0); }
 
 
 
 
 
 
 
234
  }
235
+ .message.user { flex-direction: row-reverse; }
236
 
237
+ .avatar {
238
+ flex-shrink: 0;
239
+ width: 30px;
240
+ height: 30px;
241
+ border-radius: 3px;
242
+ display: flex;
243
+ align-items: center;
244
+ justify-content: center;
245
+ font-size: 13px;
246
+ font-weight: 700;
247
  }
248
+ .message.user .avatar {
249
+ background: rgba(255,140,0,0.12);
250
+ border: 1px solid rgba(255,140,0,0.25);
251
+ color: var(--accent);
 
 
252
  }
253
+ .message.assistant .avatar {
254
+ background: rgba(255,255,255,0.04);
255
+ border: 1px solid rgba(255,255,255,0.08);
256
+ color: rgba(255,255,255,0.4);
 
 
 
 
 
 
 
 
 
257
  }
258
 
259
+ .bubble {
260
+ max-width: 82%;
261
+ padding: 12px 14px;
 
 
 
262
  border-radius: 4px;
 
263
  font-size: 13px;
264
+ line-height: 1.65;
265
+ word-break: break-word;
266
  }
267
+ .message.user .bubble {
268
+ background: rgba(255,140,0,0.08);
269
+ border: 1px solid rgba(255,140,0,0.18);
270
+ color: #ffb347;
271
+ border-radius: 6px 2px 6px 6px;
272
  }
273
+ .message.assistant .bubble {
274
+ background: rgba(255,255,255,0.025);
275
+ border: 1px solid rgba(255,255,255,0.06);
276
+ color: #ccc;
277
+ border-radius: 2px 6px 6px 6px;
 
 
 
 
 
278
  }
279
 
280
+ .code-block {
281
+ margin: 12px 0;
 
 
 
282
  border-radius: 4px;
283
+ overflow: hidden;
284
+ border: 1px solid rgba(255,140,0,0.14);
 
 
 
 
 
 
285
  }
286
+ .code-header {
 
 
 
 
 
 
287
  display: flex;
288
+ justify-content: space-between;
289
+ align-items: center;
290
+ background: rgba(0,0,0,0.5);
291
+ padding: 7px 12px;
292
+ border-bottom: 1px solid rgba(255,255,255,0.05);
293
  }
294
+ .code-lang {
295
+ font-size: 10px;
296
+ font-weight: 700;
297
+ color: var(--accent);
298
+ letter-spacing: 2px;
299
+ text-transform: uppercase;
300
  }
301
+ .code-block pre {
302
+ background: rgba(0,0,0,0.55);
303
+ padding: 14px 16px;
304
+ overflow-x: auto;
305
+ margin: 0;
 
 
306
  }
307
+ .code-block pre code {
308
+ color: #d4d4d4;
309
+ font-size: 12.5px;
310
+ line-height: 1.65;
 
 
 
311
  }
312
 
313
+ .typing-wrap { display: flex; align-items: center; gap: 5px; padding: 4px 0; }
314
+ .dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; animation: dotPop 1.1s ease-in-out infinite; }
315
+ .dot:nth-child(2) { animation-delay: 0.18s; }
316
+ .dot:nth-child(3) { animation-delay: 0.36s; }
317
+ @keyframes dotPop { 0%,100% { opacity: 0.2; transform: scale(0.75); } 50% { opacity: 1; transform: scale(1.25); } }
318
 
319
+ .input-area { flex-shrink: 0; padding: 12px 0 16px; border-top: 1px solid rgba(255,140,0,0.09); }
320
+ textarea {
321
+ width: 100%; padding: 12px 14px; background: rgba(255,255,255,0.035); border: 1px solid rgba(255,140,0,0.15);
322
+ border-radius: 4px; color: #e0e0e0; font-family: 'JetBrains Mono', monospace; font-size: 13px;
323
+ line-height: 1.6; resize: none; outline: none; min-height: 60px; max-height: 160px;
 
 
 
324
  }
325
 
326
+ .gate { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100dvh; z-index: 1; }
327
+ .gate-card { background: rgba(255,140,0,0.03); border: 1px solid var(--border); border-radius: 6px; padding: 40px; max-width: 380px; width: 90%; text-align: center; backdrop-filter: blur(12px); }
328
+ .gate-title { font-size: 26px; font-weight: 800; color: var(--accent); letter-spacing: 8px; margin-bottom: 28px; }
329
+ .gate-input { width: 100%; padding: 13px 16px; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,140,0,0.2); border-radius: 3px; color: var(--accent); font-family: 'JetBrains Mono', monospace; letter-spacing: 4px; text-align: center; outline: none; margin-bottom: 18px; }
330
+ .gate-error { color: #ff6b6b; font-size: 11px; min-height: 16px; margin-top: 10px; }
 
 
 
 
 
 
 
331
 
332
+ @media (max-width: 600px) { .header h1 { font-size: 13px; letter-spacing: 4px; } .bubble { max-width: 92%; } }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
  </style>
334
  </head>
335
  <body>
336
+ <div class="grid-bg"></div>
337
+ <div class="orb orb1"></div>
338
+ <div class="orb orb2"></div>
339
+ <div id="root"></div>
340
+
341
+ <script>
342
+ const PASSWORD = "CodeForge#2026";
343
+ const LANGUAGES = [
344
+ { id: "auto", label: "✦ Auto" },
345
+ { id: "javascript", label: "JS" },
346
+ { id: "python", label: "Python" },
347
+ { id: "html", label: "HTML/CSS" }
348
+ ];
349
+
350
+ const state = { unlocked: false, messages: [], lang: "auto", count: 0, loading: false };
351
+
352
+ function escHtml(s) { return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"); }
353
+
354
+ function renderMarkdown(text) {
355
+ let result = text.replace(/```(\w*)\n?([\s\S]*?)```/g, (_, lang, code) => {
356
+ return `<div class="code-block"><div class="code-header"><span class="code-lang">${lang || 'code'}</span><button class="btn-copy" onclick="copyCode(this)">⎘ COPY</button></div><pre><code>${escHtml(code.trim())}</code></pre></div>`;
357
+ });
358
+ return result.replace(/\n/g, "<br>");
359
+ }
360
+
361
+ window.copyCode = async (btn) => {
362
+ const code = btn.closest(".code-block").querySelector("code").innerText;
363
+ await navigator.clipboard.writeText(code);
364
+ btn.textContent = "✓ COPIED";
365
+ setTimeout(() => btn.textContent = "⎘ COPY", 2000);
366
+ };
367
+
368
+ function render() {
369
+ const root = document.getElementById("root");
370
+ if (!state.unlocked) {
371
+ root.innerHTML = `<div class="gate"><div class="gate-card"><div class="gate-title">CODEFORGE</div><input class="gate-input" id="pwInput" type="password" placeholder="••••" onkeydown="if(event.key==='Enter') tryUnlock()"><button class="btn-primary" style="width:100%" onclick="tryUnlock()">UNLOCK →</button><div class="gate-error" id="gateErr"></div></div></div>`;
372
+ return;
373
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
 
375
+ let msgHtml = state.messages.map(m => `
376
+ <div class="message ${m.role === 'user' ? 'user' : 'assistant'}">
377
+ <div class="avatar">${m.role === 'user' ? 'U' : '⟨/⟩'}</div>
378
+ <div class="bubble">${m.role === 'user' ? escHtml(m.content) : renderMarkdown(m.content)}</div>
379
+ </div>
380
+ `).join("");
381
+
382
+ root.innerHTML = `
383
+ <div class="shell">
384
+ <div class="header"><h1>CODEFORGE</h1><button class="btn-ghost" onclick="state.unlocked=false;render()">🔒 Lock</button></div>
385
+ <div class="chat-area" id="chatArea">${msgHtml || '<div class="empty-state">Ready for input</div>'}</div>
386
+ <div class="input-area">
387
+ <textarea id="userInput" placeholder="Describe code..." onkeydown="if(event.key==='Enter'&&!event.shiftKey){event.preventDefault();sendMessage();}"></textarea>
388
+ <button class="btn-primary" style="width:100%;margin-top:10px" onclick="sendMessage()">GENERATE</button>
389
+ </div>
390
+ </div>`;
391
+ const chat = document.getElementById("chatArea");
392
+ if(chat) chat.scrollTop = chat.scrollHeight;
393
  }
 
 
 
 
 
 
 
 
 
 
394
 
395
+ window.tryUnlock = () => {
396
+ if (document.getElementById("pwInput").value === PASSWORD) { state.unlocked = true; render(); }
397
+ else { document.getElementById("gateErr").textContent = "Invalid Code"; }
398
+ };
 
 
 
 
 
 
 
 
 
 
399
 
400
+ window.sendMessage = () => {
401
+ const inp = document.getElementById("userInput");
402
+ if (!inp.value.trim()) return;
403
+ state.messages.push({ role: "user", content: inp.value });
404
+ inp.value = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  render();
406
+ // Mock response logic here
407
+ };
408
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  render();
410
+ </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
411
  </body>
412
+ </html>