-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
799 lines (730 loc) · 41.2 KB
/
index.html
File metadata and controls
799 lines (730 loc) · 41.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>IdeaForge AI — Turn Any Topic Into a Business</title>
<meta name="description" content="AI-powered business idea generator. Enter a topic, skill, or problem — IdeaForge AI generates scored, actionable business ideas in seconds.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,[email protected],300;12..96,400;12..96,600;12..96,700;12..96,800&display=swap" rel="stylesheet">
<style>
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
--navy:#08101E;--navy2:#0C1828;--navy3:#111F33;
--gold:#C8A84B;--gold2:#E2C46A;--gold-dim:rgba(200,168,75,0.15);
--cream:#EDE7DA;--cream2:rgba(237,231,218,0.7);--cream3:rgba(237,231,218,0.35);
--green:#6EE7A0;--red:#FF9999;--blue:#7EB8F7;
--border:rgba(200,168,75,0.18);
--r:14px;--r2:10px;
}
html,body{height:100%;background:var(--navy);color:var(--cream);font-family:'Bricolage Grotesque',sans-serif;line-height:1.6}
/* ── HEADER ── */
.header{
padding:20px 24px 18px;
border-bottom:1px solid var(--border);
display:flex;align-items:center;justify-content:space-between;
background:rgba(8,16,30,0.95);
position:sticky;top:0;z-index:100;
backdrop-filter:blur(12px);
}
.logo{display:flex;align-items:center;gap:10px}
.logo-icon{
width:38px;height:38px;border-radius:10px;
background:linear-gradient(135deg,var(--gold) 0%,rgba(200,168,75,0.4) 100%);
display:flex;align-items:center;justify-content:center;
font-size:1.1rem;flex-shrink:0;
}
.logo-text{font-size:1.05rem;font-weight:800;letter-spacing:-.3px}
.logo-sub{font-size:.65rem;color:var(--cream3);letter-spacing:1.5px;text-transform:uppercase;margin-top:1px}
.header-right{display:flex;align-items:center;gap:10px}
.hbadge{
font-size:.65rem;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;
color:var(--gold);border:1px solid rgba(200,168,75,0.3);border-radius:6px;padding:4px 10px;
}
.unlock-btn{
background:var(--gold);color:var(--navy);font-weight:700;font-size:.78rem;
border:none;border-radius:8px;padding:8px 16px;cursor:pointer;
transition:background .2s,transform .1s;white-space:nowrap;
}
.unlock-btn:hover{background:var(--gold2);transform:translateY(-1px)}
/* ── HERO ── */
.hero{
text-align:center;padding:52px 24px 40px;
background:radial-gradient(ellipse 70% 50% at 50% 0%,rgba(200,168,75,0.07) 0%,transparent 70%);
}
.hero-tag{
display:inline-flex;align-items:center;gap:6px;
font-size:.68rem;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:var(--gold);
border:1px solid rgba(200,168,75,0.2);border-radius:100px;padding:5px 14px;margin-bottom:18px;
}
.hero h1{font-size:clamp(2rem,5vw,3rem);font-weight:800;letter-spacing:-.5px;line-height:1.15;margin-bottom:14px}
.hero h1 em{color:var(--gold);font-style:normal}
.hero-sub{font-size:1rem;color:var(--cream2);max-width:540px;margin:0 auto 30px}
/* ── FORGE FORM ── */
.forge-wrap{max-width:680px;margin:0 auto;padding:0 20px}
.forge-card{
background:var(--navy2);border:1px solid var(--border);border-radius:var(--r);
padding:24px;margin-bottom:24px;
}
.forge-card .label{
font-size:.72rem;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;
color:var(--gold);margin-bottom:10px;display:block;
}
.forge-input{
width:100%;background:var(--navy3);border:1px solid rgba(200,168,75,0.2);
border-radius:var(--r2);padding:14px 16px;font-size:.95rem;font-family:inherit;
color:var(--cream);resize:none;outline:none;transition:border-color .2s;
}
.forge-input:focus{border-color:rgba(200,168,75,0.5);}
.forge-input::placeholder{color:var(--cream3)}
.filters{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.filter-chip{
font-size:.72rem;font-weight:600;padding:5px 13px;border-radius:100px;cursor:pointer;
border:1px solid rgba(200,168,75,0.2);background:transparent;color:var(--cream2);
transition:all .15s;
}
.filter-chip:hover,.filter-chip.active{background:rgba(200,168,75,0.12);border-color:var(--gold);color:var(--gold)}
.forge-row{display:flex;gap:10px;margin-top:16px;flex-wrap:wrap}
.count-select{
background:var(--navy3);border:1px solid rgba(200,168,75,0.2);color:var(--cream);
border-radius:8px;padding:10px 14px;font-size:.85rem;font-family:inherit;outline:none;cursor:pointer;
}
.forge-btn{
flex:1;min-width:180px;padding:13px 24px;background:var(--gold);color:var(--navy);
font-weight:800;font-size:.9rem;border:none;border-radius:10px;cursor:pointer;
transition:all .2s;letter-spacing:.3px;display:flex;align-items:center;justify-content:center;gap:8px;
}
.forge-btn:hover{background:var(--gold2);transform:translateY(-1px);box-shadow:0 6px 20px rgba(200,168,75,0.25)}
.forge-btn:disabled{opacity:.5;cursor:not-allowed;transform:none}
/* ── USAGE METER ── */
.meter{
display:flex;align-items:center;gap:10px;padding:12px 16px;
background:rgba(200,168,75,0.06);border:1px solid var(--border);border-radius:10px;
margin-bottom:16px;font-size:.78rem;
}
.meter-bar{flex:1;height:6px;background:rgba(200,168,75,0.12);border-radius:3px;overflow:hidden}
.meter-fill{height:100%;background:var(--gold);border-radius:3px;transition:width .4s}
.meter-text{white-space:nowrap;color:var(--cream2)}
/* ── RESULTS ── */
.results-header{
display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;flex-wrap:wrap;gap:8px;
}
.results-title{font-size:.85rem;font-weight:700;color:var(--cream2);letter-spacing:.5px}
.results-actions{display:flex;gap:8px}
.ract-btn{
font-size:.7rem;font-weight:600;padding:5px 12px;border-radius:7px;cursor:pointer;
border:1px solid var(--border);background:transparent;color:var(--cream2);transition:all .15s;
}
.ract-btn:hover{border-color:var(--gold);color:var(--gold)}
/* Idea card */
.idea-card{
background:var(--navy2);border:1px solid var(--border);border-radius:var(--r);
padding:20px;margin-bottom:14px;transition:border-color .2s,transform .15s;
position:relative;overflow:hidden;
}
.idea-card::before{
content:'';position:absolute;top:0;left:0;right:0;height:2px;
background:linear-gradient(90deg,var(--gold) 0%,transparent 100%);
opacity:0;transition:opacity .2s;
}
.idea-card:hover{border-color:rgba(200,168,75,0.35);transform:translateY(-2px)}
.idea-card:hover::before{opacity:1}
.idea-top{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:12px}
.idea-title{font-size:1.05rem;font-weight:700;color:var(--cream);line-height:1.3}
.idea-scores{display:flex;gap:6px;flex-shrink:0}
.score-pill{
font-size:.65rem;font-weight:700;padding:3px 9px;border-radius:100px;
letter-spacing:.5px;text-transform:uppercase;
}
.score-opp{background:rgba(110,231,160,0.12);color:var(--green);border:1px solid rgba(110,231,160,0.2)}
.score-eff{background:rgba(126,184,247,0.12);color:var(--blue);border:1px solid rgba(126,184,247,0.2)}
.idea-pitch{font-size:.87rem;font-weight:600;color:var(--gold);margin-bottom:8px;font-style:italic}
.idea-desc{font-size:.83rem;color:var(--cream2);margin-bottom:14px;line-height:1.6}
.idea-meta{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px}
.meta-pill{
font-size:.7rem;padding:4px 11px;border-radius:100px;
background:rgba(200,168,75,0.07);border:1px solid rgba(200,168,75,0.15);color:var(--cream2);
display:flex;align-items:center;gap:4px;
}
.idea-tip{
background:rgba(200,168,75,0.06);border-left:3px solid var(--gold);
padding:10px 12px;border-radius:0 8px 8px 0;
font-size:.78rem;color:var(--cream2);
}
.idea-tip strong{color:var(--cream);font-size:.75rem;letter-spacing:.5px;text-transform:uppercase;display:block;margin-bottom:3px}
.idea-actions{display:flex;gap:8px;margin-top:14px;flex-wrap:wrap}
.ia-btn{
font-size:.72rem;font-weight:600;padding:5px 12px;border-radius:7px;cursor:pointer;
border:1px solid var(--border);background:transparent;color:var(--cream2);transition:all .15s;
}
.ia-btn:hover{border-color:var(--gold);color:var(--gold)}
.ia-btn.saved{border-color:var(--green);color:var(--green)}
.ia-pro{position:relative;}
.ia-pro::after{content:'PRO';font-size:.55rem;font-weight:800;color:var(--gold);
position:absolute;top:-6px;right:-6px;background:var(--navy);border:1px solid var(--gold);
border-radius:4px;padding:1px 4px;letter-spacing:.5px;}
/* Score bar */
.score-bars{display:flex;gap:16px;margin-top:10px}
.sbar-wrap{flex:1}
.sbar-label{font-size:.65rem;color:var(--cream3);margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px}
.sbar{height:5px;background:rgba(200,168,75,0.1);border-radius:3px;overflow:hidden}
.sbar-fill{height:100%;border-radius:3px;transition:width .6s .1s}
.sbar-opp .sbar-fill{background:var(--green)}
.sbar-eff .sbar-fill{background:var(--blue)}
/* ── SKELETON ── */
.skel{background:linear-gradient(90deg,rgba(200,168,75,0.05) 25%,rgba(200,168,75,0.1) 50%,rgba(200,168,75,0.05) 75%);
background-size:200% 100%;animation:shimmer 1.4s infinite;border-radius:8px}
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
/* ── PAYWALL GATE ── */
.gate-section{
background:var(--navy2);border:1px solid rgba(200,168,75,0.25);border-radius:var(--r);
padding:32px 24px;text-align:center;margin-bottom:14px;
background:radial-gradient(ellipse 80% 60% at 50% 50%,rgba(200,168,75,0.05) 0%,transparent 70%),var(--navy2);
}
.gate-icon{font-size:2.2rem;margin-bottom:14px}
.gate-badge{font-size:.65rem;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:var(--gold);margin-bottom:8px}
.gate-section h3{font-size:1.15rem;font-weight:700;color:var(--cream);margin-bottom:8px}
.gate-section p{font-size:.83rem;color:var(--cream2);margin-bottom:20px;max-width:360px;margin-left:auto;margin-right:auto}
.gate-btn{
display:inline-block;padding:13px 28px;background:var(--gold);color:var(--navy);
font-weight:800;font-size:.9rem;border:none;border-radius:10px;cursor:pointer;
text-decoration:none;letter-spacing:.3px;transition:all .2s;
}
.gate-btn:hover{background:var(--gold2);transform:translateY(-1px)}
.gate-note{font-size:.7rem;color:var(--cream3);margin-top:10px}
/* ── BUNDLE UPSELL ── */
.bundle-section{
margin:24px 0;padding:22px 20px;
background:rgba(200,168,75,0.07);border:1px solid rgba(200,168,75,0.25);border-radius:var(--r);
text-align:center;
}
.bundle-section .bsave{font-size:.65rem;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:var(--gold);margin-bottom:8px}
.bundle-section h3{font-size:1rem;font-weight:700;margin-bottom:6px}
.bundle-section p{font-size:.78rem;color:var(--cream2);margin-bottom:14px}
.bundle-btn{
display:inline-block;padding:10px 22px;background:var(--gold);color:var(--navy);
font-weight:700;font-size:.82rem;border-radius:8px;text-decoration:none;transition:all .2s;
}
.bundle-btn:hover{background:var(--gold2)}
/* ── VAULT (saved ideas) ── */
.vault-section{margin-top:32px;padding-top:24px;border-top:1px solid var(--border)}
.vault-title{font-size:.75rem;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:var(--cream3);margin-bottom:14px;display:flex;align-items:center;gap:8px}
.vault-count{background:rgba(200,168,75,0.12);color:var(--gold);font-size:.65rem;padding:2px 8px;border-radius:100px;font-weight:700}
.vault-empty{font-size:.8rem;color:var(--cream3);font-style:italic;text-align:center;padding:20px}
/* ── TOAST ── */
.toast{
position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(80px);
background:rgba(12,24,40,0.95);border:1px solid var(--border);border-radius:10px;
padding:12px 20px;font-size:.82rem;color:var(--cream);
backdrop-filter:blur(10px);transition:transform .3s;z-index:9999;white-space:nowrap;
box-shadow:0 8px 32px rgba(0,0,0,0.4);
}
.toast.show{transform:translateX(-50%) translateY(0)}
/* ── FOOTER ── */
.footer{
text-align:center;padding:32px 24px 40px;margin-top:40px;border-top:1px solid var(--border);
font-size:.72rem;color:var(--cream3);
}
.footer a{color:rgba(200,168,75,0.5);text-decoration:none}
.footer a:hover{color:var(--gold)}
/* ── LOADING ANIMATION ── */
@keyframes spin{to{transform:rotate(360deg)}}
.spinner{width:20px;height:20px;border:2px solid rgba(8,16,30,0.3);border-top-color:var(--navy);border-radius:50%;animation:spin .7s linear infinite;display:inline-block}
/* ── RESPONSIVE ── */
@media(max-width:520px){
.hero{padding:36px 16px 28px}
.forge-wrap{padding:0 14px}
.forge-card{padding:18px}
.idea-card{padding:16px}
.header{padding:14px 16px}
.logo-text{font-size:.9rem}
}
</style>
</head>
<body>
<!-- ── HEADER ── -->
<header class="header">
<div class="logo">
<div class="logo-icon">⚒</div>
<div>
<div class="logo-text">IdeaForge AI</div>
<div class="logo-sub">by AnchorWithin</div>
</div>
</div>
<div class="header-right">
<div class="hbadge" id="plan-badge">FREE</div>
<button class="unlock-btn" onclick="showGate()">Unlock Pro — $0.99</button>
</div>
</header>
<!-- ── HERO ── -->
<section class="hero">
<div class="hero-tag">⚒ AI-Powered Idea Generator</div>
<h1>Turn any topic into<br><em>a real business idea</em></h1>
<p class="hero-sub">Enter a skill, problem, or niche. IdeaForge AI generates scored, actionable business ideas — with startup costs, timelines, and your first step.</p>
</section>
<!-- ── FORGE FORM ── -->
<div class="forge-wrap">
<!-- Usage meter -->
<div class="meter" id="usage-meter">
<span style="font-size:.85rem">⚒</span>
<div class="meter-bar"><div class="meter-fill" id="meter-fill" style="width:0%"></div></div>
<span class="meter-text" id="meter-text">5 free forges today</span>
</div>
<!-- Input card -->
<div class="forge-card">
<label class="label">What do you want ideas for?</label>
<textarea class="forge-input" id="topic-input" rows="3"
placeholder="e.g. I'm a graphic designer who loves hiking and wants to make $2k/month on the side…"></textarea>
<div style="margin-top:14px">
<label class="label" style="margin-bottom:8px">Focus</label>
<div class="filters">
<button class="filter-chip active" data-filter="any">🎯 Any</button>
<button class="filter-chip" data-filter="digital">💻 Digital</button>
<button class="filter-chip" data-filter="service">🤝 Service</button>
<button class="filter-chip" data-filter="product">📦 Product</button>
<button class="filter-chip" data-filter="content">🎥 Content</button>
<button class="filter-chip" data-filter="ai">🤖 AI-Powered</button>
<button class="filter-chip" data-filter="passive">💤 Passive</button>
</div>
</div>
<div class="forge-row">
<select class="count-select" id="idea-count">
<option value="3">3 ideas</option>
<option value="5" selected>5 ideas</option>
<option value="8">8 ideas (Pro)</option>
<option value="12">12 ideas (Pro)</option>
</select>
<button class="forge-btn" id="forge-btn" onclick="forgeIdeas()">
<span id="forge-btn-text">⚒ Forge Ideas</span>
</button>
</div>
</div>
<!-- Results -->
<div id="results-section" style="display:none">
<div class="results-header">
<div class="results-title" id="results-title">5 IDEAS FORGED</div>
<div class="results-actions">
<button class="ract-btn" onclick="copyAll()">📋 Copy All</button>
<button class="ract-btn ia-pro" onclick="exportPdf()">⬇ Export PDF</button>
<button class="ract-btn" onclick="clearResults()">✕ Clear</button>
</div>
</div>
<div id="ideas-container"></div>
</div>
<!-- Bundle upsell -->
<div class="bundle-section">
<div class="bsave">SAVE 75%</div>
<h3>Get ALL 6 AnchorWithin Tools for $4.99</h3>
<p>IdeaForge + Resume Optimizer + Tax Calculator + Resonance Generator + Side Hustle Planner + AI Companion</p>
<a href="https://buy.stripe.com/3cI7sM7Lg6ir5obef067S0r" target="_blank" class="bundle-btn">Get the Bundle →</a>
</div>
<!-- Vault -->
<div class="vault-section" id="vault-section">
<div class="vault-title">
📁 Saved Ideas
<span class="vault-count" id="vault-count">0</span>
</div>
<div id="vault-container">
<div class="vault-empty">No saved ideas yet — forge some and click Save</div>
</div>
</div>
</div><!-- /forge-wrap -->
<footer class="footer">
<p>IdeaForge AI is part of the <a href="https://ackccreate.github.io" target="_blank">AnchorWithin</a> toolkit · <a href="https://buy.stripe.com/3cI7sM7Lg6ir5obef067S0r" target="_blank">Get All 6 Tools $4.99</a></p>
<p style="margin-top:8px">© 2026 AnchorWithin LLC · Ideas are AI-generated — verify before investing</p>
</footer>
<!-- Toast -->
<div class="toast" id="toast"></div>
<script>
/* ── STATE ────────────────────────────────────────────────────────────────── */
const FREE_LIMIT = 5;
const API_ENDPOINT = 'https://throne.verityswarm.com/api/chat';
const UNLOCK_LINK = 'https://buy.stripe.com/eeftest99ideaforgeplaceholder'; // set after Stripe created
let selectedFilter = 'any';
let chatHistory = [];
let isPro = false;
let isBusy = false;
/* ── INIT ─────────────────────────────────────────────────────────────────── */
document.addEventListener('DOMContentLoaded', () => {
// Check pro status
if (new URLSearchParams(location.search).get('unlocked')) {
try { localStorage.setItem('aw_ideaforge_pro', '1'); } catch(e){}
}
isPro = !!localStorage.getItem('aw_ideaforge_pro');
if (isPro) {
document.getElementById('plan-badge').textContent = 'PRO';
document.getElementById('plan-badge').style.color = '#6EE7A0';
document.getElementById('plan-badge').style.borderColor = 'rgba(110,231,160,0.3)';
document.querySelector('.unlock-btn').style.display = 'none';
}
// Filter chips
document.querySelectorAll('.filter-chip').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.filter-chip').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
selectedFilter = btn.dataset.filter;
});
});
// Pro count select
document.getElementById('idea-count').addEventListener('change', (e) => {
if (!isPro && (e.target.value === '8' || e.target.value === '12')) {
toast('Generating 8-12 ideas requires Pro — unlock for $0.99');
e.target.value = '5';
}
});
updateMeter();
renderVault();
// Enter key in textarea
document.getElementById('topic-input').addEventListener('keydown', e => {
if (e.key === 'Enter' && e.ctrlKey) { e.preventDefault(); forgeIdeas(); }
});
});
/* ── USAGE ────────────────────────────────────────────────────────────────── */
function getTodayCount() {
try {
const key = 'aw_ideaforge_' + new Date().toDateString();
return parseInt(localStorage.getItem(key) || '0');
} catch(e) { return 0; }
}
function incCount() {
try {
const key = 'aw_ideaforge_' + new Date().toDateString();
localStorage.setItem(key, getTodayCount() + 1);
} catch(e) {}
}
function updateMeter() {
if (isPro) {
document.getElementById('usage-meter').style.display = 'none';
return;
}
const used = getTodayCount();
const pct = Math.min(100, (used / FREE_LIMIT) * 100);
document.getElementById('meter-fill').style.width = pct + '%';
if (used >= FREE_LIMIT) {
document.getElementById('meter-text').innerHTML =
'<strong style="color:#FF9999">Limit reached</strong> — <a href="#" onclick="showGate();return false" style="color:var(--gold);text-decoration:none">unlock unlimited $0.99</a>';
document.getElementById('meter-fill').style.background = '#FF9999';
} else {
document.getElementById('meter-text').textContent =
`${FREE_LIMIT - used} free forge${FREE_LIMIT - used !== 1 ? 's' : ''} today`;
}
}
/* ── FORGE ────────────────────────────────────────────────────────────────── */
async function forgeIdeas() {
if (isBusy) return;
const topic = document.getElementById('topic-input').value.trim();
if (!topic) { toast('Enter a topic first'); document.getElementById('topic-input').focus(); return; }
if (!isPro && getTodayCount() >= FREE_LIMIT) {
showGate(); return;
}
const count = parseInt(document.getElementById('idea-count').value);
const filter = selectedFilter;
isBusy = true;
const btn = document.getElementById('forge-btn');
const btnT = document.getElementById('forge-btn-text');
btn.disabled = true;
btnT.innerHTML = '<div class="spinner"></div> Forging…';
// Show skeleton
document.getElementById('results-section').style.display = 'block';
const container = document.getElementById('ideas-container');
container.innerHTML = Array(Math.min(count, 3)).fill(0).map(() => `
<div class="idea-card">
<div class="skel" style="height:22px;width:60%;margin-bottom:10px"></div>
<div class="skel" style="height:16px;width:85%;margin-bottom:8px"></div>
<div class="skel" style="height:14px;width:75%;margin-bottom:8px"></div>
<div class="skel" style="height:14px;width:80%;margin-bottom:14px"></div>
<div style="display:flex;gap:8px">
<div class="skel" style="height:28px;width:80px"></div>
<div class="skel" style="height:28px;width:80px"></div>
</div>
</div>`).join('');
const filterNote = filter !== 'any' ? ` Focus specifically on ${filter} business models.` : '';
const prompt = `Generate exactly ${count} business idea${count>1?'s':''} for this topic: "${topic}"${filterNote}
Return ONLY valid JSON in this exact format (no markdown, no explanation, just the JSON):
{
"ideas": [
{
"title": "Short punchy idea name",
"pitch": "One-sentence value proposition",
"description": "2-3 sentences expanding on the idea, target customer, and why now",
"opportunity_score": 7,
"effort_score": 4,
"startup_cost": "$0–$200",
"time_to_revenue": "2–4 weeks",
"monthly_potential": "$500–$2,000",
"quick_start": "Specific first action to take TODAY to test this idea"
}
]
}
opportunity_score: 1-10 (market demand, profit potential)
effort_score: 1-10 (1=easy, 10=very hard)
Make each idea genuinely useful, specific, and actionable. No generic advice.`;
chatHistory.push({ role: 'user', content: prompt });
try {
const resp = await fetch(API_ENDPOINT, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: prompt, history: [] }),
});
if (!resp.ok) throw new Error(`API ${resp.status}`);
const data = await resp.json();
if (!data.ok) throw new Error(data.error || 'API error');
const reply = data.reply || '';
chatHistory.push({ role: 'assistant', content: reply });
// Parse JSON from response
const jsonMatch = reply.match(/\{[\s\S]*\}/);
if (!jsonMatch) throw new Error('No JSON in response');
const parsed = JSON.parse(jsonMatch[0]);
const ideas = parsed.ideas || [];
if (!ideas.length) throw new Error('No ideas returned');
incCount();
updateMeter();
renderIdeas(ideas, count, topic);
} catch(err) {
console.error(err);
// Fallback: generate demo ideas if API is unreachable
const fallback = generateFallbackIdeas(topic, count, filter);
incCount();
updateMeter();
renderIdeas(fallback, count, topic);
toast('Live AI unavailable — showing smart suggestions');
} finally {
isBusy = false;
btn.disabled = false;
btnT.innerHTML = '⚒ Forge More';
}
}
/* ── RENDER IDEAS ─────────────────────────────────────────────────────────── */
function renderIdeas(ideas, count, topic) {
const container = document.getElementById('ideas-container');
document.getElementById('results-title').textContent =
`${ideas.length} IDEA${ideas.length !== 1 ? 'S' : ''} FORGED FOR "${topic.toUpperCase().slice(0,30)}${topic.length>30?'…':''}"`;
container.innerHTML = ideas.map((idea, i) => {
const oppW = (idea.opportunity_score / 10 * 100).toFixed(0);
const effW = ((10 - idea.effort_score) / 10 * 100).toFixed(0);
return `
<div class="idea-card" id="idea-${i}">
<div class="idea-top">
<div class="idea-title">${esc(idea.title)}</div>
<div class="idea-scores">
<div class="score-pill score-opp">★ ${idea.opportunity_score}/10</div>
<div class="score-pill score-eff">⚡ Effort ${idea.effort_score}/10</div>
</div>
</div>
<div class="idea-pitch">"${esc(idea.pitch)}"</div>
<div class="idea-desc">${esc(idea.description)}</div>
<div class="idea-meta">
<div class="meta-pill">💰 ${esc(idea.startup_cost)}</div>
<div class="meta-pill">📅 ${esc(idea.time_to_revenue)}</div>
<div class="meta-pill">📈 ${esc(idea.monthly_potential)}/mo</div>
</div>
<div class="score-bars">
<div class="sbar-wrap sbar-opp">
<div class="sbar-label">Opportunity</div>
<div class="sbar"><div class="sbar-fill" style="width:${oppW}%"></div></div>
</div>
<div class="sbar-wrap sbar-eff">
<div class="sbar-label">Ease</div>
<div class="sbar"><div class="sbar-fill" style="width:${effW}%"></div></div>
</div>
</div>
<div class="idea-tip">
<strong>⚡ First Step Today</strong>
${esc(idea.quick_start)}
</div>
<div class="idea-actions">
<button class="ia-btn" onclick="saveIdea(${i})">🔖 Save</button>
<button class="ia-btn" onclick="copyIdea(${i})">📋 Copy</button>
<button class="ia-btn ia-pro" onclick="deepDive(${i})">🔍 Deep Dive</button>
<button class="ia-btn ia-pro" onclick="buildPlan(${i})">📋 Build Plan</button>
</div>
</div>`;
}).join('');
// Store in memory for copy/save
window._currentIdeas = ideas;
// Animate score bars after render
setTimeout(() => {
document.querySelectorAll('.sbar-fill').forEach(el => {
const w = el.style.width;
el.style.width = '0%';
setTimeout(() => { el.style.width = w; }, 50);
});
}, 100);
}
/* ── IDEA ACTIONS ─────────────────────────────────────────────────────────── */
function saveIdea(idx) {
const idea = window._currentIdeas?.[idx];
if (!idea) return;
const vault = getVault();
const id = Date.now();
vault.unshift({ ...idea, id, saved_at: new Date().toLocaleDateString() });
setVault(vault.slice(0, 50));
const btn = document.querySelector(`#idea-${idx} .ia-btn`);
if (btn) { btn.textContent = '✓ Saved'; btn.classList.add('saved'); }
toast('Idea saved to vault');
renderVault();
}
function copyIdea(idx) {
const idea = window._currentIdeas?.[idx];
if (!idea) return;
const text = `${idea.title}\n"${idea.pitch}"\n\n${idea.description}\n\n💰 Startup: ${idea.startup_cost} | 📅 ${idea.time_to_revenue} | 📈 ${idea.monthly_potential}/mo\n\n⚡ First step: ${idea.quick_start}`;
navigator.clipboard.writeText(text).then(() => toast('Copied to clipboard')).catch(() => toast('Copy failed'));
}
async function deepDive(idx) {
if (!isPro) { showGate(); return; }
const idea = window._currentIdeas?.[idx];
if (!idea || isBusy) return;
isBusy = true;
toast('Generating deep dive…');
const prompt = `Give a detailed deep dive on this business idea: "${idea.title}" — ${idea.description}. Cover: ideal customer profile, top 3 competitors, unique angle to stand out, first 30-day action plan (week by week), revenue model options, and biggest risk + how to mitigate it. Be specific and actionable.`;
try {
const resp = await fetch(API_ENDPOINT, { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({message:prompt,history:[]}) });
const data = await resp.json();
if (data.ok) showModal('🔍 Deep Dive: ' + idea.title, data.reply);
else toast('Deep dive failed: ' + (data.error||'unknown'));
} catch(e) { toast('Error: ' + e.message); }
isBusy = false;
}
async function buildPlan(idx) {
if (!isPro) { showGate(); return; }
const idea = window._currentIdeas?.[idx];
if (!idea || isBusy) return;
isBusy = true;
toast('Building 90-day plan…');
const prompt = `Create a detailed 90-day launch plan for: "${idea.title}" — ${idea.pitch}. Format as: Days 1-7 (validate), Days 8-30 (build), Days 31-60 (launch), Days 61-90 (grow). Include specific daily/weekly tasks, tools to use, metrics to track, and revenue targets for each phase.`;
try {
const resp = await fetch(API_ENDPOINT, { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({message:prompt,history:[]}) });
const data = await resp.json();
if (data.ok) showModal('📋 90-Day Plan: ' + idea.title, data.reply);
else toast('Plan generation failed');
} catch(e) { toast('Error: ' + e.message); }
isBusy = false;
}
function copyAll() {
const ideas = window._currentIdeas;
if (!ideas?.length) { toast('No ideas to copy'); return; }
const text = ideas.map((idea, i) => `${i+1}. ${idea.title}\n"${idea.pitch}"\n${idea.description}\n💰 ${idea.startup_cost} | ⚡ First step: ${idea.quick_start}`).join('\n\n---\n\n');
navigator.clipboard.writeText(text).then(() => toast('All ideas copied')).catch(() => toast('Copy failed'));
}
function exportPdf() {
if (!isPro) { showGate(); return; }
toast('PDF export requires the Pro upgrade');
}
function clearResults() {
document.getElementById('results-section').style.display = 'none';
document.getElementById('ideas-container').innerHTML = '';
window._currentIdeas = null;
document.getElementById('forge-btn-text').textContent = '⚒ Forge Ideas';
}
/* ── VAULT ─────────────────────────────────────────────────────────────────── */
function getVault() { try { return JSON.parse(localStorage.getItem('aw_ideaforge_vault')||'[]'); } catch(e) { return []; } }
function setVault(v) { try { localStorage.setItem('aw_ideaforge_vault', JSON.stringify(v)); } catch(e) {} }
function renderVault() {
const vault = getVault();
document.getElementById('vault-count').textContent = vault.length;
const c = document.getElementById('vault-container');
if (!vault.length) { c.innerHTML = '<div class="vault-empty">No saved ideas yet — forge some and click Save</div>'; return; }
c.innerHTML = vault.slice(0, 5).map((idea, i) => `
<div class="idea-card" style="padding:14px 16px">
<div style="display:flex;justify-content:space-between;align-items:center;gap:8px">
<div>
<div class="idea-title" style="font-size:.9rem">${esc(idea.title)}</div>
<div style="font-size:.72rem;color:var(--cream3);margin-top:2px">${idea.saved_at||''} · ★ ${idea.opportunity_score}/10</div>
</div>
<div style="display:flex;gap:6px;flex-shrink:0">
<button class="ia-btn" onclick="copyVaultIdea(${i})">📋</button>
<button class="ia-btn" style="color:var(--red);border-color:rgba(255,153,153,0.3)" onclick="deleteVaultIdea(${i})">✕</button>
</div>
</div>
</div>`).join('');
if (vault.length > 5) {
c.innerHTML += `<div style="text-align:center;font-size:.75rem;color:var(--cream3);padding:8px">+${vault.length-5} more saved ideas</div>`;
}
}
function copyVaultIdea(i) {
const idea = getVault()[i];
if (!idea) return;
const text = `${idea.title}\n"${idea.pitch}"\n${idea.description}\n\n💰 ${idea.startup_cost} | ⚡ ${idea.quick_start}`;
navigator.clipboard.writeText(text).then(() => toast('Copied')).catch(() => toast('Failed'));
}
function deleteVaultIdea(i) {
const vault = getVault();
vault.splice(i, 1);
setVault(vault);
renderVault();
toast('Removed from vault');
}
/* ── GATE / MODAL ──────────────────────────────────────────────────────────── */
function showGate() {
showModal('⚒ Unlock IdeaForge Pro', `
<div style="text-align:center;padding:20px 0">
<div style="font-size:2.5rem;margin-bottom:16px">⚒</div>
<div style="font-size:.68rem;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:var(--gold);margin-bottom:10px">PRO UPGRADE</div>
<h3 style="font-size:1.2rem;font-weight:700;margin-bottom:10px">Unlock Unlimited Forging</h3>
<p style="font-size:.85rem;color:var(--cream2);margin-bottom:20px">5 free forges per day. Unlock unlimited forging, 8–12 ideas per run, Deep Dive analysis, 90-day plan builder, and PDF export.</p>
<a href="https://buy.stripe.com/cNi9AU5D84aj03R9YK67S0y" target="_blank" rel="noopener"
style="display:inline-block;padding:14px 32px;background:var(--gold);color:var(--navy);font-weight:800;font-size:.95rem;border-radius:10px;text-decoration:none;letter-spacing:.3px">
Unlock for $0.99 →
</a>
<p style="font-size:.7rem;color:var(--cream3);margin-top:12px">One-time payment · Instant access</p>
<div style="margin-top:20px;padding:16px;background:rgba(200,168,75,0.07);border:1px solid var(--border);border-radius:10px">
<div style="font-size:.65rem;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:var(--gold);margin-bottom:8px">BEST VALUE</div>
<div style="font-size:.9rem;font-weight:700;margin-bottom:6px">All 6 AnchorWithin Tools — $4.99</div>
<div style="font-size:.75rem;color:var(--cream2);margin-bottom:10px">IdeaForge + Resume + Tax + Resonance + Side Hustle + AI Companion</div>
<a href="https://buy.stripe.com/3cI7sM7Lg6ir5obef067S0r" target="_blank" style="color:var(--gold);font-size:.8rem;font-weight:700;text-decoration:none">Get the Bundle →</a>
</div>
</div>`);
}
let _modal = null;
function showModal(title, content) {
if (_modal) _modal.remove();
const el = document.createElement('div');
el.style.cssText = 'position:fixed;inset:0;background:rgba(8,16,30,0.9);backdrop-filter:blur(8px);z-index:10000;display:flex;align-items:center;justify-content:center;padding:20px';
el.innerHTML = `
<div style="background:var(--navy2);border:1px solid var(--border);border-radius:16px;width:100%;max-width:540px;max-height:80vh;overflow-y:auto">
<div style="padding:18px 20px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;background:var(--navy2);z-index:1">
<div style="font-size:.95rem;font-weight:700">${esc(title)}</div>
<button onclick="this.closest('[style*=fixed]').remove()" style="background:none;border:none;color:var(--cream2);cursor:pointer;font-size:1.2rem;padding:0 4px">✕</button>
</div>
<div style="padding:20px;font-size:.85rem;color:var(--cream2);line-height:1.7;white-space:pre-wrap">${typeof content === 'string' && content.startsWith('<') ? content : esc(content).replace(/\n/g,'<br>')}</div>
</div>`;
document.body.appendChild(el);
_modal = el;
el.addEventListener('click', e => { if (e.target === el) el.remove(); });
}
/* ── FALLBACK IDEAS ────────────────────────────────────────────────────────── */
function generateFallbackIdeas(topic, count, filter) {
const templates = [
{ title: `${topic} Consulting`, pitch: `Get paid for what you already know`, description: `Offer 1-on-1 consulting sessions to people learning ${topic}. Package your expertise into a signature system and charge $100–$300/hr.`, opportunity_score: 7, effort_score: 3, startup_cost: '$0', time_to_revenue: '1–2 weeks', monthly_potential: '$1,500–$4,000', quick_start: 'Post on LinkedIn: "I help people with [X] — DM me for a free 15-min strategy call."' },
{ title: `${topic} Digital Course`, pitch: `Teach what you know, earn while you sleep`, description: `Package your ${topic} knowledge into a 5-module video course. Sell on Gumroad or Teachable for $47–$197.`, opportunity_score: 8, effort_score: 6, startup_cost: '$50–$200', time_to_revenue: '4–6 weeks', monthly_potential: '$500–$3,000', quick_start: 'Outline 5 core lessons you\'d teach a beginner — that\'s your course structure.' },
{ title: `${topic} Newsletter`, pitch: `Weekly insights + affiliate income on autopilot`, description: `Start a curated newsletter about ${topic} using Beehiiv (free). Grow to 1,000 subscribers, then monetize with sponsors and affiliate links.`, opportunity_score: 6, effort_score: 4, startup_cost: '$0', time_to_revenue: '8–12 weeks', monthly_potential: '$200–$2,000', quick_start: 'Set up Beehiiv, write Issue #1 today, and post the signup link on 3 social profiles.' },
{ title: `${topic} Templates Pack`, pitch: `Done-for-you resources people actually pay for`, description: `Create a bundle of 10–20 templates related to ${topic} and sell on Gumroad for $7–$29. One creation, infinite sales.`, opportunity_score: 7, effort_score: 3, startup_cost: '$0–$50', time_to_revenue: '1–3 weeks', monthly_potential: '$300–$1,500', quick_start: 'Identify the most repetitive ${topic} task you do — build a template that eliminates it.' },
{ title: `${topic} YouTube Channel`, pitch: `Build an audience that pays you forever`, description: `Create tutorial/explainer videos about ${topic}. Monetize with AdSense, sponsorships, and selling your own products to warm audience.`, opportunity_score: 9, effort_score: 7, startup_cost: '$0–$300', time_to_revenue: '3–6 months', monthly_potential: '$500–$10,000', quick_start: 'Record a 5-minute tip you wish you knew when you started with ${topic}.' },
{ title: `${topic} Freelance Service`, pitch: `Get paid this week for skills you already have`, description: `Offer a specific ${topic} service on Upwork, Fiverr, or direct outreach. Niche down to one deliverable and one audience.`, opportunity_score: 7, effort_score: 4, startup_cost: '$0', time_to_revenue: '3–7 days', monthly_potential: '$1,000–$5,000', quick_start: 'Create one Fiverr gig with a specific deliverable — "I will [specific outcome] in 48 hours."' },
{ title: `AI-Powered ${topic} Tool`, pitch: `Build a micro-SaaS solving one specific ${topic} problem`, description: `Use no-code tools (Bubble, Glide) or Claude API to build a simple tool that automates one ${topic} task. Charge $7–$29/month.`, opportunity_score: 9, effort_score: 7, startup_cost: '$0–$100', time_to_revenue: '3–6 weeks', monthly_potential: '$500–$5,000', quick_start: 'Identify the most annoying repetitive task in ${topic} — that\'s your product idea.' },
{ title: `${topic} Community`, pitch: `People pay monthly to belong to something they care about`, description: `Launch a paid Discord or Circle community around ${topic}. Charge $9–$29/month for access to you, templates, and weekly calls.`, opportunity_score: 8, effort_score: 5, startup_cost: '$0–$50', time_to_revenue: '2–4 weeks', monthly_potential: '$500–$3,000', quick_start: 'Create a free Discord server today and invite 10 people you know who care about ${topic}.' },
{ title: `${topic} Book/Guide`, pitch: `One-time creation, years of passive income`, description: `Write a 20–50 page definitive guide on ${topic} and sell it on Gumroad, Amazon KDP, or your own site for $7–$27.`, opportunity_score: 6, effort_score: 5, startup_cost: '$0–$100', time_to_revenue: '3–5 weeks', monthly_potential: '$200–$1,500', quick_start: 'Write a 10-point outline of everything a beginner needs to know about ${topic} — that\'s your book.' },
{ title: `${topic} Done-For-You Service`, pitch: `Premium price for zero client effort`, description: `Offer a fully managed ${topic} service where you handle everything end-to-end. Target small business owners who want results, not learning curves. Charge $500–$3,000/month.`, opportunity_score: 8, effort_score: 6, startup_cost: '$0', time_to_revenue: '1–3 weeks', monthly_potential: '$2,000–$8,000', quick_start: 'Write a one-page offer: "I will [specific outcome] for your business in [timeframe]. Investment: $X."' },
];
return templates.slice(0, count).map(t => ({
...t,
title: t.title.replace(/\$\{topic\}/g, topic),
description: t.description.replace(/\$\{topic\}/g, topic),
quick_start: t.quick_start.replace(/\$\{topic\}/g, topic),
}));
}
/* ── UTILS ─────────────────────────────────────────────────────────────────── */
function esc(s){ return String(s||'').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"'); }
function toast(msg, dur=3000) {
const t = document.getElementById('toast');
t.textContent = msg;
t.classList.add('show');
clearTimeout(t._t);
t._t = setTimeout(() => t.classList.remove('show'), dur);
}
function unlockPro() {
window.open('https://buy.stripe.com/cNi9AU5D84aj03R9YK67S0y', '_blank');
}
</script>
</body>
</html>