-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgalleta.html
More file actions
588 lines (543 loc) · 24 KB
/
Copy pathgalleta.html
File metadata and controls
588 lines (543 loc) · 24 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
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Sabiduría del Mundo</title>
<link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&display=swap" rel="stylesheet"/>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--ink-950: #0e0a05;
--ink-900: #17110a;
--ink-800: #211809;
--gold-100: #f6e7bf;
--gold-300: #e8c870;
--gold-500: #c9a84c;
--gold-700: #a2822f;
--gold-900: #6b4f14;
--parchment: #f6ecd4;
--parchment-2: #ecdcb4;
--ink-text: #2a1f10;
--ink-text-soft: #5c4a2a;
--ivory: #fdf8ec;
--border-g: rgba(232,200,112,.32);
--ff-title: 'Cinzel', Palatino, serif;
--ff-body: 'Cormorant Garamond', Georgia, serif;
}
html, body {
height: 100%;
background:
radial-gradient(ellipse 60% 50% at 18% 50%, rgba(139,105,20,.22), transparent 60%),
radial-gradient(ellipse 120% 100% at 50% 100%, rgba(0,0,0,.45), transparent 60%),
linear-gradient(160deg, var(--ink-900), var(--ink-950) 70%);
font-family: var(--ff-body);
color: var(--ivory);
overflow: hidden;
}
/* Resplandor ambiental muy sutil */
body::before {
content: '';
position: fixed; inset: 0; z-index: 0; pointer-events: none;
background: radial-gradient(ellipse 50% 45% at 20% 55%, rgba(201,168,76,.16), transparent 65%);
animation: ambientPulse 8s ease-in-out infinite;
}
@keyframes ambientPulse {
0%,100% { opacity: .55; transform: scale(1); }
50% { opacity: 1; transform: scale(1.08); }
}
/* Grano sutil sobre todo (textura, sin imágenes externas) */
body::after {
content: '';
position: fixed; inset: 0; z-index: 50; pointer-events: none;
opacity: .035;
mix-blend-mode: overlay;
background-repeat: repeat;
background-size: 220px 220px;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='300' height='300' filter='url(%23n)'/></svg>");
}
/* Polvo dorado de fondo */
.dust { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.dot {
position: absolute; border-radius: 50%; background: var(--gold-300);
animation: twinkle var(--d,4s) ease-in-out infinite var(--del,0s);
}
@keyframes twinkle {
0%,100% { opacity:.04; transform:scale(1); }
50% { opacity:.32; transform:scale(1.6); }
}
/* ── Widget principal ── */
.widget {
position: relative; z-index: 10;
display: flex;
align-items: center;
gap: 0;
height: 100vh;
border-top: 2px solid var(--gold-500);
box-shadow: inset 0 40px 60px -46px rgba(0,0,0,.7);
overflow: hidden;
}
/* Filo dorado superior con brillo recorriéndolo */
.widget::before {
content: '';
position: absolute; top: 0; left: 0; right: 0; height: 2px;
background: linear-gradient(90deg, transparent, var(--gold-300), var(--gold-100), var(--gold-300), transparent);
background-size: 200% 100%;
animation: edge-shimmer 5s linear infinite;
}
@keyframes edge-shimmer {
0% { background-position: 0% 0; }
100% { background-position: 200% 0; }
}
/* Separador vertical entre galleta y mensaje */
.widget::after {
content: '';
position: absolute;
left: 168px;
top: 12%; bottom: 12%;
width: 1px;
background: linear-gradient(to bottom, transparent, var(--border-g) 30%, var(--border-g) 70%, transparent);
box-shadow: 0 0 8px 0 rgba(232,200,112,.15);
}
/* ── Lado izquierdo: galleta ── */
.left {
flex: 0 0 168px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
padding: 10px 16px;
height: 100%;
}
/* Título pequeño */
.widget-title {
font-family: var(--ff-title);
font-weight: 600;
font-size: .64rem;
letter-spacing: .16em;
text-transform: uppercase;
text-align: center;
line-height: 1.35;
max-width: 134px;
background: linear-gradient(90deg, var(--gold-500), var(--gold-100), var(--gold-300), var(--gold-100), var(--gold-500));
background-size: 250%;
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
background-clip: text;
animation: shimmer 7s linear infinite, enterDown .7s ease both;
}
@keyframes shimmer {
0% { background-position: 0%; }
100% { background-position: 250%; }
}
.title-rule {
width: 34px; height: 2px; margin: 0 auto;
background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
opacity: .85;
}
/* ── Cookie clicable ── */
.cookie-btn {
width: 96px; height: 96px;
cursor: pointer;
position: relative;
background: none; border: none; padding: 0;
display: flex; align-items: center; justify-content: center;
-webkit-tap-highlight-color: transparent;
animation: enterScale .6s cubic-bezier(.34,1.56,.64,1) .12s both;
}
/* Halo dorado detrás de la galleta */
.cookie-btn::before {
content: '';
position: absolute; inset: -28px; border-radius: 50%;
background: radial-gradient(circle, rgba(232,200,112,.4), transparent 70%);
filter: blur(8px); z-index: -1;
animation: halo-pulse 4.2s ease-in-out infinite;
}
/* Anillo tenue tipo astrolabio girando */
.cookie-btn::after {
content: '';
position: absolute; inset: -16px; border-radius: 50%;
border: 1px dashed rgba(232,200,112,.32);
z-index: -1;
animation: spin 22s linear infinite;
transition: opacity .3s;
}
@keyframes halo-pulse {
0%,100% { opacity: .5; transform: scale(.92); }
50% { opacity: 1; transform: scale(1.1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
.cookie-btn:focus-visible {
outline: 2px dashed var(--gold-300); outline-offset: 6px; border-radius: 50%;
box-shadow: 0 0 0 4px rgba(232,200,112,.25);
}
.cookie-svg {
width: 96px; height: 96px;
transform-style: preserve-3d;
filter: drop-shadow(0 3px 8px rgba(0,0,0,.5));
transition: filter .3s;
}
/* Idle float */
.cookie-btn:not(.cracking):not(.opened) .cookie-svg {
animation: float 3.8s ease-in-out infinite;
}
@keyframes float {
0%,100% { transform: translateY(0) rotate(-2deg); }
50% { transform: translateY(-6px) rotate(2deg); }
}
/* Hover glow */
.cookie-btn:hover .cookie-svg {
filter: drop-shadow(0 0 16px rgba(232,200,112,.75)) drop-shadow(0 3px 8px rgba(0,0,0,.5));
}
.cookie-btn:hover::before {
animation-duration: 1.6s;
background: radial-gradient(circle, rgba(232,200,112,.65), transparent 70%);
}
/* Shake on crack */
.cookie-btn.cracking .cookie-svg {
animation: shake .5s ease-in-out forwards;
}
.cookie-btn.cracking::after,
.cookie-btn.opened::after { opacity: 0; }
@keyframes shake {
0% { transform: rotate(0); }
20% { transform: rotate(-9deg) scale(1.06); }
40% { transform: rotate(9deg) scale(1.09); }
60% { transform: rotate(-5deg) scale(1.06); }
80% { transform: rotate(4deg) scale(1.03); }
100% { transform: rotate(0) scale(1); }
}
/* Split open */
.half-top, .half-bot {
transform-origin: center;
transition: transform .55s cubic-bezier(.34,1.56,.64,1);
}
.cookie-btn.opened .half-top { transform: translateY(-8px) rotate(-11deg); }
.cookie-btn.opened .half-bot { transform: translateY(8px) rotate(11deg); }
/* Glow when opened */
.cookie-btn.opened .cookie-svg {
animation: glowpulse 2.4s ease-in-out infinite !important;
}
.cookie-btn.opened::before {
animation: halo-pulse 2.2s ease-in-out infinite;
background: radial-gradient(circle, rgba(232,200,112,.55), transparent 70%);
}
@keyframes glowpulse {
0%,100% { filter: drop-shadow(0 0 8px rgba(232,200,112,.5)); }
50% { filter: drop-shadow(0 0 22px rgba(232,200,112,.9)); }
}
/* Crack line */
.crack-line { opacity: 0; transition: opacity .3s; }
.cookie-btn.opened .crack-line { opacity: 1; }
/* Hint label */
.hint {
font-family: var(--ff-body);
font-style: italic;
font-size: .74rem;
color: var(--gold-300);
opacity: .85;
letter-spacing: .04em;
text-align: center;
line-height: 1.25;
transition: opacity .3s;
animation: enterUp .6s ease .32s both;
}
.cookie-btn.opened ~ .hint { opacity: 0; pointer-events: none; }
/* Contador */
.counter {
font-family: var(--ff-title);
font-size: .52rem;
letter-spacing: .1em;
color: var(--gold-300);
opacity: .65;
text-align: center;
animation: enterUp .6s ease .4s both;
}
/* ── Lado derecho: mensaje ── */
.right {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 14px 26px 14px 22px;
height: 100%;
position: relative;
perspective: 800px;
animation: fadeIn .8s ease .2s both;
}
/* Estado vacío */
.empty-msg {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
}
.empty-glyph {
width: 40px; height: 40px;
opacity: .45;
animation: spin 30s linear infinite;
}
.empty-text {
font-family: var(--ff-body);
font-style: italic;
font-size: .92rem;
color: var(--ivory);
opacity: .7;
letter-spacing: .03em;
text-align: center;
line-height: 1.55;
}
/* Pergamino */
.paper {
width: 100%;
max-width: 460px;
background:
radial-gradient(ellipse 60% 50% at 18% 15%, var(--parchment-2), transparent 60%),
radial-gradient(ellipse 55% 50% at 85% 92%, var(--parchment-2), transparent 55%),
var(--parchment);
border-radius: 10px;
border: 1px solid var(--gold-700);
border-top: 2px solid var(--gold-300);
padding: 30px 20px 16px;
position: relative;
opacity: 0;
transform: translateY(18px) rotateX(6deg) scale(.97);
transform-origin: top center;
transition: opacity .5s ease, transform .6s cubic-bezier(.34,1.56,.64,1);
box-shadow: 0 16px 34px -10px rgba(0,0,0,.6);
display: none;
}
.paper.visible { opacity: 1; transform: translateY(0) rotateX(0) scale(1); display: block; }
/* Sello de cera con el símbolo de la tradición */
.paper-symbol {
position: absolute; top: -26px; left: 50%;
width: 54px; height: 54px; border-radius: 50%;
display: flex; align-items: center; justify-content: center;
font-size: 1.35rem; line-height: 1; color: var(--ink-text);
background: radial-gradient(circle at 35% 30%, var(--gold-100), var(--gold-500) 65%, var(--gold-900));
border: 2px solid var(--parchment);
box-shadow: 0 6px 14px rgba(0,0,0,.5), inset 0 1px 2px rgba(255,255,255,.55);
transform: translateX(-50%) scale(0) rotate(-25deg);
transition: transform .5s cubic-bezier(.34,1.56,.64,1) .18s;
}
.paper.visible .paper-symbol { transform: translateX(-50%) scale(1) rotate(0deg); }
.paper-text {
font-family: var(--ff-body); font-style: italic;
font-size: clamp(.86rem, 2.2vw, 1.02rem);
color: var(--ink-text); line-height: 1.6;
text-align: center; letter-spacing: .01em;
}
.paper-meta {
margin-top: 10px;
border-top: 1px solid rgba(42,31,16,.15);
padding-top: 8px;
display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.paper-source {
font-family: var(--ff-body); font-style: italic;
font-size: .72rem; color: var(--ink-text-soft); text-align: center;
}
.paper-tradition {
font-family: var(--ff-title); font-size: .5rem;
letter-spacing: .14em; text-transform: uppercase;
color: var(--parchment); background: var(--gold-900);
padding: 3px 10px; border-radius: 20px;
}
/* Partículas burst */
.particle {
position: fixed; pointer-events: none; border-radius: 50%; z-index: 99;
animation: burst var(--dur,1s) ease-out forwards;
}
@keyframes burst {
0% { opacity: 1; transform: translate(0,0) scale(1); }
100% { opacity: 0; transform: translate(var(--tx),var(--ty)) scale(0); }
}
/* Entradas orquestadas */
@keyframes enterDown { from { opacity:0; transform: translateY(-14px); } to { opacity:1; transform: translateY(0); } }
@keyframes enterUp { from { opacity:0; transform: translateY(14px); } to { opacity:1; transform: translateY(0); } }
@keyframes enterScale{ from { opacity:0; transform: scale(.7); } to { opacity:1; transform: scale(1); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
/* Responsive: apilar en pantallas angostas */
@media (max-width: 560px) {
html, body { overflow-y: auto; }
.widget { flex-direction: column; height: auto; min-height: 100vh; padding: 22px 18px; }
.widget::after { display: none; }
.left { flex: 0 0 auto; padding-bottom: 18px; margin-bottom: 6px; border-bottom: 1px solid var(--border-g); }
.right { width: 100%; padding: 18px 4px 30px; }
}
/* Respeta la preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {
body::before, body::after, .dot, .widget::before,
.widget-title, .cookie-btn::before, .cookie-btn::after,
.cookie-btn:not(.cracking):not(.opened) .cookie-svg,
.cookie-btn.opened .cookie-svg, .empty-glyph {
animation: none !important;
}
}
</style>
</head>
<body>
<div class="dust" id="dust"></div>
<div class="widget">
<!-- LADO IZQUIERDO: galleta = botón -->
<div class="left">
<span class="widget-title">Sabiduría del Mundo</span>
<span class="title-rule"></span>
<button class="cookie-btn" id="stage" onclick="openFortune()" title="Haz clic para revelar una enseñanza" aria-label="Abrir galleta y revelar una enseñanza">
<svg class="cookie-svg" viewBox="0 0 160 160" fill="none" xmlns="http://www.w3.org/2000/svg">
<defs>
<radialGradient id="cG" cx="40%" cy="35%">
<stop offset="0%" stop-color="#f6dfa0"/>
<stop offset="55%" stop-color="#d9ab4c"/>
<stop offset="100%" stop-color="#7a5511"/>
</radialGradient>
<radialGradient id="sh" cx="35%" cy="30%">
<stop offset="0%" stop-color="#fff" stop-opacity=".35"/>
<stop offset="100%" stop-color="#fff" stop-opacity="0"/>
</radialGradient>
<filter id="sf" x="-20%" y="-20%" width="140%" height="140%">
<feGaussianBlur stdDeviation="2.5"/>
</filter>
</defs>
<!-- sombra -->
<ellipse cx="80" cy="148" rx="46" ry="7" fill="#000" opacity=".38" filter="url(#sf)"/>
<!-- mitad superior -->
<g class="half-top">
<path d="M28 80 C20 60 22 38 40 26 C54 16 70 14 80 14 C90 14 106 16 120 26 C138 38 140 60 132 80 Z" fill="url(#cG)" stroke="#6b4a12" stroke-width="1"/>
<path d="M28 80 C20 60 22 38 40 26 C54 16 70 14 80 14 C90 14 106 16 120 26 C138 38 140 60 132 80 Z" fill="url(#sh)"/>
<circle cx="58" cy="42" r="3.5" fill="#6b4a12" opacity=".6"/>
<circle cx="80" cy="34" r="2.5" fill="#6b4a12" opacity=".5"/>
<circle cx="102" cy="42" r="3" fill="#6b4a12" opacity=".6"/>
<circle cx="70" cy="58" r="2" fill="#6b4a12" opacity=".4"/>
<circle cx="92" cy="55" r="2.5" fill="#6b4a12" opacity=".45"/>
</g>
<!-- mitad inferior -->
<g class="half-bot">
<path d="M28 80 C20 100 22 122 40 134 C54 144 70 146 80 146 C90 146 106 144 120 134 C138 122 140 100 132 80 Z" fill="url(#cG)" stroke="#6b4a12" stroke-width="1"/>
<path d="M28 80 C20 100 22 122 40 134 C54 144 70 146 80 146 C90 146 106 144 120 134 C138 122 140 100 132 80 Z" fill="url(#sh)"/>
<circle cx="58" cy="118" r="3.5" fill="#6b4a12" opacity=".6"/>
<circle cx="80" cy="126" r="2.5" fill="#6b4a12" opacity=".5"/>
<circle cx="102" cy="118" r="3" fill="#6b4a12" opacity=".6"/>
<circle cx="70" cy="104" r="2" fill="#6b4a12" opacity=".4"/>
<circle cx="92" cy="106" r="2.5" fill="#6b4a12" opacity=".45"/>
</g>
<!-- línea de quiebre -->
<line class="crack-line" x1="28" y1="80" x2="132" y2="80"
stroke="#4a3208" stroke-width="2" stroke-dasharray="4 3" opacity=".8"/>
</svg>
</button>
<span class="hint" id="hint">Toca para<br>revelar</span>
<p class="counter" id="counter"></p>
</div>
<!-- LADO DERECHO: mensaje -->
<div class="right" id="right">
<div class="empty-msg" id="emptyMsg">
<svg class="empty-glyph" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="20" cy="20" r="15" stroke="#e8c870" stroke-width="1"/>
<circle cx="20" cy="20" r="2" fill="#e8c870"/>
<line x1="20" y1="1" x2="20" y2="7" stroke="#e8c870" stroke-width="1"/>
<line x1="20" y1="33" x2="20" y2="39" stroke="#e8c870" stroke-width="1"/>
<line x1="1" y1="20" x2="7" y2="20" stroke="#e8c870" stroke-width="1"/>
<line x1="33" y1="20" x2="39" y2="20" stroke="#e8c870" stroke-width="1"/>
</svg>
<p class="empty-text">Cada tradición guarda una enseñanza.<br>Toca la galleta para descubrir la tuya.</p>
</div>
<div class="paper" id="paper">
<p class="paper-symbol" id="paperSymbol"></p>
<p class="paper-text" id="paperText"></p>
<div class="paper-meta">
<span class="paper-source" id="paperSource"></span>
<span class="paper-tradition" id="paperTradition"></span>
</div>
</div>
</div>
</div>
<script>
const fortunes = [
{ text:"Tres cosas no pueden ocultarse por mucho tiempo: el sol, la luna y la verdad.", source:"Buda Gautama", tradition:"Budismo", symbol:"☸" },
{ text:"No hagas a los demás lo que no quieres que te hagan a ti.", source:"Hillel el Anciano", tradition:"Judaísmo", symbol:"✡" },
{ text:"El que se conoce a sí mismo conoce a su Señor.", source:"Hadith — Profeta Muhammad", tradition:"Islam", symbol:"☽" },
{ text:"Actúa de tal manera que tu acción pueda convertirse en ley universal.", source:"Immanuel Kant", tradition:"Filosofía Occidental", symbol:"⚖" },
{ text:"El Tao que puede nombrarse no es el Tao eterno.", source:"Lao Tse — Tao Te Ching", tradition:"Taoísmo", symbol:"☯" },
{ text:"El Atman es más pequeño que un grano de arroz, y sin embargo más grande que todos los cielos.", source:"Chandogya Upanishad", tradition:"Hinduismo", symbol:"🕉" },
{ text:"No es la muerte lo que un hombre debería temer, sino el nunca haber empezado a vivir.", source:"Marco Aurelio — Meditaciones", tradition:"Estoicismo", symbol:"🏛" },
{ text:"Cuando amas, no digas «Dios está en mi corazón», sino «yo estoy en el corazón de Dios».", source:"Khalil Gibran — El Profeta", tradition:"Misticismo", symbol:"✦" },
{ text:"Aprende como si fueras a vivir para siempre; vive como si fueras a morir mañana.", source:"Mahatma Gandhi", tradition:"Filosofía Jainista", symbol:"🪷" },
{ text:"El noble busca las causas en sí mismo; el hombre inferior las busca en los demás.", source:"Confucio — Analectas", tradition:"Confucianismo", symbol:"⛩" },
{ text:"No existe ningún camino hacia la paz. La paz es el camino.", source:"A. J. Muste", tradition:"Pacifismo", symbol:"☮" },
{ text:"La llama del amor arde más allá del razonamiento. Déjate quemar.", source:"Rumi — Masnavi", tradition:"Sufismo", symbol:"☽" },
{ text:"El universo es transformación; la vida es opinión.", source:"Marco Aurelio — Meditaciones IV", tradition:"Estoicismo", symbol:"🏛" },
{ text:"El corazón tiene razones que la razón no comprende.", source:"Blaise Pascal — Pensamientos", tradition:"Filosofía Cristiana", symbol:"✝" },
{ text:"No soy ateniense ni griego, sino ciudadano del mundo.", source:"Sócrates", tradition:"Filosofía Griega", symbol:"🏛" },
{ text:"Wu wei: al no hacer nada en contra de la naturaleza, nada queda sin hacerse.", source:"Lao Tse — Tao Te Ching", tradition:"Taoísmo", symbol:"☯" },
{ text:"La tierra no nos pertenece; nosotros pertenecemos a la tierra.", source:"Jefe Seattle", tradition:"Espiritualidad Indígena", symbol:"🌿" },
{ text:"Conocerse a uno mismo es el principio de toda sabiduría.", source:"Aristóteles", tradition:"Filosofía Griega", symbol:"🏛" },
{ text:"El silencio es el lenguaje de Dios; todo lo demás es una traducción pobre.", source:"Rumi", tradition:"Sufismo", symbol:"☽" },
{ text:"Abandona el apego a los frutos de tus acciones y actúa solo porque así debe ser.", source:"Bhagavad Gita II.47", tradition:"Hinduismo", symbol:"🕉" },
{ text:"No temas la impermanencia de todas las cosas. En el fluir reside la belleza.", source:"Dogen Zenji", tradition:"Budismo Zen", symbol:"☸" },
{ text:"Shikata ga nai: lo que no puede evitarse debe ser aceptado con serenidad.", source:"Proverbio Japonés", tradition:"Zen / Shintoísmo", symbol:"⛩" },
];
let count = 0, used = [], busy = false;
function nextIdx() {
if (used.length === fortunes.length) used = [];
let i; do { i = Math.floor(Math.random() * fortunes.length); } while (used.includes(i));
used.push(i); return i;
}
function burst(x, y) {
const colors = ['#e8c870','#f6dfa0','#c9a84c','#fdf8ec'];
for (let i = 0; i < 22; i++) {
const p = document.createElement('div');
p.className = 'particle';
const sz = 2.5 + Math.random() * 4;
const ang = Math.random() * Math.PI * 2;
const dist = 40 + Math.random() * 90;
p.style.cssText = `width:${sz}px;height:${sz}px;background:${colors[i%colors.length]};left:${x}px;top:${y}px;--tx:${Math.cos(ang)*dist}px;--ty:${Math.sin(ang)*dist}px;--dur:${.5+Math.random()*.7}s;`;
document.body.appendChild(p);
p.addEventListener('animationend', () => p.remove());
}
}
function openFortune() {
if (busy) return;
busy = true;
const stage = document.getElementById('stage');
const paper = document.getElementById('paper');
const empty = document.getElementById('emptyMsg');
const hint = document.getElementById('hint');
const counter = document.getElementById('counter');
paper.classList.remove('visible');
paper.style.display = 'none';
stage.classList.remove('opened');
stage.classList.add('cracking');
setTimeout(() => {
stage.classList.remove('cracking');
stage.classList.add('opened');
hint.style.opacity = '0';
const rect = stage.getBoundingClientRect();
burst(rect.left + rect.width / 2, rect.top + rect.height / 2);
count++;
const f = fortunes[nextIdx()];
document.getElementById('paperSymbol').textContent = f.symbol;
document.getElementById('paperText').textContent = f.text;
document.getElementById('paperSource').textContent = '— ' + f.source;
document.getElementById('paperTradition').textContent = f.tradition;
counter.textContent = `#${count} · ${f.tradition}`;
empty.style.display = 'none';
setTimeout(() => {
paper.style.display = 'block';
requestAnimationFrame(() => requestAnimationFrame(() => paper.classList.add('visible')));
busy = false;
}, 260);
}, 560);
}
// Polvo dorado
const dustEl = document.getElementById('dust');
for (let i = 0; i < 35; i++) {
const d = document.createElement('div');
d.className = 'dot';
const sz = .6 + Math.random() * 2;
d.style.cssText = `width:${sz}px;height:${sz}px;top:${Math.random()*100}%;left:${Math.random()*100}%;--d:${3+Math.random()*5}s;--del:${-Math.random()*5}s;`;
dustEl.appendChild(d);
}
</script>
</body>
</html>