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

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +289 -241
index.html CHANGED
@@ -2,7 +2,7 @@
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
6
  <title>CodeForge · AI Code Generator</title>
7
  <style>
8
  * {
@@ -18,23 +18,7 @@
18
  min-height: 100vh;
19
  }
20
 
21
- /* Custom scrollbar */
22
- ::-webkit-scrollbar {
23
- width: 6px;
24
- height: 6px;
25
- }
26
- ::-webkit-scrollbar-track {
27
- background: rgba(255, 255, 255, 0.02);
28
- }
29
- ::-webkit-scrollbar-thumb {
30
- background: rgba(255, 140, 0, 0.3);
31
- border-radius: 3px;
32
- }
33
- ::-webkit-scrollbar-thumb:hover {
34
- background: rgba(255, 140, 0, 0.5);
35
- }
36
-
37
- /* Grid background */
38
  .grid-bg {
39
  position: fixed;
40
  inset: 0;
@@ -45,6 +29,18 @@
45
  z-index: 0;
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  .container {
49
  max-width: 1000px;
50
  margin: 0 auto;
@@ -56,35 +52,36 @@
56
  /* Header */
57
  .header {
58
  text-align: center;
59
- padding: 20px 0;
60
- border-bottom: 1px solid rgba(255, 140, 0, 0.1);
61
  margin-bottom: 30px;
62
  }
63
 
64
  .logo {
65
- font-size: 64px;
66
  color: #ff8c00;
67
- filter: drop-shadow(0 0 20px rgba(255, 140, 0, 0.6));
68
  animation: glow 2s ease-in-out infinite;
 
69
  }
70
 
71
  @keyframes glow {
72
- 0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 140, 0, 0.6)); }
73
- 50% { filter: drop-shadow(0 0 30px rgba(255, 140, 0, 0.9)); }
74
  }
75
 
76
  h1 {
77
- font-size: 28px;
78
  color: #ff8c00;
79
- letter-spacing: 8px;
80
  margin: 10px 0 5px;
81
  font-weight: 900;
82
  }
83
 
84
  .subtitle {
85
  color: rgba(255, 140, 0, 0.5);
86
- letter-spacing: 4px;
87
- font-size: 10px;
88
  }
89
 
90
  /* Password Box */
@@ -92,10 +89,11 @@
92
  background: rgba(255, 140, 0, 0.04);
93
  border: 1px solid rgba(255, 140, 0, 0.15);
94
  border-radius: 4px;
95
- padding: 40px;
96
  max-width: 420px;
97
  margin: 60px auto;
98
  backdrop-filter: blur(10px);
 
99
  }
100
 
101
  .password-box input {
@@ -107,27 +105,29 @@
107
  color: #ff8c00;
108
  font-family: 'Courier New', monospace;
109
  font-size: 14px;
110
- letter-spacing: 2px;
111
- margin: 20px 0;
112
  outline: none;
113
- transition: border-color 0.2s;
 
114
  }
115
 
116
  .password-box input:focus {
117
  border-color: rgba(255, 140, 0, 0.6);
 
118
  }
119
 
120
  /* Buttons */
121
  button {
122
  background: #ff8c00;
123
  color: #0a0a0f;
124
- padding: 12px 24px;
125
  border: none;
126
  font-weight: 900;
127
  cursor: pointer;
128
  font-family: 'Courier New', monospace;
129
  font-size: 12px;
130
- letter-spacing: 2px;
131
  transition: all 0.2s;
132
  border-radius: 2px;
133
  }
@@ -147,6 +147,7 @@
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
  }
151
 
152
  .btn-secondary:hover {
@@ -165,15 +166,16 @@
165
  box-shadow: none;
166
  }
167
 
168
- /* Language Selector */
169
  .language-bar {
170
  position: sticky;
171
  top: 0;
172
  background: rgba(10, 10, 15, 0.95);
173
  backdrop-filter: blur(12px);
174
  padding: 12px 0;
175
- margin-bottom: 20px;
176
- border-bottom: 1px solid rgba(255, 140, 0, 0.06);
 
177
  z-index: 10;
178
  }
179
 
@@ -216,7 +218,7 @@
216
  flex-wrap: wrap;
217
  gap: 10px;
218
  justify-content: center;
219
- margin: 20px 0;
220
  }
221
 
222
  .example-btn {
@@ -226,24 +228,26 @@
226
  padding: 8px 16px;
227
  font-size: 11px;
228
  width: auto;
 
229
  }
230
 
231
  .example-btn:hover {
232
  background: rgba(255, 140, 0, 0.1);
233
  color: #ff8c00;
234
  box-shadow: none;
 
235
  }
236
 
237
  /* Chat Area */
238
  .chat-area {
239
  margin: 20px 0;
240
- max-height: 500px;
241
  overflow-y: auto;
242
  padding: 10px;
243
  }
244
 
245
  .message {
246
- margin: 20px 0;
247
  padding: 14px 18px;
248
  border-radius: 8px;
249
  animation: slideIn 0.3s ease;
@@ -277,31 +281,26 @@
277
 
278
  .message-avatar {
279
  display: inline-block;
280
- width: 32px;
281
- height: 32px;
282
  border-radius: 2px;
283
  background: rgba(255, 140, 0, 0.1);
284
  border: 1px solid rgba(255, 140, 0, 0.3);
285
  text-align: center;
286
- line-height: 30px;
287
  margin-right: 12px;
288
- font-size: 14px;
289
- }
290
-
291
- .message-content {
292
- display: inline-block;
293
- max-width: 85%;
294
- vertical-align: top;
295
  }
296
 
297
  /* Code Blocks */
298
  pre {
299
- background: rgba(0, 0, 0, 0.5);
300
  padding: 16px;
301
  overflow-x: auto;
302
  margin: 12px 0;
303
  border-radius: 4px;
304
- border: 1px solid rgba(255, 140, 0, 0.1);
305
  font-size: 13px;
306
  line-height: 1.6;
307
  }
@@ -335,7 +334,7 @@
335
  resize: vertical;
336
  margin: 10px 0;
337
  outline: none;
338
- transition: border-color 0.2s;
339
  }
340
 
341
  textarea:focus {
@@ -353,16 +352,17 @@
353
  flex: 1;
354
  }
355
 
 
356
  .typing-indicator {
357
  display: inline-flex;
358
- gap: 4px;
359
  align-items: center;
360
  padding: 8px 0;
361
  }
362
 
363
  .typing-dot {
364
- width: 6px;
365
- height: 6px;
366
  background: #ff8c00;
367
  border-radius: 50%;
368
  animation: pulse 1.2s ease-in-out infinite;
@@ -376,33 +376,55 @@
376
  /* Footer */
377
  .footer {
378
  text-align: center;
379
- color: rgba(255, 255, 255, 0.08);
380
  font-size: 9px;
381
  letter-spacing: 2px;
382
  margin-top: 20px;
383
  padding: 15px;
384
  }
385
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  @media (max-width: 768px) {
387
  .container {
388
- padding: 15px;
389
  }
390
  h1 {
391
  font-size: 22px;
392
- letter-spacing: 4px;
393
  }
394
  .logo {
395
- font-size: 48px;
396
  }
397
  .password-box {
398
  padding: 25px;
399
  margin: 30px auto;
400
  }
 
 
 
 
401
  }
402
  </style>
403
  </head>
404
  <body>
405
  <div class="grid-bg"></div>
 
 
 
 
406
  <div class="container" id="app"></div>
407
 
408
  <script>
@@ -410,26 +432,27 @@
410
  const PASSWORD = "CodeForge#2026";
411
 
412
  const LANGUAGES = [
413
- { id: "auto", label: "Auto Detect", icon: "" },
414
- { id: "javascript", label: "JavaScript", icon: "JS" },
415
- { id: "typescript", label: "TypeScript", icon: "TS" },
416
- { id: "python", label: "Python", icon: "PY" },
417
- { id: "html", label: "HTML/CSS", icon: "HT" },
418
- { id: "react", label: "React JSX", icon: "" },
419
- { id: "sql", label: "SQL", icon: "DB" },
420
- { id: "bash", label: "Bash/Shell", icon: "SH" },
421
- { id: "rust", label: "Rust", icon: "RS" },
422
- { id: "go", label: "Go", icon: "GO" },
423
- { id: "java", label: "Java", icon: "JV" },
424
- { id: "cpp", label: "C++", icon: "C+" }
425
  ];
426
 
427
- const EXAMPLE_PROMPTS = [
428
  "Build a REST API with authentication",
429
  "Create a responsive navbar component",
430
  "Write a binary search algorithm",
431
  "Make a SQL query for user analytics",
432
- "Build a Python web scraper"
 
433
  ];
434
 
435
  // ========== APP STATE ==========
@@ -441,30 +464,29 @@
441
  loading: false
442
  };
443
 
444
- // ========== AI RESPONSE GENERATOR (Mock) ==========
445
- async function generateAIResponse(prompt, language) {
446
- await new Promise(resolve => setTimeout(resolve, 1000 + Math.random() * 500));
447
 
448
- const lower = prompt.toLowerCase();
449
- let code = "";
450
- let explanation = "";
451
  let detectedLang = language !== "auto" ? language : "javascript";
452
 
453
- if (lower.includes("rest api") || lower.includes("api with auth")) {
 
454
  code = `const express = require('express');
455
  const jwt = require('jsonwebtoken');
456
  const app = express();
457
 
458
  app.use(express.json());
459
 
460
- // Middleware to verify token
461
  function authenticateToken(req, res, next) {
462
  const authHeader = req.headers['authorization'];
463
  const token = authHeader && authHeader.split(' ')[1];
464
-
465
  if (!token) return res.sendStatus(401);
466
 
467
- jwt.verify(token, 'your-secret-key', (err, user) => {
468
  if (err) return res.sendStatus(403);
469
  req.user = user;
470
  next();
@@ -473,22 +495,22 @@ function authenticateToken(req, res, next) {
473
 
474
  // Login endpoint
475
  app.post('/login', (req, res) => {
476
- const { username, password } = req.body;
477
- // In production, validate credentials against database
478
- const token = jwt.sign({ username }, 'your-secret-key', { expiresIn: '1h' });
479
  res.json({ token });
480
  });
481
 
482
- // Protected endpoint
483
  app.get('/protected', authenticateToken, (req, res) => {
484
  res.json({ message: 'Access granted', user: req.user });
485
  });
486
 
487
  app.listen(3000, () => console.log('Server running on port 3000'));`;
488
- explanation = "✅ Here's a secure REST API with JWT authentication using Express.js.";
489
  detectedLang = "javascript";
490
- }
491
- else if (lower.includes("navbar") || lower.includes("responsive nav")) {
 
492
  code = `<nav class="navbar">
493
  <div class="logo">⟨/⟩ CodeForge</div>
494
  <ul class="nav-links">
@@ -501,69 +523,62 @@ app.listen(3000, () => console.log('Server running on port 3000'));`;
501
  </nav>
502
 
503
  <style>
504
- .navbar {
505
- display: flex;
506
- justify-content: space-between;
507
- align-items: center;
508
- background: #0a0a0f;
509
- padding: 1rem 2rem;
510
- border-bottom: 1px solid rgba(255,140,0,0.2);
511
- }
512
- .logo {
513
- color: #ff8c00;
514
- font-size: 1.5rem;
515
- font-weight: bold;
516
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
517
  .nav-links {
518
- display: flex;
519
- gap: 2rem;
520
- list-style: none;
521
- }
522
- .nav-links a {
523
- color: white;
524
- text-decoration: none;
525
- transition: color 0.3s;
526
- }
527
- .nav-links a:hover {
528
- color: #ff8c00;
529
- }
530
- .burger {
531
  display: none;
532
- font-size: 1.5rem;
533
- cursor: pointer;
534
- color: white;
535
- }
536
- @media (max-width: 768px) {
537
- .nav-links {
538
- display: none;
539
- position: absolute;
540
- top: 70px;
541
- left: 0;
542
- width: 100%;
543
- background: #0a0a0f;
544
- flex-direction: column;
545
- text-align: center;
546
- padding: 1rem;
547
- border-bottom: 1px solid rgba(255,140,0,0.2);
548
- }
549
- .nav-links.active {
550
- display: flex;
551
- }
552
- .burger {
553
- display: block;
554
- }
555
  }
 
 
 
556
  </style>
557
-
558
  <script>
559
- function toggleMenu() {
560
- document.querySelector('.nav-links').classList.toggle('active');
561
- }
562
  </script>`;
563
- explanation = "🎨 Responsive navbar component with mobile hamburger menu.";
564
  detectedLang = "html";
565
  }
566
- else if (lower.includes("binary search") || lower.includes("search algorithm")) {
 
567
  code = `function binarySearch(arr, target) {
568
  let left = 0;
569
  let right = arr.length - 1;
@@ -571,122 +586,156 @@ app.listen(3000, () => console.log('Server running on port 3000'));`;
571
  while (left <= right) {
572
  const mid = Math.floor((left + right) / 2);
573
 
574
- if (arr[mid] === target) {
575
- return mid; // Target found
576
- }
577
-
578
- if (arr[mid] < target) {
579
- left = mid + 1; // Search right half
580
- } else {
581
- right = mid - 1; // Search left half
582
- }
583
  }
584
-
585
- return -1; // Target not found
586
  }
587
 
588
- // Example usage
589
- const sortedArray = [2, 5, 8, 12, 16, 23, 38, 56, 72, 91];
590
  const target = 23;
591
- const result = binarySearch(sortedArray, target);
592
-
593
- console.log(\`Element found at index: \${result}\`); // Output: 5`;
594
- explanation = "🔍 Binary search algorithm - O(log n) time complexity.";
595
  detectedLang = "javascript";
596
  }
597
- else if (lower.includes("sql") || lower.includes("query") || lower.includes("analytics")) {
 
598
  code = `SELECT
599
  u.country,
 
600
  COUNT(DISTINCT u.user_id) AS total_users,
601
  AVG(s.session_duration) AS avg_session_minutes,
602
  SUM(s.pages_viewed) AS total_pageviews,
603
  COUNT(DISTINCT DATE(s.session_date)) AS active_days
604
  FROM users u
605
- JOIN sessions s ON u.user_id = s.user_id
606
  WHERE s.session_date >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)
607
- GROUP BY u.country
 
608
  HAVING total_users > 5
609
- ORDER BY total_users DESC
610
- LIMIT 10;`;
611
- explanation = "📊 SQL query for user analytics - top countries by engagement.";
612
  detectedLang = "sql";
613
  }
614
- else if (lower.includes("python") || lower.includes("scraper")) {
 
615
  code = `import requests
616
  from bs4 import BeautifulSoup
617
- import json
618
 
619
- def scrape_website(url):
620
- headers = {
621
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
622
- }
623
 
624
- try:
625
- response = requests.get(url, headers=headers, timeout=10)
626
- response.raise_for_status()
627
-
628
- soup = BeautifulSoup(response.text, 'html.parser')
629
-
630
- # Extract all text
631
- text_content = soup.get_text(strip=True)
632
-
633
- # Extract all links
634
- links = [a.get('href') for a in soup.find_all('a', href=True)]
635
-
636
- return {
637
- 'url': url,
638
- 'title': soup.title.string if soup.title else 'No title',
639
- 'text_length': len(text_content),
640
- 'links_count': len(links),
641
- 'sample_links': links[:10]
642
- }
643
-
644
- except requests.RequestException as e:
645
- return {'error': str(e)}
646
 
647
- # Example usage
648
  if __name__ == '__main__':
649
- result = scrape_website('https://example.com')
650
- print(json.dumps(result, indent=2))`;
651
- explanation = "🕷️ Python web scraper using requests and BeautifulSoup.";
652
  detectedLang = "python";
653
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
654
  else {
655
- code = `// Solution for: ${prompt.substring(0, 50)}${prompt.length > 50 ? '...' : ''}
656
- // CodeForge AI Generated
657
 
658
  function solveChallenge(input) {
659
- // TODO: Implement your logic here
660
- // Based on your requirements, customize this solution
661
 
662
  if (!input) {
663
  throw new Error('Input is required');
664
  }
665
 
666
- // Process the input
667
  const result = processData(input);
668
 
669
- return result;
670
- }
671
-
672
- function processData(data) {
673
- // Add your processing logic here
674
  return {
675
- status: 'success',
676
- data: data,
677
  timestamp: new Date().toISOString()
678
  };
679
  }
680
 
 
 
 
 
 
681
  // Example usage
682
- const testInput = { example: 'test' };
683
  const output = solveChallenge(testInput);
684
  console.log(output);
685
 
686
- // Feel free to provide more specific requirements
687
- // for a tailored solution! 💡
688
- `;
689
- explanation = "💻 Here's a template solution. Provide more details for a customized response!";
690
  }
691
 
692
  return `${explanation}\n\n\`\`\`${detectedLang}\n${code}\n\`\`\`\n\n✨ Need modifications? Just ask! I can adapt the code to your exact requirements.`;
@@ -700,18 +749,17 @@ console.log(output);
700
  }
701
 
702
  function renderContent(text) {
703
- const codeBlockRegex = /```(\w*)\n([\s\S]*?)```/g;
704
  let result = '';
705
  let lastIndex = 0;
706
  let match;
707
 
708
- while ((match = codeBlockRegex.exec(text)) !== null) {
709
  result += escapeHtml(text.substring(lastIndex, match.index)).replace(/\n/g, '<br>');
710
- result += `<pre><code class="language-${match[1] || 'code'}">${escapeHtml(match[2].trim())}</code></pre>`;
711
  lastIndex = match.index + match[0].length;
712
  }
713
  result += escapeHtml(text.substring(lastIndex)).replace(/\n/g, '<br>');
714
-
715
  return result;
716
  }
717
 
@@ -728,25 +776,25 @@ console.log(output);
728
  <div class="subtitle">AI · CODE · GENERATOR</div>
729
  </div>
730
  <div class="password-box">
731
- <div style="text-align: center; color: rgba(255,140,0,0.4); font-size: 11px; letter-spacing: 3px;">ENTER ACCESS CODE</div>
732
- <input type="password" id="passwordInput" placeholder="••••••••••••••" onkeypress="if(event.key==='Enter') unlock()">
733
  <button onclick="unlock()">UNLOCK ACCESS →</button>
734
  </div>
735
- <div class="footer">PRIVATE ACCESS ONLY</div>
736
  `;
737
  const input = document.getElementById('passwordInput');
738
  if (input) input.focus();
739
  return;
740
  }
741
 
742
- // Main App
743
  let messagesHtml = '';
744
  for (const msg of state.messages) {
745
  const isUser = msg.role === 'user';
746
  messagesHtml += `
747
  <div class="message ${isUser ? 'user-message' : 'assistant-message'}">
748
  <div style="display: flex; align-items: flex-start; gap: 12px;">
749
- <div class="message-avatar">${isUser ? 'YOU' : '⟨/⟩'}</div>
750
  <div style="flex: 1;">${renderContent(msg.content)}</div>
751
  </div>
752
  </div>
@@ -762,14 +810,14 @@ console.log(output);
762
  <div class="typing-dot" style="animation-delay: 0s"></div>
763
  <div class="typing-dot" style="animation-delay: 0.2s"></div>
764
  <div class="typing-dot" style="animation-delay: 0.4s"></div>
765
- <span style="margin-left: 8px; color: rgba(255,140,0,0.6);">generating...</span>
766
  </div>
767
  </div>
768
  </div>
769
  `;
770
  }
771
 
772
- const selectedLangLabel = LANGUAGES.find(l => l.id === state.selectedLang)?.label || 'Auto Detect';
773
 
774
  app.innerHTML = `
775
  <div class="header">
@@ -777,39 +825,39 @@ console.log(output);
777
  <h1>CODEFORGE</h1>
778
  </div>
779
 
780
- <div class="stats">⚡ ${state.promptCount} PROMPT${state.promptCount !== 1 ? 'S' : ''} · UNLIMITED</div>
781
 
782
  <div class="language-bar">
783
  <div class="lang-buttons">
784
  ${LANGUAGES.map(lang => `
785
  <button class="lang-btn ${state.selectedLang === lang.id ? 'active' : ''}" onclick="selectLang('${lang.id}')">
786
- ${lang.icon} ${lang.label}
787
  </button>
788
  `).join('')}
789
  </div>
790
  </div>
791
 
792
  <div class="examples">
793
- ${EXAMPLE_PROMPTS.map(ex => `
794
  <button class="example-btn" onclick="useExample('${ex.replace(/'/g, "\\'")}')">▸ ${ex}</button>
795
  `).join('')}
796
  </div>
797
 
798
  <div class="chat-area" id="chatArea">
799
- ${messagesHtml || '<div style="text-align: center; color: rgba(255,255,255,0.15); padding: 40px;">✨ Describe the code you need to get started ✨</div>'}
800
  </div>
801
 
802
  <div class="input-area">
803
  <textarea id="userInput" rows="2" placeholder="Describe the code you need... (${selectedLangLabel})" onkeypress="handleKeyPress(event)"></textarea>
804
  <div class="button-group">
805
- <button onclick="sendMessage()" ${state.loading ? 'disabled' : ''}>▶ GENERATE</button>
806
- <button class="btn-secondary" onclick="clearChat()"> CLEAR</button>
807
- <button class="btn-secondary" onclick="lockApp()">LOCK</button>
808
  </div>
809
  <div class="stats">⏎ ENTER to send · ⇧ ENTER for new line</div>
810
  </div>
811
 
812
- <div class="footer">CODEFORGE · ELITE AI CODE GENERATION</div>
813
  `;
814
 
815
  // Scroll to bottom
@@ -828,7 +876,7 @@ console.log(output);
828
  state.unlocked = true;
829
  render();
830
  } else {
831
- alert('❌ Access Denied. Invalid code.');
832
  const input = document.getElementById('passwordInput');
833
  if (input) {
834
  input.value = '';
@@ -866,14 +914,14 @@ console.log(output);
866
 
867
  input.value = '';
868
 
869
- const response = await generateAIResponse(text, state.selectedLang);
870
  state.messages.push({ role: 'assistant', content: response });
871
  state.loading = false;
872
  render();
873
  };
874
 
875
  window.clearChat = () => {
876
- if (confirm('Clear all messages?')) {
877
  state.messages = [];
878
  state.promptCount = 0;
879
  render();
@@ -881,7 +929,7 @@ console.log(output);
881
  };
882
 
883
  window.lockApp = () => {
884
- if (confirm('Lock the app? You will need the password again.')) {
885
  state.unlocked = false;
886
  state.messages = [];
887
  state.promptCount = 0;
 
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>CodeForge · AI Code Generator</title>
7
  <style>
8
  * {
 
18
  min-height: 100vh;
19
  }
20
 
21
+ /* Animated grid background */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  .grid-bg {
23
  position: fixed;
24
  inset: 0;
 
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;
 
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 */
 
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 {
 
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
  }
 
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 {
 
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
 
 
218
  flex-wrap: wrap;
219
  gap: 10px;
220
  justify-content: center;
221
+ margin: 20px 0 25px;
222
  }
223
 
224
  .example-btn {
 
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;
 
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
  }
 
334
  resize: vertical;
335
  margin: 10px 0;
336
  outline: none;
337
+ transition: all 0.2s;
338
  }
339
 
340
  textarea:focus {
 
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;
 
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>
 
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 ==========
 
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();
 
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">
 
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;
 
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.`;
 
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
 
 
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>
 
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">
 
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
 
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 = '';
 
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();
 
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;