File size: 16,247 Bytes
fda428e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Unicorn Bedtime Stories</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>
        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
        
        body {
            font-family: 'Poppins', sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .unicorn-bg {
            background: linear-gradient(to bottom right, #a78bfa, #c084fc, #e879f9);
        }
        
        .story-card {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }
        
        .story-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
        }
        
        .btn-magic {
            background: linear-gradient(to right, #8b5cf6, #d946ef);
            color: white;
            transition: all 0.3s ease;
        }
        
        .btn-magic:hover {
            transform: scale(1.05);
            box-shadow: 0 5px 15px rgba(139, 92, 246, 0.4);
        }
        
        .unicorn-icon {
            animation: float 3s ease-in-out infinite;
        }
        
        @keyframes float {
            0% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
            100% { transform: translateY(0px); }
        }
        
        .stars {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            pointer-events: none;
        }
        
        .star {
            position: absolute;
            background-color: white;
            border-radius: 50%;
            animation: twinkle var(--duration) ease-in-out infinite;
            opacity: 0;
        }
        
        @keyframes twinkle {
            0% { opacity: 0; transform: scale(0.5); }
            50% { opacity: 1; transform: scale(1); }
            100% { opacity: 0; transform: scale(0.5); }
        }
    </style>
</head>
<body class="flex flex-col items-center justify-center p-4">
    <div class="stars" id="stars"></div>
    
    <div class="w-full max-w-2xl mx-auto">
        <div class="unicorn-bg rounded-3xl p-8 md:p-10 text-center relative overflow-hidden mb-8">
            <div class="absolute top-0 left-0 w-full h-full opacity-20">
                <div class="absolute top-1/4 left-1/4 w-16 h-16 rounded-full bg-purple-300 blur-xl"></div>
                <div class="absolute top-1/3 right-1/3 w-20 h-20 rounded-full bg-pink-300 blur-xl"></div>
                <div class="absolute bottom-1/4 right-1/4 w-24 h-24 rounded-full bg-indigo-300 blur-xl"></div>
            </div>
            
            <i class="fas fa-horse-head unicorn-icon text-6xl text-white mb-4"></i>
            <h1 class="text-4xl md:text-5xl font-bold text-white mb-2">Unicorn Dreamland</h1>
            <p class="text-xl text-white opacity-90">Magical bedtime stories generated just for you</p>
        </div>
        
        <div class="story-card p-6 md:p-8 mb-8">
            <h2 class="text-2xl font-semibold text-purple-800 mb-4">Create Your Story</h2>
            
            <div class="mb-6">
                <label for="storyPrompt" class="block text-gray-700 mb-2">What kind of unicorn story would you like?</label>
                <div class="relative">
                    <input type="text" id="storyPrompt" 
                           class="w-full p-4 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500"
                           placeholder="e.g. A unicorn who discovers a hidden rainbow kingdom">
                    <div class="absolute right-2 top-2">
                        <button id="generateBtn" class="btn-magic px-6 py-2 rounded-lg font-medium">
                            <i class="fas fa-wand-magic-sparkles mr-2"></i> Generate
                        </button>
                    </div>
                </div>
            </div>
            
            <div class="flex flex-wrap gap-2 mb-6">
                <button class="prompt-btn px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm hover:bg-purple-200 transition">
                    <i class="fas fa-moon mr-1"></i> Sleepy unicorn
                </button>
                <button class="prompt-btn px-3 py-1 bg-pink-100 text-pink-800 rounded-full text-sm hover:bg-pink-200 transition">
                    <i class="fas fa-rainbow mr-1"></i> Rainbow adventure
                </button>
                <button class="prompt-btn px-3 py-1 bg-indigo-100 text-indigo-800 rounded-full text-sm hover:bg-indigo-200 transition">
                    <i class="fas fa-star mr-1"></i> Wishing star
                </button>
                <button class="prompt-btn px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm hover:bg-blue-200 transition">
                    <i class="fas fa-cloud mr-1"></i> Cloud castle
                </button>
            </div>
        </div>
        
        <div class="story-card p-6 md:p-8">
            <div class="flex items-center justify-between mb-4">
                <h2 class="text-2xl font-semibold text-purple-800">Your Story</h2>
                <button id="copyBtn" class="text-purple-600 hover:text-purple-800 transition">
                    <i class="far fa-copy"></i> Copy
                </button>
            </div>
            
            <div id="storyOutput" class="bg-purple-50 rounded-lg p-6 min-h-40 flex items-center justify-center">
                <p class="text-gray-500 text-center">Your magical unicorn story will appear here...</p>
            </div>
            
            <div class="mt-6 flex justify-between">
                <button id="saveBtn" class="px-4 py-2 border border-purple-500 text-purple-600 rounded-lg hover:bg-purple-50 transition">
                    <i class="far fa-bookmark mr-2"></i> Save
                </button>
                <button id="newStoryBtn" class="px-4 py-2 bg-purple-100 text-purple-800 rounded-lg hover:bg-purple-200 transition">
                    <i class="fas fa-plus mr-2"></i> New Story
                </button>
            </div>
        </div>
    </div>
    
    <div class="mt-8 text-center text-gray-500 text-sm">
        <p>Made with <i class="fas fa-heart text-pink-500"></i> for dreamers and unicorn lovers</p>
    </div>

    <script>
        // Sample unicorn stories to simulate API response
        const unicornStories = [
            "Once upon a dream, a silver-maned unicorn named Luna discovered that her tears could heal broken hearts, and so she traveled the world comforting those in need before tucking herself into a cloud each night.",
            "In a hidden valley where the moon never set, a golden unicorn named Stardust learned to weave dreams from strands of aurora borealis, creating the most beautiful nighttime stories for children around the world.",
            "Little Sparkle, the smallest unicorn in the enchanted forest, proved that size doesn't matter when she used her glowing horn to light up the entire kingdom during the longest night of the year.",
            "When the rainbow bridge began to fade, a brave unicorn named Iris embarked on a journey to the edge of the world to collect colors from the sunrise and save the magic of childhood dreams.",
            "Professor Whiskers, a scholarly unicorn with round glasses, wrote bedtime stories in the sky every evening by tracing constellations with his shimmering tail.",
            "A sleepy unicorn named Nimbus discovered that when she yawned, tiny dream clouds floated from her mouth, carrying children gently to sleep on soft, cotton candy-like pillows.",
            "The last unicorn in the valley, named Echo, learned that her beautiful singing voice could make flowers bloom at midnight, creating a secret garden visible only to those who truly believed in magic."
        ];
        
        // DOM elements
        const generateBtn = document.getElementById('generateBtn');
        const storyPrompt = document.getElementById('storyPrompt');
        const storyOutput = document.getElementById('storyOutput');
        const copyBtn = document.getElementById('copyBtn');
        const saveBtn = document.getElementById('saveBtn');
        const newStoryBtn = document.getElementById('newStoryBtn');
        const promptBtns = document.querySelectorAll('.prompt-btn');
        const starsContainer = document.getElementById('stars');
        
        // Create twinkling stars
        function createStars() {
            for (let i = 0; i < 50; i++) {
                const star = document.createElement('div');
                star.classList.add('star');
                star.style.width = `${Math.random() * 3 + 1}px`;
                star.style.height = star.style.width;
                star.style.left = `${Math.random() * 100}%`;
                star.style.top = `${Math.random() * 100}%`;
                star.style.setProperty('--duration', `${Math.random() * 3 + 2}s`);
                star.style.animationDelay = `${Math.random() * 5}s`;
                starsContainer.appendChild(star);
            }
        }
        
        // Generate a random unicorn story
        function generateStory() {
            const prompt = storyPrompt.value.trim();
            
            // Show loading state
            storyOutput.innerHTML = `
                <div class="flex flex-col items-center">
                    <div class="w-12 h-12 border-4 border-purple-500 border-t-transparent rounded-full animate-spin mb-2"></div>
                    <p class="text-purple-600">Summoning unicorn magic...</p>
                </div>
            `;
            
            // Simulate API delay
            setTimeout(() => {
                let story;
                
                if (prompt) {
                    // In a real app, this would be the API call:
                    // const response = await client.responses.create({
                    //     model: "gpt-4.1",
                    //     input: `Write a one-sentence bedtime story about a unicorn: ${prompt}`,
                    // });
                    // story = response.output_text;
                    
                    // For our demo, we'll use a random story and prepend the prompt
                    const randomStory = unicornStories[Math.floor(Math.random() * unicornStories.length)];
                    story = `"${prompt}" — ${randomStory}`;
                } else {
                    // If no prompt, use a completely random story
                    story = unicornStories[Math.floor(Math.random() * unicornStories.length)];
                }
                
                // Display the story with nice animation
                storyOutput.innerHTML = '';
                const storyElement = document.createElement('p');
                storyElement.className = 'text-gray-700 text-lg leading-relaxed animate-fadeIn';
                storyElement.textContent = story;
                storyOutput.appendChild(storyElement);
                
                // Add some sparkle effects
                addSparkleEffect();
            }, 1500);
        }
        
        // Add sparkle effect to the story
        function addSparkleEffect() {
            for (let i = 0; i < 10; i++) {
                const sparkle = document.createElement('div');
                sparkle.className = 'absolute w-2 h-2 bg-yellow-300 rounded-full opacity-70 animate-sparkle';
                sparkle.style.left = `${Math.random() * 80 + 10}%`;
                sparkle.style.top = `${Math.random() * 80 + 10}%`;
                sparkle.style.animationDuration = `${Math.random() * 0.5 + 0.5}s`;
                sparkle.style.animationDelay = `${Math.random() * 0.5}s`;
                storyOutput.appendChild(sparkle);
                
                // Remove sparkle after animation
                setTimeout(() => {
                    sparkle.remove();
                }, 1000);
            }
        }
        
        // Copy story to clipboard
        function copyStory() {
            const storyText = storyOutput.textContent;
            if (storyText && !storyText.includes('Your magical unicorn story')) {
                navigator.clipboard.writeText(storyText)
                    .then(() => {
                        // Show copied feedback
                        const originalIcon = copyBtn.innerHTML;
                        copyBtn.innerHTML = '<i class="fas fa-check"></i> Copied!';
                        setTimeout(() => {
                            copyBtn.innerHTML = originalIcon;
                        }, 2000);
                    });
            }
        }
        
        // Save story (simulated)
        function saveStory() {
            const storyText = storyOutput.textContent;
            if (storyText && !storyText.includes('Your magical unicorn story')) {
                // In a real app, this would save to a database
                saveBtn.innerHTML = '<i class="fas fa-check"></i> Saved!';
                setTimeout(() => {
                    saveBtn.innerHTML = '<i class="far fa-bookmark mr-2"></i> Save';
                }, 2000);
            }
        }
        
        // Reset for a new story
        function newStory() {
            storyPrompt.value = '';
            storyOutput.innerHTML = '<p class="text-gray-500 text-center">Your magical unicorn story will appear here...</p>';
        }
        
        // Event listeners
        generateBtn.addEventListener('click', generateStory);
        copyBtn.addEventListener('click', copyStory);
        saveBtn.addEventListener('click', saveStory);
        newStoryBtn.addEventListener('click', newStory);
        
        // Allow Enter key to generate story
        storyPrompt.addEventListener('keypress', (e) => {
            if (e.key === 'Enter') {
                generateStory();
            }
        });
        
        // Quick prompt buttons
        promptBtns.forEach(btn => {
            btn.addEventListener('click', () => {
                storyPrompt.value = btn.textContent.trim();
                generateStory();
            });
        });
        
        // Initialize
        createStars();
        
        // Add some CSS for animations
        const style = document.createElement('style');
        style.textContent = `
            @keyframes sparkle {
                0% { transform: scale(0); opacity: 0; }
                50% { transform: scale(1.5); opacity: 1; }
                100% { transform: scale(0); opacity: 0; }
            }
            
            .animate-sparkle {
                animation: sparkle ease-in-out;
            }
            
            @keyframes fadeIn {
                from { opacity: 0; transform: translateY(10px); }
                to { opacity: 1; transform: translateY(0); }
            }
            
            .animate-fadeIn {
                animation: fadeIn 0.5s ease-out forwards;
            }
        `;
        document.head.appendChild(style);
    </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=privateuserh/privatedev1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>