File size: 32,694 Bytes
7b92311
 
 
 
 
737539c
7b92311
 
 
737539c
 
 
 
7b92311
737539c
 
7b92311
737539c
 
7b92311
 
 
 
 
737539c
7b92311
 
737539c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7b92311
737539c
 
 
 
 
 
5763680
7b92311
 
737539c
 
 
 
 
 
 
 
 
 
 
 
7b92311
737539c
 
 
 
 
 
 
 
 
 
 
7b92311
737539c
 
 
7b92311
 
737539c
 
 
 
7b92311
737539c
 
 
7b92311
 
 
 
737539c
 
 
 
 
 
 
 
5763680
 
 
737539c
 
 
 
 
 
 
5763680
737539c
 
 
 
 
5763680
 
737539c
 
 
 
 
 
 
 
 
 
5763680
 
 
 
7b92311
35356ff
737539c
 
 
 
 
 
 
 
5763680
737539c
 
 
5763680
 
737539c
 
 
 
 
 
 
 
 
 
 
 
 
5763680
737539c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5763680
7b92311
35356ff
737539c
 
 
 
 
 
 
 
 
 
 
 
5763680
 
35356ff
 
 
 
5763680
 
 
737539c
 
 
 
 
 
 
 
 
 
5763680
737539c
 
 
 
5763680
35356ff
737539c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5763680
737539c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5763680
737539c
 
35356ff
737539c
 
 
 
5763680
35356ff
 
737539c
 
 
 
 
 
 
 
35356ff
737539c
 
 
 
35356ff
737539c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5763680
737539c
 
 
 
5763680
737539c
 
 
5763680
737539c
 
7b92311
35356ff
737539c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5763680
737539c
 
 
 
 
 
 
 
 
5763680
737539c
 
5763680
 
 
737539c
 
 
 
5763680
737539c
 
 
 
 
 
 
5763680
737539c
 
 
 
 
 
 
 
5763680
35356ff
5763680
737539c
 
 
 
 
 
 
 
 
 
 
 
 
5763680
737539c
 
 
5763680
737539c
 
 
 
5763680
737539c
 
 
 
 
 
 
 
 
 
 
5763680
737539c
 
5763680
 
737539c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5763680
737539c
 
5763680
737539c
 
 
5763680
737539c
 
35356ff
 
737539c
 
 
 
5763680
737539c
 
 
 
 
5763680
737539c
 
5763680
 
737539c
 
35356ff
 
737539c
 
 
 
 
5763680
737539c
 
 
 
 
 
5763680
 
35356ff
737539c
 
5763680
737539c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7b92311
 
 
737539c
 
7b92311
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Monster Girl Academy: Heartstrings</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        @keyframes float {
            0% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
            100% { transform: translateY(0px); }
        }
        .floating {
            animation: float 3s ease-in-out infinite;
        }
        .bg-academy {
            background-image: url('https://images.unsplash.com/photo-1588072432836-e10032774350?q=80&w=2072&auto=format&fit=crop');
            background-size: cover;
            background-position: center;
        }
        .character-card {
            transition: all 0.3s ease;
            transform-style: preserve-3d;
        }
        .character-card:hover {
            transform: scale(1.05) rotateY(5deg);
            box-shadow: 0 10px 25px rgba(0,0,0,0.2);
        }
        .stat-bar {
            height: 6px;
            transition: width 0.5s ease;
        }
        .dialogue-box {
            min-height: 200px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 15px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        .choice-btn {
            transition: all 0.2s ease;
        }
        .choice-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        }
        .character-portrait {
            filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2));
        }
    </style>
</head>
<body class="bg-gray-100 font-sans">
    <!-- Main Game Container -->
    <div class="container mx-auto px-4 py-8 max-w-6xl">
        <!-- Header -->
        <header class="bg-purple-900 text-white rounded-xl p-6 mb-8 shadow-lg bg-academy relative overflow-hidden">
            <div class="absolute inset-0 bg-black opacity-40"></div>
            <div class="relative z-10 flex flex-col items-center">
                <h1 class="text-4xl md:text-5xl font-bold mb-2 text-center floating">Monster Girl Academy: Heartstrings</h1>
                <p class="text-xl text-purple-200 mb-4 text-center">Where bonds transcend species</p>
                <div class="flex space-x-4">
                    <button id="newGameBtn" class="bg-pink-600 hover:bg-pink-700 text-white px-6 py-2 rounded-full font-semibold transition">New Game</button>
                    <button id="loadGameBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-6 py-2 rounded-full font-semibold transition">Load Game</button>
                </div>
            </div>
        </header>

        <!-- Game Area (initially hidden) -->
        <div id="gameArea" class="hidden">
            <!-- Top Bar - Game Info -->
            <div class="bg-white rounded-xl p-4 mb-6 shadow-md flex flex-wrap justify-between items-center">
                <div class="flex items-center space-x-4 mb-2 sm:mb-0">
                    <div class="bg-yellow-100 p-2 rounded-lg">
                        <i class="fas fa-calendar-day text-yellow-600"></i>
                        <span id="gameDay" class="font-semibold ml-1">Day 1</span>
                    </div>
                    <div class="bg-blue-100 p-2 rounded-lg">
                        <i class="fas fa-clock text-blue-600"></i>
                        <span id="gameTime" class="font-semibold ml-1">Morning</span>
                    </div>
                </div>
                <div class="flex items-center space-x-4">
                    <div class="bg-green-100 p-2 rounded-lg">
                        <i class="fas fa-coins text-green-600"></i>
                        <span id="gameMoney" class="font-semibold ml-1">100</span>
                    </div>
                    <div class="bg-red-100 p-2 rounded-lg">
                        <i class="fas fa-heart text-red-600"></i>
                        <span id="gameEnergy" class="font-semibold ml-1">10/10</span>
                    </div>
                </div>
            </div>

            <!-- Main Content Area -->
            <div class="flex flex-col lg:flex-row gap-6">
                <!-- Left Side - Characters -->
                <div class="w-full lg:w-1/4">
                    <div class="bg-white rounded-xl p-4 shadow-md mb-6">
                        <h2 class="text-xl font-bold mb-4 text-purple-800 border-b pb-2">Your Connections</h2>
                        <div id="characterList" class="space-y-4">
                            <!-- Characters will be dynamically added here -->
                        </div>
                    </div>

                    <div class="bg-white rounded-xl p-4 shadow-md">
                        <h2 class="text-xl font-bold mb-4 text-purple-800 border-b pb-2">Your Stats</h2>
                        <div class="space-y-3">
                            <div>
                                <p class="text-sm font-medium text-gray-700 mb-1">Charm <span class="float-right">50%</span></p>
                                <div class="w-full bg-gray-200 rounded-full h-1.5">
                                    <div class="bg-pink-500 h-1.5 rounded-full stat-bar" style="width: 50%"></div>
                                </div>
                            </div>
                            <div>
                                <p class="text-sm font-medium text-gray-700 mb-1">Intelligence <span class="float-right">30%</span></p>
                                <div class="w-full bg-gray-200 rounded-full h-1.5">
                                    <div class="bg-blue-500 h-1.5 rounded-full stat-bar" style="width: 30%"></div>
                                </div>
                            </div>
                            <div>
                                <p class="text-sm font-medium text-gray-700 mb-1">Courage <span class="float-right">70%</span></p>
                                <div class="w-full bg-gray-200 rounded-full h-1.5">
                                    <div class="bg-yellow-500 h-1.5 rounded-full stat-bar" style="width: 70%"></div>
                                </div>
                            </div>
                            <div>
                                <p class="text-sm font-medium text-gray-700 mb-1">Empathy <span class="float-right">40%</span></p>
                                <div class="w-full bg-gray-200 rounded-full h-1.5">
                                    <div class="bg-green-500 h-1.5 rounded-full stat-bar" style="width: 40%"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Center - Main Game View -->
                <div class="w-full lg:w-2/4">
                    <div class="bg-white rounded-xl p-6 shadow-md mb-6 dialogue-box">
                        <div id="mainEvent" class="text-center py-8">
                            <h2 class="text-2xl font-bold text-purple-900 mb-4">Welcome to Monster Girl Academy</h2>
                            <p class="text-gray-700 mb-6">As the first human student admitted to this prestigious academy for magical beings, you'll navigate complex relationships with fascinating creatures from all walks of life. Each choice shapes your story and determines who you'll become by year's end.</p>
                            <button id="startAdventureBtn" class="bg-purple-600 hover:bg-purple-700 text-white px-8 py-3 rounded-full font-semibold text-lg transition">Begin Your Journey</button>
                        </div>
                    </div>

                    <div id="choicesContainer" class="grid grid-cols-1 md:grid-cols-2 gap-4 hidden">
                        <!-- Choices will be dynamically added here -->
                    </div>
                </div>

                <!-- Right Side - Calendar and Notifications -->
                <div class="w-full lg:w-1/4">
                    <div class="bg-white rounded-xl p-4 shadow-md mb-6">
                        <h2 class="text-xl font-bold mb-4 text-purple-800 border-b pb-2">Academy Calendar</h2>
                        <div class="grid grid-cols-7 gap-1 text-center mb-2">
                            <div class="text-xs font-semibold">S</div>
                            <div class="text-xs font-semibold">M</div>
                            <div class="text-xs font-semibold">T</div>
                            <div class="text-xs font-semibold">W</div>
                            <div class="text-xs font-semibold">T</div>
                            <div class="text-xs font-semibold">F</div>
                            <div class="text-xs font-semibold">S</div>
                        </div>
                        <div class="grid grid-cols-7 gap-1 text-center">
                            <!-- Calendar days will be dynamically added here -->
                            <div class="p-1 text-xs opacity-30">29</div>
                            <div class="p-1 text-xs opacity-30">30</div>
                            <div class="p-1 text-xs opacity-30">31</div>
                            <div class="p-1 text-xs border rounded-full bg-purple-100 font-semibold">1</div>
                            <div class="p-1 text-xs">2</div>
                            <div class="p-1 text-xs">3</div>
                            <div class="p-1 text-xs">4</div>
                            <div class="p-1 text-xs">5</div>
                            <div class="p-1 text-xs">6</div>
                            <div class="p-1 text-xs">7</div>
                            <div class="p-1 text-xs">8</div>
                            <div class="p-1 text-xs">9</div>
                            <div class="p-1 text-xs">10</div>
                            <div class="p-1 text-xs">11</div>
                            <div class="p-1 text-xs">12</div>
                            <div class="p-1 text-xs">13</div>
                            <div class="p-1 text-xs">14</div>
                            <div class="p-1 text-xs">15</div>
                            <div class="p-1 text-xs">16</div>
                            <div class="p-1 text-xs">17</div>
                            <div class="p-1 text-xs">18</div>
                            <div class="p-1 text-xs">19</div>
                            <div class="p-1 text-xs">20</div>
                            <div class="p-1 text-xs">21</div>
                            <div class="p-1 text-xs">22</div>
                            <div class="p-1 text-xs">23</div>
                            <div class="p-1 text-xs">24</div>
                            <div class="p-1 text-xs">25</div>
                            <div class="p-1 text-xs">26</div>
                            <div class="p-1 text-xs">27</div>
                            <div class="p-1 text-xs">28</div>
                            <div class="p-1 text-xs">29</div>
                            <div class="p-1 text-xs">30</div>
                            <div class="p-1 text-xs opacity-30">1</div>
                            <div class="p-1 text-xs opacity-30">2</div>
                        </div>
                        <div class="mt-4 pt-2 border-t">
                            <h3 class="font-semibold text-sm mb-2">Upcoming Events</h3>
                            <ul class="text-xs space-y-1">
                                <li class="flex items-center"><span class="w-2 h-2 bg-pink-500 rounded-full mr-2"></span> Moonlight Festival - Week 2</li>
                                <li class="flex items-center"><span class="w-2 h-2 bg-blue-500 rounded-full mr-2"></span> Midterms - Week 6</li>
                                <li class="flex items-center"><span class="w-2 h-2 bg-green-500 rounded-full mr-2"></span> Sports Day - Week 8</li>
                            </ul>
                        </div>
                    </div>

                    <div class="bg-white rounded-xl p-4 shadow-md">
                        <h2 class="text-xl font-bold mb-4 text-purple-800 border-b pb-2">Notifications</h2>
                        <div id="notifications" class="space-y-3">
                            <div class="p-2 bg-blue-50 rounded-lg text-sm">
                                <p class="font-medium">Welcome to Monster Girl Academy!</p>
                                <p class="text-xs text-gray-600">Find your dorm in the West Wing</p>
                            </div>
                            <div class="p-2 bg-yellow-50 rounded-lg text-sm">
                                <p class="font-medium">Orientation at 10AM</p>
                                <p class="text-xs text-gray-600">Main Hall, don't be late!</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Game State
        const gameState = {
            day: 1,
            time: 'Morning',
            energy: 10,
            maxEnergy: 10,
            money: 100,
            stats: {
                charm: 50,
                intelligence: 30,
                courage: 70,
                empathy: 40
            },
            relationships: {},
            currentEvent: null,
            eventHistory: [],
            flags: {}
        };

        // Monster Girls Database
        const monstergirls = {
            seraphina: {
                id: 'seraphina',
                name: 'Seraphina',
                species: 'Lamia',
                title: 'The Serpent Prodigy',
                personality: 'Intelligent, ambitious, but socially awkward',
                initialStats: {
                    trust: 30,
                    affection: 20,
                    curiosity: 60,
                    respect: 50
                },
                image: 'lamia.png',
                color: 'bg-green-100',
                textColor: 'text-green-800',
                borderColor: 'border-green-300',
                likes: ['Ancient history', 'Intellectual debates', 'Quiet libraries'],
                dislikes: ['Small talk', 'Disorganization', 'Loud noises'],
                events: [
                    {
                        id: 'library_encounter',
                        title: 'Unexpected Study Partner',
                        description: 'You find Seraphina surrounded by ancient tomes in the library. She seems frustrated with a particularly difficult text.',
                        choices: [
                            {
                                text: 'Offer to help with the research',
                                requirements: { intelligence: 40 },
                                outcomes: [
                                    { type: 'stat', target: 'seraphina', stat: 'trust', change: 10 },
                                    { type: 'stat', target: 'seraphina', stat: 'affection', change: 5 },
                                    { type: 'stat', target: 'player', stat: 'intelligence', change: 5 },
                                    { type: 'flag', id: 'helped_seraphina_research', value: true }
                                ]
                            },
                            {
                                text: 'Ask if she wants to take a break and get some air',
                                outcomes: [
                                    { type: 'stat', target: 'seraphina', stat: 'affection', change: -5 },
                                    { type: 'dialogue', text: "Seraphina glares at you. 'I don't have time for breaks. Some of us take our studies seriously.'" }
                                ]
                            },
                            {
                                text: 'Quietly sit nearby and study your own materials',
                                outcomes: [
                                    { type: 'stat', target: 'seraphina', stat: 'respect', change: 5 },
                                    { type: 'dialogue', text: "Seraphina glances at you occasionally, seeming to appreciate your quiet diligence." }
                                ]
                            }
                        ]
                    },
                    // More events for Seraphina...
                ]
            },
            marigold: {
                id: 'marigold',
                name: 'Marigold',
                species: 'Slimegirl',
                title: 'The Bubbly Alchemist',
                personality: 'Cheerful, curious, but easily distracted',
                initialStats: {
                    trust: 50,
                    affection: 40,
                    curiosity: 70,
                    respect: 30
                },
                image: 'slime.png',
                color: 'bg-blue-100',
                textColor: 'text-blue-800',
                borderColor: 'border-blue-300',
                likes: ['New experiences', 'Sweet treats', 'Colorful things'],
                dislikes: ['Being ignored', 'Boring routines', 'Hot temperatures'],
                events: [
                    {
                        id: 'lab_accident',
                        title: 'Sticky Situation',
                        description: 'Marigold has accidentally turned herself bright pink during an alchemy experiment and is panicking about how to fix it.',
                        choices: [
                            {
                                text: 'Help her find the antidote in the alchemy books',
                                requirements: { intelligence: 30 },
                                outcomes: [
                                    { type: 'stat', target: 'marigold', stat: 'trust', change: 15 },
                                    { type: 'stat', target: 'player', stat: 'intelligence', change: 5 },
                                    { type: 'dialogue', text: "'You're so smart!' Marigold bubbles happily as you find the solution. 'Let's make the antidote together!'" }
                                ]
                            },
                            {
                                text: 'Tell her the pink actually looks cute on her',
                                outcomes: [
                                    { type: 'stat', target: 'marigold', stat: 'affection', change: 10 },
                                    { type: 'dialogue', text: "Marigold giggles and wobbles excitedly. 'You really think so? Maybe I'll stay pink for a while longer!'" }
                                ]
                            },
                            {
                                text: 'Report the accident to the professor',
                                outcomes: [
                                    { type: 'stat', target: 'marigold', stat: 'trust', change: -10 },
                                    { type: 'stat', target: 'marigold', stat: 'affection', change: -15 },
                                    { type: 'dialogue', text: "'Snitches get stitches!' Marigold pouts as the professor scolds her. She seems really upset with you." }
                                ]
                            }
                        ]
                    },
                    // More events for Marigold...
                ]
            },
            // More monster girls...
        };

        // Initialize relationships
        function initRelationships() {
            for (const girlId in monstergirls) {
                gameState.relationships[girlId] = { ...monstergirls[girlId].initialStats };
            }
        }

        // DOM Elements
        const newGameBtn = document.getElementById('newGameBtn');
        const loadGameBtn = document.getElementById('loadGameBtn');
        const gameArea = document.getElementById('gameArea');
        const startAdventureBtn = document.getElementById('startAdventureBtn');
        const mainEvent = document.getElementById('mainEvent');
        const choicesContainer = document.getElementById('choicesContainer');
        const characterList = document.getElementById('characterList');

        // Event Listeners
        newGameBtn.addEventListener('click', startNewGame);
        loadGameBtn.addEventListener('click', loadGame);
        startAdventureBtn.addEventListener('click', beginAdventure);

        // Game Functions
        function startNewGame() {
            // Reset game state
            gameState.day = 1;
            gameState.time = 'Morning';
            gameState.energy = 10;
            gameState.money = 100;
            gameState.stats = {
                charm: 50,
                intelligence: 30,
                courage: 70,
                empathy: 40
            };
            gameState.eventHistory = [];
            gameState.flags = {};
            
            initRelationships();
            
            // Show game area
            gameArea.classList.remove('hidden');
            
            // Update UI
            updateGameInfo();
            renderCharacterList();
            
            // Start with first event
            triggerEvent('welcome_event');
        }

        function loadGame() {
            // In a real game, this would load from localStorage
            alert('Load game functionality would go here! For now, starting a new game.');
            startNewGame();
        }

        function beginAdventure() {
            triggerEvent('orientation_event');
        }

        function triggerEvent(eventId) {
            // Special events
            if (eventId === 'welcome_event') {
                mainEvent.innerHTML = `
                    <div class="flex flex-col items-center">
                        <img src="https://i.imgur.com/JQl1D1X.png" alt="Academy Gates" class="w-full max-w-md rounded-lg mb-4 character-portrait">
                        <h2 class="text-2xl font-bold text-purple-900 mb-4">The Academy Gates</h2>
                        <p class="text-gray-700 mb-4">The towering gates of Monster Girl Academy loom before you, their intricate ironwork depicting scenes of legendary creatures. As the first human student, you're not sure what to expect from this year.</p>
                        <p class="text-gray-700 mb-6">A cheerful harpy flies down to greet you. "Welcome! Orientation starts in an hour at the Main Hall. Until then, feel free to explore the grounds!"</p>
                        <div class="flex space-x-4">
                            <button class="event-choice-btn bg-purple-600 hover:bg-purple-700 text-white px-6 py-2 rounded-full font-semibold transition" data-choice="explore">Explore the Campus</button>
                            <button class="event-choice-btn bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded-full font-semibold transition" data-choice="dorm">Go Straight to Your Dorm</button>
                        </div>
                    </div>
                `;
                
                // Add event listeners to choice buttons
                document.querySelectorAll('.event-choice-btn').forEach(btn => {
                    btn.addEventListener('click', function() {
                        const choice = this.getAttribute('data-choice');
                        if (choice === 'explore') {
                            triggerEvent('campus_exploration');
                        } else {
                            triggerEvent('dorm_settle');
                        }
                    });
                });
                
                return;
            }
            
            // Find a random event from any girl
            const availableGirls = Object.values(monstergirls).filter(girl => 
                !gameState.eventHistory.includes(girl.events[0].id)
            );
            
            if (availableGirls.length > 0) {
                const randomGirl = availableGirls[Math.floor(Math.random() * availableGirls.length)];
                const girlEvent = randomGirl.events[0];
                gameState.currentEvent = girlEvent;
                gameState.eventHistory.push(girlEvent.id);
                
                displayEvent(girlEvent, randomGirl);
            } else {
                // No more events (shouldn't happen in demo)
                mainEvent.innerHTML = `
                    <div class="text-center py-8">
                        <h2 class="text-2xl font-bold text-purple-900 mb-4">End of Demo</h2>
                        <p class="text-gray-700 mb-6">This concludes our preview of Monster Girl Academy: Heartstrings. In the full game, you'd experience dozens more events, deeper relationships, and multiple endings with each character.</p>
                        <button onclick="startNewGame()" class="bg-purple-600 hover:bg-purple-700 text-white px-8 py-3 rounded-full font-semibold text-lg transition">Play Again</button>
                    </div>
                `;
            }
        }

        function displayEvent(event, girl) {
            mainEvent.innerHTML = `
                <div class="flex flex-col md:flex-row items-center md:items-start">
                    <img src="https://i.imgur.com/${girl.image || 'JQl1D1X.png'}" alt="${girl.name}" class="w-full max-w-xs rounded-lg mb-4 md:mb-0 md:mr-6 character-portrait">
                    <div>
                        <div class="flex items-center mb-2">
                            <h2 class="text-2xl font-bold ${girl.textColor}">${girl.name}</h2>
                            <span class="ml-2 px-2 py-1 text-xs rounded-full ${girl.color} ${girl.textColor}">${girl.species}</span>
                        </div>
                        <p class="text-gray-700 mb-4">${event.description}</p>
                    </div>
                </div>
            `;
            
            // Display choices
            choicesContainer.innerHTML = '';
            choicesContainer.classList.remove('hidden');
            
            event.choices.forEach((choice, index) => {
                const choiceBtn = document.createElement('button');
                choiceBtn.className = `choice-btn bg-white hover:bg-gray-50 border ${girl.borderColor} text-gray-800 px-4 py-3 rounded-lg font-medium text-left`;
                choiceBtn.textContent = choice.text;
                
                // Check requirements
                let meetsRequirements = true;
                if (choice.requirements) {
                    for (const stat in choice.requirements) {
                        if (gameState.stats[stat] < choice.requirements[stat]) {
                            meetsRequirements = false;
                            choiceBtn.className = `choice-btn bg-gray-100 border border-gray-200 text-gray-400 px-4 py-3 rounded-lg font-medium text-left cursor-not-allowed`;
                            choiceBtn.title = `Requires ${stat} ${choice.requirements[stat]}`;
                        }
                    }
                }
                
                if (meetsRequirements) {
                    choiceBtn.addEventListener('click', () => handleChoice(choice, girl));
                }
                
                choicesContainer.appendChild(choiceBtn);
            });
        }

        function handleChoice(choice, girl) {
            // Apply outcomes
            choice.outcomes.forEach(outcome => {
                if (outcome.type === 'stat') {
                    if (outcome.target === 'player') {
                        gameState.stats[outcome.stat] += outcome.change;
                        gameState.stats[outcome.stat] = Math.max(0, Math.min(100, gameState.stats[outcome.stat]));
                    } else {
                        gameState.relationships[girl.id][outcome.stat] += outcome.change;
                        gameState.relationships[girl.id][outcome.stat] = Math.max(0, Math.min(100, gameState.relationships[girl.id][outcome.stat]));
                    }
                } else if (outcome.type === 'flag') {
                    gameState.flags[outcome.id] = outcome.value;
                } else if (outcome.type === 'dialogue') {
                    // Show dialogue (simplified for demo)
                    alert(outcome.text);
                }
            });
            
            // Advance time
            advanceTime();
            
            // Update UI
            updateGameInfo();
            renderCharacterList();
            
            // Trigger next event
            triggerEvent('random');
        }

        function advanceTime() {
            // Simplified time system for demo
            const times = ['Morning', 'Afternoon', 'Evening', 'Night'];
            const currentIndex = times.indexOf(gameState.time);
            
            if (currentIndex < times.length - 1) {
                gameState.time = times[currentIndex + 1];
            } else {
                gameState.time = 'Morning';
                gameState.day++;
                
                // Restore some energy each new day
                gameState.energy = Math.min(gameState.maxEnergy, gameState.energy + 5);
            }
            
            // Spend energy
            gameState.energy = Math.max(0, gameState.energy - 2);
        }

        function updateGameInfo() {
            document.getElementById('gameDay').textContent = `Day ${gameState.day}`;
            document.getElementById('gameTime').textContent = gameState.time;
            document.getElementById('gameMoney').textContent = gameState.money;
            document.getElementById('gameEnergy').textContent = `${gameState.energy}/${gameState.maxEnergy}`;
            
            // Update stat bars
            for (const stat in gameState.stats) {
                const statElements = document.querySelectorAll(`.stat-bar[data-stat="${stat}"]`);
                statElements.forEach(el => {
                    el.style.width = `${gameState.stats[stat]}%`;
                });
            }
        }

        function renderCharacterList() {
            characterList.innerHTML = '';
            
            for (const girlId in monstergirls) {
                const girl = monstergirls[girlId];
                const relationship = gameState.relationships[girlId];
                
                const girlCard = document.createElement('div');
                girlCard.className = `character-card ${girl.color} ${girl.borderColor} border-2 p-3 rounded-lg flex items-center`;
                
                // Calculate overall relationship percentage (simplified)
                const totalStats = Object.values(relationship).reduce((a, b) => a + b, 0);
                const relationshipPercent = Math.floor(totalStats / (Object.keys(relationship).length * 100) * 100);
                
                girlCard.innerHTML = `
                    <div class="w-12 h-12 rounded-full ${girl.color} border-2 ${girl.borderColor} mr-3 flex-shrink-0 overflow-hidden">
                        <img src="https://i.imgur.com/${girl.image || 'JQl1D1X.png'}" alt="${girl.name}" class="w-full h-full object-cover">
                    </div>
                    <div class="flex-grow">
                        <h3 class="font-semibold ${girl.textColor}">${girl.name}</h3>
                        <p class="text-xs text-gray-600">${girl.species}</p>
                        <div class="w-full bg-gray-200 rounded-full h-1.5 mt-1">
                            <div class="h-1.5 rounded-full ${girl.borderColor.replace('border', 'bg')}" style="width: ${relationshipPercent}%"></div>
                        </div>
                    </div>
                `;
                
                characterList.appendChild(girlCard);
            }
        }

        // Initialize
        initRelationships();
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=lunarflu/rpg" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>