Spaces:
Running

File size: 17,778 Bytes
f116c5b
020428c
 
 
 
 
f116c5b
020428c
 
f116c5b
 
 
 
2e9a087
f116c5b
 
 
020428c
f116c5b
 
020428c
f116c5b
020428c
2e9a087
f116c5b
2e9a087
 
f116c5b
2e9a087
 
f116c5b
 
 
 
2e9a087
f116c5b
 
 
 
 
2e9a087
 
 
 
 
f116c5b
2e9a087
f116c5b
 
2e9a087
f116c5b
 
 
 
 
 
020428c
 
f116c5b
 
2e9a087
f116c5b
 
 
020428c
 
f116c5b
 
020428c
f116c5b
2e9a087
f116c5b
 
 
020428c
2e9a087
f116c5b
 
 
 
 
 
020428c
2e9a087
f116c5b
 
 
 
 
 
 
 
 
 
 
 
020428c
 
 
f116c5b
020428c
2e9a087
f116c5b
 
 
020428c
 
 
 
f116c5b
 
 
2e9a087
 
f116c5b
2e9a087
f116c5b
 
 
 
 
020428c
f116c5b
 
 
 
 
 
 
 
020428c
2e9a087
f116c5b
2e9a087
f116c5b
 
 
020428c
f116c5b
020428c
f116c5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
020428c
 
f116c5b
 
 
 
 
 
 
 
 
 
 
 
2e9a087
020428c
 
 
 
f116c5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e9a087
f116c5b
020428c
f116c5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e9a087
 
f116c5b
 
 
 
 
 
 
 
020428c
f116c5b
 
 
 
 
020428c
f116c5b
020428c
f116c5b
 
 
020428c
 
f116c5b
 
 
 
 
 
020428c
 
f116c5b
 
 
 
020428c
 
f116c5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
020428c
f116c5b
 
 
 
020428c
f116c5b
 
020428c
f116c5b
 
 
 
 
 
 
 
 
 
 
 
 
 
020428c
f116c5b
 
 
 
 
2e9a087
f116c5b
 
2e9a087
020428c
 
2e9a087
f116c5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e9a087
f116c5b
 
 
 
 
 
 
 
 
 
 
 
 
 
020428c
87de61e
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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dream Nebula</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@200;400&display=swap" rel="stylesheet">
<style>
    * {
        font-family: 'Outfit', sans-serif;
    }
        @keyframes float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-15px); }
        }

        .bubble {
            position: absolute;
            border-radius: 50%;
            background: radial-gradient(
                circle at 30% 30%,
                rgba(255,255,255,0.8) 0%,
                transparent 70%
            );
            backdrop-filter: blur(2px);
            transition: transform 0.3s ease, filter 0.3s ease;
            will-change: transform;
            filter: saturate(1.2);
            box-shadow: 
                inset 0 0 15px rgba(255,255,255,0.2),
                inset 10px 0 20px rgba(180,100,255,0.2),
                inset -10px 0 20px rgba(100,200,255,0.2);
            border: 1px solid rgba(255,255,255,0.15);
            animation: float 6s ease-in-out infinite;
        }
        
        .bubble::before {
            content: '';
            position: absolute;
            top: 10%;
            left: 20%;
            width: 40%;
            height: 40%;
            border-radius: 50%;
            background: linear-gradient(45deg, 
                rgba(255,100,255,0.3), 
                rgba(100,200,255,0.3), 
                rgba(100,255,200,0.3));
            filter: blur(10px);
            z-index: -1;
        }
        .bubble:hover {
            transform: scale(1.1);
            filter: brightness(1.1) saturate(1.5);
            box-shadow: 
                inset 0 0 20px rgba(255,255,255,0.3),
                inset 15px 0 30px rgba(180,100,255,0.3),
                inset -15px 0 30px rgba(100,200,255,0.3);
        }
        .bubble-expanded {
            animation: none;
            transform: scale(1.8) !important;
            z-index: 100;
            backdrop-filter: blur(10px);
            box-shadow: 
                inset 0 0 30px rgba(255,255,255,0.4),
                inset 20px 0 40px rgba(180,100,255,0.4),
                inset -20px 0 40px rgba(100,200,255,0.4);
        }
        .cosmic-bg {
            background: radial-gradient(ellipse at center, 
                rgba(15,12,41,1) 0%, 
                rgba(48,43,99,0.8) 50%, 
                rgba(36,36,62,0.6) 100%);
            position: relative;
            overflow: hidden;
        }
        
        .cosmic-bg::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: 
                radial-gradient(circle at 20% 30%, rgba(180,100,255,0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(100,200,255,0.1) 0%, transparent 50%);
            pointer-events: none;
        }
        .thought-content {
            opacity: 0;
            max-height: 0;
            transition: all 0.4s ease-out;
            overflow: hidden;
            position: relative;
            text-align: center;
            color: white;
            pointer-events: none;
        }
        
        .bubble-expanded .thought-content {
            opacity: 1;
            max-height: 200px;
            padding: 15px;
            pointer-events: auto;
        }
        .stellar-text {
            font-weight: 200;
            letter-spacing: 2px;
            background: linear-gradient(90deg, #ffffff, #aad5ff);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            text-shadow: 0 0 15px rgba(170,213,255,0.3);
        }
        
        .star {
            position: absolute;
            background: white;
            border-radius: 50%;
            pointer-events: none;
        }
</style>
</head>
<body class="cosmic-bg h-screen overflow-hidden relative">
    <div id="stars-container" class="absolute inset-0 w-full h-full pointer-events-none"></div>
    
    <header class="relative z-10 pt-12 pb-8 px-4 text-center">
        <h1 class="text-5xl md:text-6xl font-light stellar-text">
            DREAM NEBULA
        </h1>
        <p class="text-blue-100 mt-2 font-light tracking-wider text-sm md:text-base">FLOATING THOUGHT BUBBLES</p>
    </header>
    
    <button id="add-bubble-btn" class="fixed top-6 right-6 z-20 p-3 rounded-full bg-white/10 backdrop-blur-md text-white hover:bg-white/20 transition-all">
        <i data-feather="plus" class="w-5 h-5"></i>
    </button>
    <main class="relative z-10 h-[calc(100vh-180px)]">
        <div id="bubble-container" class="absolute inset-0"></div>
    </main>
    <!-- Add Bubble Modal -->
    <div id="add-bubble-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm hidden">
        <div class="bg-gradient-to-br from-white/10 to-white/5 rounded-xl p-6 max-w-md w-full mx-4 border border-white/10 backdrop-blur-lg">
            <h3 class="text-xl font-light text-white mb-4">Add Thought Bubble</h3>
            <textarea id="bubble-text" class="w-full p-3 bg-white/5 text-white rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-white/30 placeholder-white/50" rows="4" placeholder="Your dreamlike thought..."></textarea>
            <div class="flex justify-end space-x-3 mt-4">
                <button id="cancel-bubble" class="px-4 py-2 text-white/70 hover:text-white">Cancel</button>
                <button id="save-bubble" class="px-4 py-2 bg-white/10 hover:bg-white/20 text-white rounded-lg transition">Save</button>
            </div>
        </div>
    </div>

    <!-- Edit Bubble Modal -->
    <div id="edit-bubble-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm hidden">
        <div class="bg-gradient-to-br from-white/10 to-white/5 rounded-xl p-6 max-w-md w-full mx-4 border border-white/10 backdrop-blur-lg">
            <h3 class="text-xl font-light text-white mb-4">Edit Bubble</h3>
            <textarea id="edit-bubble-text" class="w-full p-3 bg-white/5 text-white rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-white/30 placeholder-white/50" rows="4"></textarea>
            <div class="flex justify-between mt-4">
                <button id="delete-bubble" class="px-4 py-2 text-red-300 hover:text-red-400">Delete</button>
                <div class="flex space-x-3">
                    <button id="cancel-edit" class="px-4 py-2 text-white/70 hover:text-white">Cancel</button>
                    <button id="save-edit" class="px-4 py-2 bg-white/10 hover:bg-white/20 text-white rounded-lg transition">Save</button>
                </div>
            </div>
        </div>
    </div>
<script>
        // Generate random stars
        function createStars() {
            const container = document.getElementById('stars-container');
            const starCount = Math.floor(window.innerWidth * window.innerHeight / 1000);
            
            for (let i = 0; i < starCount; i++) {
                const star = document.createElement('div');
                star.className = 'star';
                
                // Random position and size
                const size = Math.random() * 2;
                star.style.width = `${size}px`;
                star.style.height = `${size}px`;
                star.style.left = `${Math.random() * 100}%`;
                star.style.top = `${Math.random() * 100}%`;
                
                // Random opacity and animation
                star.style.opacity = Math.random() * 0.8 + 0.2;
                star.style.animation = `twinkle ${Math.random() * 5 + 5}s infinite alternate`;
                
                container.appendChild(star);
            }
        }
        
        // Initialize bubble functionality
        document.addEventListener('DOMContentLoaded', function() {
            createStars();
            feather.replace();
            
            // Initialize bubbles from localStorage or create default ones
            loadBubbles();
            
            // Modal functionality
            const addBtn = document.getElementById('add-bubble-btn');
            const addModal = document.getElementById('add-bubble-modal');
            const cancelBtn = document.getElementById('cancel-bubble');
            const saveBtn = document.getElementById('save-bubble');
            
            addBtn.addEventListener('click', () => addModal.classList.remove('hidden'));
            cancelBtn.addEventListener('click', () => {
                document.getElementById('bubble-text').value = '';
                addModal.classList.add('hidden');
            });
            
            saveBtn.addEventListener('click', () => {
                const text = document.getElementById('bubble-text').value.trim();
                if (text) {
                    createBubble(text);
                    document.getElementById('bubble-text').value = '';
                    addModal.classList.add('hidden');
                }
            });
            
            // Edit modal functionality
            const editModal = document.getElementById('edit-bubble-modal');
            const cancelEditBtn = document.getElementById('cancel-edit');
            const saveEditBtn = document.getElementById('save-edit');
            const deleteBtn = document.getElementById('delete-bubble');
            
            let currentBubbleId = null;
            
            cancelEditBtn.addEventListener('click', () => {
                document.getElementById('edit-bubble-text').value = '';
                editModal.classList.add('hidden');
            });
            
            saveEditBtn.addEventListener('click', () => {
                const text = document.getElementById('edit-bubble-text').value.trim();
                if (text && currentBubbleId) {
                    updateBubble(currentBubbleId, text);
                    editModal.classList.add('hidden');
                }
            });
            
            deleteBtn.addEventListener('click', () => {
                if (currentBubbleId) {
                    deleteBubble(currentBubbleId);
                    editModal.classList.add('hidden');
                }
            });
        });
        
        // Bubble functions
        function loadBubbles() {
            let bubbles = localStorage.getItem('bubbles');
            if (!bubbles) {
                // Create default bubbles
                bubbles = [
                    {
                        id: Date.now().toString(),
                        text: "We are all just fragments of stardust trying to remember where we came from.",
                        x: 20, y: 30, z: 0,
                        color: 'rgba(180,100,255,0.2)'
                    },
                    {
                        id: (Date.now() + 1).toString(),
                        text: "Time is just the universe's way of preventing everything from happening at once.",
                        x: 70, y: 20, z: 20,
                        color: 'rgba(100,200,255,0.2)'
                    },
                    {
                        id: (Date.now() + 2).toString(),
                        text: "The trees are poems the earth writes upon the sky.",
                        x: 30, y: 60, z: -20,
                        color: 'rgba(255,100,200,0.2)'
                    }
                ];
                localStorage.setItem('bubbles', JSON.stringify(bubbles));
            } else {
                bubbles = JSON.parse(bubbles);
            }
            
            bubbles.forEach(bubble => createBubbleElement(bubble));
        }
        
        function createBubble(text) {
            const bubble = {
                id: Date.now().toString(),
                text: text,
                x: Math.random() * 80 + 10, // 10-90%
                y: Math.random() * 80 + 10, // 10-90%
                z: Math.random() * 40 - 20, // -20 to 20
                color: `rgba(${Math.floor(Math.random() * 100 + 155)}, ${Math.floor(Math.random() * 100 + 100)}, 255, 0.2)`
            };
            
            // Save to localStorage
            let bubbles = JSON.parse(localStorage.getItem('bubbles') || '[]');
            bubbles.push(bubble);
            localStorage.setItem('bubbles', JSON.stringify(bubbles));
            
            createBubbleElement(bubble);
        }
        
        function createBubbleElement(bubble) {
            const container = document.getElementById('bubble-container');
            const bubbleEl = document.createElement('div');
            const size = Math.random() * 60 + 40; // 40-100px
            
            bubbleEl.className = 'bubble cursor-pointer';
            bubbleEl.style.width = `${size}px`;
            bubbleEl.style.height = `${size}px`;
            bubbleEl.style.left = `${bubble.x}%`;
            bubbleEl.style.top = `${bubble.y}%`;
            bubbleEl.style.background = bubble.color;
            bubbleEl.dataset.id = bubble.id;
            
            // Set transform for z-depth parallax effect
            bubbleEl.style.transform = `translateZ(${bubble.z}px)`;
            
            // Create content div
            const content = document.createElement('div');
            content.className = 'thought-content';
            content.textContent = bubble.text;
            bubbleEl.appendChild(content);
            
            // Add float animation with GSAP
            gsap.to(bubbleEl, {
                duration: 10 + Math.random() * 10,
                y: `+=${(Math.random() * 30 - 15) * (1 + bubble.z/100)}`,
                x: `+=${(Math.random() * 30 - 15) * (1 + bubble.z/100)}`,
                ease: "sine.inOut",
                repeat: -1,
                yoyo: true
            });
            
            // Click handler
            bubbleEl.addEventListener('click', function(e) {
                e.stopPropagation();
                
                // Close any expanded bubble
                document.querySelectorAll('.bubble-expanded').forEach(el => {
                    if (el !== bubbleEl) el.classList.remove('bubble-expanded');
                });
                
                // Toggle current bubble
                bubbleEl.classList.toggle('bubble-expanded');
                
                // If expanded, open edit modal
                if (bubbleEl.classList.contains('bubble-expanded')) {
                    currentBubbleId = bubble.id;
                    document.getElementById('edit-bubble-text').value = bubble.text;
                    editModal.classList.remove('hidden');
                }
            });
            
            // Hover effect
            bubbleEl.addEventListener('mouseenter', () => {
                gsap.to(bubbleEl, {
                    duration: 0.3,
                    scale: 1.1,
                    ease: "power2.out"
                });
            });
            
            bubbleEl.addEventListener('mouseleave', () => {
                if (!bubbleEl.classList.contains('bubble-expanded')) {
                    gsap.to(bubbleEl, {
                        duration: 0.3,
                        scale: 1,
                        ease: "power2.out"
                    });
                }
            });
            
            container.appendChild(bubbleEl);
        }
        
        function updateBubble(id, text) {
            let bubbles = JSON.parse(localStorage.getItem('bubbles') || '[]');
            const index = bubbles.findIndex(b => b.id === id);
            
            if (index !== -1) {
                bubbles[index].text = text;
                localStorage.setItem('bubbles', JSON.stringify(bubbles));
                
                // Update DOM
                const bubbleEl = document.querySelector(`.bubble[data-id="${id}"]`);
                if (bubbleEl) {
                    bubbleEl.querySelector('.thought-content').textContent = text;
                }
            }
        }
        
        function deleteBubble(id) {
            let bubbles = JSON.parse(localStorage.getItem('bubbles') || '[]');
            bubbles = bubbles.filter(b => b.id !== id);
            localStorage.setItem('bubbles', JSON.stringify(bubbles));
            
            // Remove from DOM
            const bubbleEl = document.querySelector(`.bubble[data-id="${id}"]`);
            if (bubbleEl) {
                gsap.to(bubbleEl, {
                    duration: 0.3,
                    scale: 0,
                    opacity: 0,
                    onComplete: () => bubbleEl.remove()
                });
            }
        }
        
        // Close modals when clicking outside
        document.addEventListener('click', function(e) {
            if (!e.target.closest('#add-bubble-modal > div') && !e.target.closest('#add-bubble-btn')) {
                document.getElementById('add-bubble-modal').classList.add('hidden');
            }
            
            if (!e.target.closest('#edit-bubble-modal > div')) {
                document.getElementById('edit-bubble-modal').classList.add('hidden');
            }
        });
</script>
</body>
</html>