-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtesoro_7basico.html
More file actions
761 lines (685 loc) · 25.4 KB
/
Copy pathtesoro_7basico.html
File metadata and controls
761 lines (685 loc) · 25.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Búsqueda del Tesoro — VII° Básico</title>
<style>
/* ══ VARIABLES ═══════════════════════════════════════ */
:root{
--wood-dark: #2c1a0e;
--wood-mid: #4a2c14;
--wood-light: #7a4a22;
--parchment: #f5e6c8;
--parch-dark: #e8d4a4;
--gold: #c9a84c;
--gold-light: #f0d47a;
--gold-dark: #8b6914;
--ocean-deep: #0a2a4a;
--ocean-mid: #0e3d6e;
--ocean-light: #1a5a9e;
--red-pirate: #8b1a1a;
--text-dark: #1a0e05;
--text-mid: #4a3020;
--shadow: rgba(0,0,0,.5);
}
*{box-sizing:border-box;margin:0;padding:0;}
html,body{height:100%;font-family:Georgia,'Times New Roman',serif;}
body{
min-height:100vh;
background:
radial-gradient(ellipse at 50% 0%, #0e3d6e 0%, #0a2a4a 50%, #061828 100%);
background-attachment:fixed;
display:flex;flex-direction:column;
position:relative;overflow-x:hidden;
}
/* ══ SEA WAVES ══════════════════════════════════════ */
body::before{
content:'';position:fixed;bottom:0;left:0;right:0;height:120px;
background:linear-gradient(0deg,rgba(10,42,74,.8),transparent);
z-index:0;pointer-events:none;
}
.waves{
position:fixed;bottom:0;left:0;right:0;z-index:0;pointer-events:none;
height:80px;overflow:hidden;
}
.wave{
position:absolute;bottom:0;left:-200%;width:400%;
height:80px;
background:radial-gradient(ellipse at 50% 100%, rgba(14,61,110,.6) 0%, transparent 60%);
border-radius:40% 40% 0 0;
animation:waveMove 6s ease-in-out infinite;
}
.wave:nth-child(2){animation-delay:-2s;opacity:.5;animation-duration:8s;}
.wave:nth-child(3){animation-delay:-4s;opacity:.3;animation-duration:10s;}
@keyframes waveMove{
0%,100%{transform:translateX(0) translateY(0);}
50%{transform:translateX(5%) translateY(-15px);}
}
/* ══ STARS ══════════════════════════════════════════ */
.stars{
position:fixed;top:0;left:0;right:0;height:60%;
pointer-events:none;z-index:0;
background-image:
radial-gradient(1px 1px at 10% 15%,rgba(255,255,255,.8),transparent),
radial-gradient(1px 1px at 30% 8%, rgba(255,255,255,.6),transparent),
radial-gradient(1px 1px at 55% 20%,rgba(255,255,255,.9),transparent),
radial-gradient(1px 1px at 75% 5%, rgba(255,255,255,.7),transparent),
radial-gradient(1px 1px at 88% 25%,rgba(255,255,255,.5),transparent),
radial-gradient(1px 1px at 22% 35%,rgba(255,255,255,.6),transparent),
radial-gradient(1px 1px at 65% 12%,rgba(255,255,255,.8),transparent),
radial-gradient(1px 1px at 42% 40%,rgba(255,255,255,.4),transparent),
radial-gradient(1px 1px at 90% 38%,rgba(255,255,255,.7),transparent),
radial-gradient(1px 1px at 5% 42%,rgba(255,255,255,.5),transparent);
}
/* ══ MAIN CONTAINER ═════════════════════════════════ */
.container{
position:relative;z-index:10;
width:95%;max-width:700px;
margin:2rem auto;
flex:1;
display:flex;flex-direction:column;align-items:center;
}
/* ══ PARCHMENT PANEL ════════════════════════════════ */
.panel{
width:100%;
background:
radial-gradient(ellipse at 20% 10%,rgba(255,255,255,.2),transparent 50%),
linear-gradient(160deg,#f5e6c8 0%,#efd8a8 40%,#e8cfa0 70%,#f0dcb4 100%);
border:4px solid var(--wood-mid);
border-radius:8px;
box-shadow:
inset 0 0 30px rgba(122,74,34,.2),
0 0 0 2px var(--gold-dark),
0 10px 40px rgba(0,0,0,.7),
0 0 80px rgba(201,168,76,.1);
padding:2.5rem 2rem;
position:relative;
display:none;
animation:unfurl .5s ease-out;
}
.panel.active{display:block;}
@keyframes unfurl{
from{opacity:0;transform:scale(.96) translateY(-10px);}
to{opacity:1;transform:scale(1) translateY(0);}
}
/* Nail decorations */
.panel::before,.panel::after{
content:'⚓';
position:absolute;
color:var(--gold-dark);font-size:1.4rem;opacity:.5;
}
.panel::before{top:10px;left:15px;}
.panel::after{top:10px;right:15px;}
/* ══ HEADER ═════════════════════════════════════════ */
.pirate-title{
text-align:center;
font-family:'Palatino Linotype',Palatino,Georgia,serif;
letter-spacing:4px;
margin-bottom:1.5rem;
padding-bottom:1rem;
border-bottom:2px solid rgba(122,74,34,.3);
position:relative;
}
.skull-divider{text-align:center;font-size:1.8rem;margin:-.5rem 0 .5rem;opacity:.7;}
.pirate-title h1{
font-size:clamp(1.3rem,4vw,2rem);
color:var(--wood-dark);
text-shadow:2px 2px 0 rgba(255,255,255,.4);
line-height:1.2;
margin-bottom:.3rem;
}
.pirate-title .subtitle{
font-size:.82rem;color:var(--text-mid);
letter-spacing:2px;font-style:italic;
}
.ship-emoji{font-size:2.5rem;display:block;margin-bottom:.5rem;
animation:sway 3s ease-in-out infinite;}
@keyframes sway{
0%,100%{transform:rotate(-4deg);}50%{transform:rotate(4deg);}
}
/* ══ FORM ELEMENTS ══════════════════════════════════ */
.section-label{
font-size:.75rem;letter-spacing:2px;color:var(--wood-dark);
font-weight:bold;text-transform:uppercase;
margin:1.2rem 0 .6rem;
display:flex;align-items:center;gap:8px;
}
.section-label::before,.section-label::after{
content:'';flex:1;height:1px;background:rgba(122,74,34,.3);
}
.input-group{margin-bottom:.8rem;position:relative;}
.input-group label{
display:block;font-size:.78rem;color:var(--text-mid);
margin-bottom:4px;font-style:italic;
}
.pirate-input{
width:100%;padding:.65rem .9rem;
background:rgba(255,255,255,.5);
border:2px solid rgba(122,74,34,.4);
border-radius:4px;
font-family:Georgia,serif;font-size:.95rem;
color:var(--text-dark);
transition:border-color .2s,box-shadow .2s,background .2s;
outline:none;
}
.pirate-input:focus{
border-color:var(--gold-dark);
background:rgba(255,255,255,.7);
box-shadow:0 0 0 3px rgba(201,168,76,.2);
}
.pirate-input::placeholder{color:rgba(74,48,32,.4);font-style:italic;}
.add-btn{
background:none;border:1.5px dashed rgba(122,74,34,.4);
color:var(--text-mid);cursor:pointer;
padding:.5rem .9rem;border-radius:4px;
font-size:.82rem;font-family:Georgia,serif;
width:100%;margin-top:.3rem;
transition:background .2s,border-color .2s;
}
.add-btn:hover{background:rgba(122,74,34,.1);border-color:var(--wood-mid);}
.add-btn:disabled{opacity:.35;cursor:default;}
/* ══ BIG BUTTONS ════════════════════════════════════ */
.btn-pirate{
display:block;width:100%;margin-top:1.6rem;
padding:.9rem 1.5rem;
background:linear-gradient(135deg,var(--wood-dark) 0%,var(--wood-mid) 50%,var(--wood-dark) 100%);
color:var(--gold-light);
border:2px solid var(--gold-dark);
border-radius:6px;
font-family:'Palatino Linotype',Palatino,Georgia,serif;
font-size:1rem;letter-spacing:2px;
cursor:pointer;text-align:center;
box-shadow:0 4px 15px rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.1);
transition:transform .15s,box-shadow .15s,background .15s;
}
.btn-pirate:hover{
transform:translateY(-2px);
box-shadow:0 8px 25px rgba(0,0,0,.5),0 0 20px rgba(201,168,76,.3);
}
.btn-pirate:active{transform:translateY(0);}
/* ══ CODE PANEL ═════════════════════════════════════ */
.treasure-chest{
text-align:center;
font-size:4rem;margin:1rem 0;
animation:chestBob .8s ease-in-out infinite alternate;
}
@keyframes chestBob{
from{transform:translateY(0) rotate(-2deg);}
to{transform:translateY(-8px) rotate(2deg);}
}
.code-box{
background:rgba(0,0,0,.1);
border:3px solid var(--gold-dark);
border-radius:6px;
padding:1.2rem;
margin:1.2rem 0;
text-align:center;
}
.code-input{
width:100%;max-width:280px;
padding:.9rem 1rem;
background:rgba(255,255,255,.6);
border:2px solid rgba(122,74,34,.5);
border-radius:6px;
font-family:'Palatino Linotype',Georgia,serif;
font-size:1.4rem;letter-spacing:6px;
text-align:center;text-transform:uppercase;
color:var(--text-dark);
outline:none;
transition:border-color .2s,box-shadow .2s;
}
.code-input:focus{
border-color:var(--gold-dark);
box-shadow:0 0 0 3px rgba(201,168,76,.3);
}
.code-hint{
font-size:.78rem;color:var(--text-mid);
font-style:italic;margin-top:.5rem;
opacity:.7;
}
.error-msg{
color:#8b1a1a;font-size:.85rem;text-align:center;
font-style:italic;margin-top:.5rem;
padding:.5rem;background:rgba(139,26,26,.1);
border-radius:4px;border:1px solid rgba(139,26,26,.2);
display:none;
}
.error-msg.show{display:block;animation:shake .3s ease;}
@keyframes shake{
0%,100%{transform:translateX(0);}
25%{transform:translateX(-6px);}
75%{transform:translateX(6px);}
}
.attempt-counter{
font-size:.72rem;color:var(--text-mid);text-align:center;
opacity:.6;margin-top:.4rem;
}
/* ══ CELEBRATION PANEL ══════════════════════════════ */
.celebration{
text-align:center;padding:1rem 0;
}
.fireworks-area{
height:120px;position:relative;overflow:hidden;
margin-bottom:1rem;
}
.firework{
position:absolute;
font-size:2rem;
animation:explode 1.5s ease-out infinite;
}
.firework:nth-child(1){left:10%;animation-delay:0s;}
.firework:nth-child(2){left:30%;animation-delay:.3s;}
.firework:nth-child(3){left:55%;animation-delay:.6s;}
.firework:nth-child(4){left:75%;animation-delay:.9s;}
.firework:nth-child(5){left:90%;animation-delay:.2s;}
@keyframes explode{
0%{transform:translateY(120px) scale(.5);opacity:1;}
60%{opacity:1;}
100%{transform:translateY(-20px) scale(1.5);opacity:0;}
}
.winner-badge{
display:inline-block;
background:linear-gradient(135deg,#c9a84c,#f0d47a,#c9a84c);
color:var(--wood-dark);
border:3px solid var(--wood-dark);
border-radius:50%;
width:120px;height:120px;
line-height:1;
display:flex;flex-direction:column;align-items:center;justify-content:center;
margin:0 auto 1.2rem;
font-family:'Palatino Linotype',Palatino,Georgia,serif;
box-shadow:0 0 30px rgba(201,168,76,.6),0 0 60px rgba(201,168,76,.3);
animation:glow 2s ease-in-out infinite;
}
@keyframes glow{
0%,100%{box-shadow:0 0 30px rgba(201,168,76,.6),0 0 60px rgba(201,168,76,.3);}
50%{box-shadow:0 0 50px rgba(201,168,76,.9),0 0 100px rgba(201,168,76,.5);}
}
.winner-badge .nota{font-size:2.8rem;font-weight:bold;color:var(--wood-dark);}
.winner-badge .nota-label{font-size:.65rem;letter-spacing:1.5px;color:var(--text-mid);}
.win-title{
font-family:'Palatino Linotype',Palatino,Georgia,serif;
font-size:clamp(1.5rem,5vw,2.2rem);
color:var(--wood-dark);
letter-spacing:3px;
margin-bottom:.4rem;
text-shadow:2px 2px 0 rgba(255,255,255,.5);
}
.win-subtitle{
font-size:.9rem;color:var(--text-mid);
margin-bottom:1.5rem;letter-spacing:1px;
font-style:italic;
}
.players-won{
background:rgba(122,74,34,.12);
border:2px solid rgba(122,74,34,.25);
border-radius:6px;
padding:1rem 1.5rem;
margin:1.2rem 0;
}
.players-won h3{
font-size:.75rem;letter-spacing:2px;
color:var(--wood-dark);margin-bottom:.8rem;
text-transform:uppercase;
}
.player-name{
display:flex;align-items:center;gap:8px;
padding:.4rem 0;
border-bottom:1px solid rgba(122,74,34,.15);
font-size:.95rem;color:var(--text-dark);
}
.player-name:last-child{border-bottom:none;}
.confetti{
position:fixed;top:0;left:0;right:0;bottom:0;
pointer-events:none;z-index:999;overflow:hidden;
}
.confetti-piece{
position:absolute;
width:10px;height:14px;
border-radius:2px;
animation:confettiFall linear infinite;
}
@keyframes confettiFall{
0%{transform:translateY(-20px) rotate(0deg);opacity:1;}
100%{transform:translateY(100vh) rotate(720deg);opacity:.2;}
}
.scroll-banner{
background:linear-gradient(90deg,transparent,rgba(201,168,76,.2),transparent);
border-top:1px solid rgba(122,74,34,.2);
border-bottom:1px solid rgba(122,74,34,.2);
padding:.6rem 0;
margin:1rem -2rem;
text-align:center;
font-size:.78rem;
color:var(--text-mid);
letter-spacing:1.5px;
font-style:italic;
}
/* ══ PARTICIPANTS SUMMARY ════════════════════════════ */
.participants-chip{
display:inline-flex;align-items:center;gap:5px;
background:rgba(122,74,34,.12);
border:1px solid rgba(122,74,34,.25);
border-radius:20px;
padding:3px 12px;
font-size:.8rem;color:var(--text-mid);
margin:2px;
}
/* ══ PROGRESS DOTS ══════════════════════════════════ */
.progress{
display:flex;align-items:center;justify-content:center;gap:12px;
margin-bottom:1.5rem;
}
.dot{
width:10px;height:10px;border-radius:50%;
background:rgba(122,74,34,.25);
transition:background .3s,transform .3s;
}
.dot.done{background:var(--gold-dark);}
.dot.active{background:var(--gold);transform:scale(1.4);
box-shadow:0 0 6px rgba(201,168,76,.6);}
.prog-line{width:40px;height:2px;background:rgba(122,74,34,.2);}
.prog-line.done{background:var(--gold-dark);}
/* ══ BACK LINK ══════════════════════════════════════ */
.back-link{
text-align:center;margin-top:1.2rem;
}
.back-link button{
background:none;border:1.5px solid rgba(201,168,76,.3);
color:var(--text-mid);padding:.5rem 1.2rem;
border-radius:4px;cursor:pointer;font-size:.8rem;
font-family:Georgia,serif;letter-spacing:1px;
transition:background .15s,border-color .15s;
}
.back-link button:hover{background:rgba(122,74,34,.1);border-color:rgba(122,74,34,.4);}
/* ══ MOBILE ═════════════════════════════════════════ */
@media(max-width:480px){
.container{margin:1rem auto;}
.panel{padding:1.8rem 1.2rem;}
.code-input{font-size:1.1rem;letter-spacing:4px;}
.panel::before,.panel::after{font-size:1rem;}
}
</style>
</head>
<body>
<!-- Background decorations -->
<div class="stars"></div>
<div class="waves">
<div class="wave"></div>
<div class="wave"></div>
<div class="wave"></div>
</div>
<!-- Confetti (hidden until celebration) -->
<div class="confetti" id="confetti"></div>
<div class="container">
<!-- ══ PANEL 1: PARTICIPANTS ═════════════════════ -->
<div class="panel active" id="panel-participants">
<div class="pirate-title">
<span class="ship-emoji">🏴☠️</span>
<h1>BÚSQUEDA DEL TESORO</h1>
<div class="skull-divider">💀 ⚓ 💀</div>
<p class="subtitle">VII° Básico · Expedición Pirata</p>
</div>
<div class="progress">
<div class="dot active" id="d1"></div>
<div class="prog-line" id="pl1"></div>
<div class="dot" id="d2"></div>
<div class="prog-line" id="pl2"></div>
<div class="dot" id="d3"></div>
</div>
<div class="section-label">⚔️ Tripulación del Barco ⚔️</div>
<div id="fields-container">
<div class="input-group">
<label>⚓ Tripulante 1</label>
<input type="text" class="pirate-input player-field"
placeholder="Nombre del primer tripulante…" maxlength="40">
</div>
<div class="input-group">
<label>⚓ Tripulante 2</label>
<input type="text" class="pirate-input player-field"
placeholder="Nombre del segundo tripulante…" maxlength="40">
</div>
</div>
<button class="add-btn" id="add-btn" onclick="addField()">
+ Agregar otro tripulante (máx. 5)
</button>
<button class="btn-pirate" onclick="goToCode()">
⚓ ¡Zarpar en busca del tesoro!
</button>
<p style="text-align:center;font-size:.75rem;color:var(--text-mid);
font-style:italic;margin-top:1rem;opacity:.6;">
Ingresa al menos un nombre para continuar
</p>
</div>
<!-- ══ PANEL 2: CODE ENTRY ════════════════════════ -->
<div class="panel" id="panel-code">
<div class="pirate-title">
<h1>EL COFRE DEL TESORO</h1>
<div class="skull-divider">🗝️ ✦ 🗝️</div>
<p class="subtitle">Descifra el código secreto del capitán</p>
</div>
<div class="progress">
<div class="dot done" id="d1b"></div>
<div class="prog-line done" id="pl1b"></div>
<div class="dot active" id="d2b"></div>
<div class="prog-line" id="pl2b"></div>
<div class="dot" id="d3b"></div>
</div>
<div style="text-align:center;margin-bottom:.5rem;font-size:.82rem;
color:var(--text-mid);font-style:italic;">
Tripulación: <span id="crew-display"></span>
</div>
<div class="treasure-chest">🎁</div>
<div class="code-box">
<p style="font-size:.85rem;color:var(--text-mid);margin-bottom:.9rem;
font-style:italic;line-height:1.5;">
El mapa antiguo revela que solo quienes conocen<br>
<strong>el código secreto</strong> pueden abrir el cofre…
</p>
<input type="text" class="code-input" id="code-input"
placeholder="······"
maxlength="20"
onkeydown="if(event.key==='Enter')checkCode()"
autocomplete="off"
autocorrect="off"
autocapitalize="characters"
spellcheck="false">
<p class="code-hint">Escribe el código y presiona el botón</p>
</div>
<div class="error-msg" id="error-msg">
☠️ ¡Código incorrecto! El cofre permanece sellado… intenta de nuevo.
</div>
<p class="attempt-counter" id="attempt-counter"></p>
<button class="btn-pirate" onclick="checkCode()">
🗝️ ¡Abrir el cofre del tesoro!
</button>
<div class="back-link">
<button onclick="goBack()">← Cambiar tripulación</button>
</div>
</div>
<!-- ══ PANEL 3: CELEBRATION ═══════════════════════ -->
<div class="panel" id="panel-win">
<div class="celebration">
<div class="fireworks-area">
<div class="firework">🎆</div>
<div class="firework">✨</div>
<div class="firework">🎇</div>
<div class="firework">🎉</div>
<div class="firework">⭐</div>
</div>
<div class="winner-badge">
<span class="nota">7,0</span>
<span class="nota-label">NOTA</span>
</div>
<h1 class="win-title">¡¡GANADORES!!</h1>
<p class="win-subtitle">¡Han descifrado el código secreto del capitán!</p>
<div class="scroll-banner">
⚓ ¡El tesoro es suyo, valientes piratas! ⚓
</div>
<div class="players-won">
<h3>⚔️ Tripulación Ganadora ⚔️</h3>
<div id="winners-list"></div>
</div>
<p style="font-size:.85rem;color:var(--text-mid);font-style:italic;
line-height:1.6;margin-top:1rem;
background:rgba(122,74,34,.08);padding:.8rem 1rem;
border-radius:6px;border:1px solid rgba(122,74,34,.15);">
🏆 Por haber completado exitosamente la <strong>Búsqueda del Tesoro</strong>,
esta tripulación obtiene una
<strong style="color:var(--wood-dark);font-size:1.05rem;">Nota 7,0</strong>
en la asignatura.
</p>
<div class="pirate-title" style="margin-top:1.5rem;padding-top:1rem;border-top:2px solid rgba(122,74,34,.2);">
<div class="skull-divider" style="font-size:1.4rem;">🏴☠️ ⚓ 🏴☠️</div>
<p class="subtitle">VII° Básico · ¡Misión Cumplida!</p>
</div>
<button class="btn-pirate" onclick="restart()"
style="margin-top:1rem;background:linear-gradient(135deg,var(--ocean-deep),var(--ocean-mid));">
🔄 Nueva expedición
</button>
</div>
</div>
</div><!-- /container -->
<script>
/* ══ CONFIG — cambia el código aquí ══════════════════
El profesor puede modificar SECRET_CODE para establecer
la palabra clave que desbloquea el tesoro.
════════════════════════════════════════════════════ */
const SECRET_CODE = 'TESORO7';
/* ══ STATE ══════════════════════════════════════════ */
let attempts = 0;
let players = [];
/* ══ FIELD MANAGEMENT ═══════════════════════════════ */
function addField(){
const container = document.getElementById('fields-container');
const count = container.querySelectorAll('.player-field').length;
if(count >= 5) return;
const div = document.createElement('div');
div.className = 'input-group';
const labels= ['tercero','cuarto','quinto'];
div.innerHTML = `
<label>⚓ Tripulante ${count + 1}</label>
<input type="text" class="pirate-input player-field"
placeholder="Nombre del ${labels[count-2] || (count+1)+'°'} tripulante…"
maxlength="40">`;
container.appendChild(div);
if(count + 1 >= 5)
document.getElementById('add-btn').disabled = true;
}
/* ══ NAVIGATION ═════════════════════════════════════ */
function showPanel(id){
document.querySelectorAll('.panel').forEach(p => p.classList.remove('active'));
document.getElementById(id).classList.add('active');
window.scrollTo({top:0, behavior:'smooth'});
}
function goToCode(){
const fields = document.querySelectorAll('.player-field');
players = [];
fields.forEach(f => {
const v = f.value.trim();
if(v) players.push(v);
});
if(players.length === 0){
const first = document.querySelector('.player-field');
first.focus();
first.style.borderColor = 'var(--red-pirate)';
setTimeout(()=>first.style.borderColor='',1500);
return;
}
// Show crew on code panel
document.getElementById('crew-display').innerHTML =
players.map(p=>`<span class="participants-chip">⚓ ${esc(p)}</span>`).join('');
attempts = 0;
document.getElementById('attempt-counter').textContent = '';
document.getElementById('error-msg').classList.remove('show');
document.getElementById('code-input').value = '';
showPanel('panel-code');
setTimeout(()=>document.getElementById('code-input').focus(), 300);
}
function goBack(){
showPanel('panel-participants');
}
/* ══ CODE CHECK ═════════════════════════════════════ */
function checkCode(){
const input = document.getElementById('code-input');
const val = input.value.trim().toUpperCase();
const err = document.getElementById('error-msg');
const ctr = document.getElementById('attempt-counter');
if(!val){
input.focus();
input.style.animation='none';
void input.offsetWidth;
input.style.animation='shake .3s ease';
return;
}
if(val === SECRET_CODE.toUpperCase()){
launchWin();
} else {
attempts++;
err.classList.remove('show');
void err.offsetWidth;
err.classList.add('show');
if(attempts > 1)
ctr.textContent = `Intentos: ${attempts}`;
input.value = '';
input.focus();
}
}
/* ══ WIN SEQUENCE ═══════════════════════════════════ */
function launchWin(){
// Build winners list
const list = document.getElementById('winners-list');
const medals = ['🥇','🥈','🥉','🏅','🏅'];
list.innerHTML = players.map((p,i)=>`
<div class="player-name">
<span>${medals[i]||'⭐'}</span>
<strong>${esc(p)}</strong>
</div>`).join('');
showPanel('panel-win');
launchConfetti();
}
/* ══ CONFETTI ════════════════════════════════════════ */
function launchConfetti(){
const c = document.getElementById('confetti');
c.innerHTML = '';
const colors = ['#c9a84c','#f0d47a','#0e3d6e','#8b1a1a','#fff','#4a7c59','#e8c870'];
for(let i = 0; i < 80; i++){
const piece = document.createElement('div');
piece.className = 'confetti-piece';
piece.style.cssText = `
left:${Math.random()*100}%;
background:${colors[Math.floor(Math.random()*colors.length)]};
width:${6+Math.random()*8}px;
height:${10+Math.random()*10}px;
border-radius:${Math.random()>0.5?'50%':'2px'};
animation-duration:${2+Math.random()*3}s;
animation-delay:${Math.random()*2}s;
`;
c.appendChild(piece);
}
// Stop confetti after 8s
setTimeout(()=>{ c.innerHTML=''; }, 8000);
}
/* ══ RESTART ════════════════════════════════════════ */
function restart(){
document.getElementById('confetti').innerHTML = '';
document.querySelectorAll('.player-field').forEach((f,i)=>{
if(i < 2) f.value = '';
else f.closest('.input-group').remove();
});
document.getElementById('add-btn').disabled = false;
document.getElementById('code-input').value = '';
attempts = 0;
players = [];
showPanel('panel-participants');
}
/* ══ UTIL ════════════════════════════════════════════ */
function esc(s){
return String(s)
.replace(/&/g,'&').replace(/</g,'<')
.replace(/>/g,'>').replace(/"/g,'"');
}
</script>
</body>
</html>