-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
351 lines (313 loc) Β· 13.8 KB
/
Copy pathindex.html
File metadata and controls
351 lines (313 loc) Β· 13.8 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>π Treasure Hunt!</title>
<link href="https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@800;900&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
width: 100%; height: 100%;
overflow: hidden;
}
body {
font-family: 'Nunito', sans-serif;
background: linear-gradient(160deg, #87CEEB 0%, #b8edff 45%, #d4f5c4 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0;
height: 100vh;
position: relative;
}
/* ββ Clouds ββ */
.cloud { position: fixed; background: #fff; border-radius: 50px; opacity: 0.8; pointer-events: none; z-index: 0; }
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.c1 { width: 100px; height: 34px; top: 7%; animation: fc 20s linear infinite; }
.c1::before { width: 50px; height: 50px; top: -26px; left: 12px; }
.c1::after { width: 34px; height: 34px; top: -16px; left: 46px; }
.c2 { width: 75px; height: 26px; top: 18%; animation: fc 27s linear infinite 9s; }
.c2::before { width: 38px; height: 38px; top: -20px; left: 8px; }
.c2::after { width: 26px; height: 26px; top: -12px; left: 34px; }
.c3 { width: 120px; height: 40px; top: 4%; animation: fc 33s linear infinite 4s; }
.c3::before { width: 60px; height: 60px; top: -32px; left: 16px; }
.c3::after { width: 42px; height: 42px; top: -20px; left: 58px; }
@keyframes fc { from { left: -160px; } to { left: 110vw; } }
/* ββ Stars ββ */
.sbg { position: fixed; pointer-events: none; z-index: 0; font-size: 18px; animation: twk 3s ease-in-out infinite; }
@keyframes twk { 0%,100%{opacity:.3;transform:scale(1)} 50%{opacity:1;transform:scale(1.3)} }
/* ββ Layout ββ */
.wrap {
position: relative; z-index: 1;
display: flex; flex-direction: column;
align-items: center;
width: 100%;
/* tight vertical gap β all units are vh/vmin so it scales */
gap: clamp(4px, 1vh, 10px);
padding: 0 12px;
}
/* ββ Title ββ */
.banner {
background: linear-gradient(135deg, #FF6FD8, #FF9F43, #FFD93D);
border-radius: 22px;
padding: clamp(6px,1.2vh,12px) clamp(20px,4vw,44px);
box-shadow: 0 6px 0 rgba(0,0,0,0.15);
animation: bb 2.2s ease-in-out infinite;
}
@keyframes bb { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
.banner h1 {
font-family: 'Fredoka One', cursive;
font-size: clamp(22px, 4.5vh, 46px);
color: #fff;
text-shadow: 0 2px 0 rgba(0,0,0,0.18);
white-space: nowrap;
line-height: 1;
}
/* ββ Subtitle ββ */
.sub {
font-size: clamp(12px, 1.8vh, 18px);
font-weight: 800; color: #555;
background: #fff;
padding: clamp(4px,.7vh,8px) clamp(14px,2.5vw,24px);
border-radius: 50px;
box-shadow: 0 3px 10px rgba(0,0,0,0.1);
border: 2px dashed #FFD93D;
line-height: 1;
}
/* ββ Buddy ββ */
.buddy {
font-size: clamp(34px, 7vh, 62px);
line-height: 1;
filter: drop-shadow(0 3px 6px rgba(0,0,0,0.15));
animation: bw 1.8s ease-in-out infinite;
}
@keyframes bw { 0%,100%{transform:rotate(-8deg) scale(1)} 50%{transform:rotate(8deg) scale(1.1)} }
.buddy.celebrating { animation: cel .5s ease-in-out infinite alternate; }
@keyframes cel { from{transform:rotate(-15deg) scale(1.1)} to{transform:rotate(15deg) scale(1.2)} }
/* ββ Attempts bar ββ */
.atbar {
display: flex; align-items: center; gap: 10px;
background: #fff; border-radius: 50px;
padding: clamp(5px,.9vh,10px) clamp(16px,3vw,28px);
font-size: clamp(13px, 2vh, 20px); font-weight: 900; color: #444;
box-shadow: 0 3px 12px rgba(0,0,0,0.1);
border: 2px solid #FFD93D; line-height: 1;
}
.atbar .sc { color: #FF9F43; font-size: 1.15em; }
/* ββ Grid ββ */
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: clamp(8px, 1.5vw, 18px);
width: min(96vw, 520px);
}
/* ββ Boxes ββ */
.box {
aspect-ratio: 1;
border: none;
border-radius: clamp(14px,2.5vw,26px);
cursor: pointer;
font-family: 'Fredoka One', cursive;
font-size: clamp(13px, 2.2vw, 22px);
color: #fff;
text-shadow: 0 1px 3px rgba(0,0,0,0.2);
position: relative; overflow: hidden;
display: flex; flex-direction: column;
align-items: center; justify-content: center;
gap: 3px; padding: 6px;
box-shadow: 0 6px 0 rgba(0,0,0,0.18), 0 8px 20px rgba(0,0,0,0.12);
transition: transform .15s, box-shadow .15s;
}
.box .be {
font-size: clamp(22px,4.5vw,40px);
filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
line-height: 1;
}
.box:hover:not(:disabled) { transform: translateY(-5px) scale(1.05); box-shadow: 0 11px 0 rgba(0,0,0,0.18), 0 14px 26px rgba(0,0,0,0.18); }
.box:active:not(:disabled) { transform: translateY(3px) scale(0.97); box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.box:disabled { cursor: not-allowed; }
/* shimmer */
.box::after {
content: ''; position: absolute;
top: -50%; left: -60%; width: 35%; height: 200%;
background: linear-gradient(90deg,transparent,rgba(255,255,255,.3),transparent);
transform: skewX(-20deg);
animation: sh 3.2s ease-in-out infinite;
}
.box:nth-child(2)::after{animation-delay:.5s}
.box:nth-child(3)::after{animation-delay:1s}
.box:nth-child(4)::after{animation-delay:1.5s}
.box:nth-child(5)::after{animation-delay:2s}
.box:nth-child(6)::after{animation-delay:2.5s}
@keyframes sh { 0%,65%,100%{left:-60%} 35%{left:130%} }
#box1{background:linear-gradient(135deg,#FF6B6B,#ee2b2b)}
#box2{background:linear-gradient(135deg,#4ECDC4,#1aab9e)}
#box3{background:linear-gradient(135deg,#FFD93D,#f5a623)}
#box4{background:linear-gradient(135deg,#C77DFF,#9b33e8)}
#box5{background:linear-gradient(135deg,#6BCB77,#38a844)}
#box6{background:linear-gradient(135deg,#4D96FF,#1566d4)}
.box.wrong { animation: ws .5s ease; filter: brightness(.5) saturate(.3); }
@keyframes ws { 0%,100%{transform:rotate(0)} 20%{transform:rotate(-7deg)} 40%{transform:rotate(7deg)} 60%{transform:rotate(-4deg)} 80%{transform:rotate(4deg)} }
.box.correct { animation: cp .5s cubic-bezier(.175,.885,.32,1.275); }
@keyframes cp { 0%{transform:scale(1)} 50%{transform:scale(1.2) rotate(5deg)} 100%{transform:scale(1.06)} }
/* ββ Message ββ */
#msg {
width: min(96vw, 500px);
border-radius: 22px;
padding: clamp(8px,1.4vh,16px) clamp(16px,3vw,28px);
font-family: 'Fredoka One', cursive;
font-size: clamp(16px, 3vh, 30px);
text-align: center;
background: #fff; color: #666; border: 2px solid #eee;
box-shadow: 0 5px 0 rgba(0,0,0,0.1), 0 8px 22px rgba(0,0,0,0.1);
transition: all .35s cubic-bezier(.175,.885,.32,1.275);
min-height: 0; line-height: 1.2;
}
#msg.win { background:linear-gradient(135deg,#6BCB77,#38c456); border-color:#2da844; color:#fff; animation:wp .55s ease; text-shadow:0 2px 5px rgba(0,0,0,.2); }
#msg.lose{ background:linear-gradient(135deg,#FF6B6B,#e83030); border-color:#c72222; color:#fff; animation:lp .4s ease; text-shadow:0 2px 5px rgba(0,0,0,.2); }
@keyframes wp { 0%{transform:scale(.8);opacity:0} 100%{transform:scale(1);opacity:1} }
@keyframes lp { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }
/* ββ Restart ββ */
#rbtn {
display: none;
padding: clamp(10px,1.5vh,14px) clamp(28px,5vw,44px);
font-family: 'Fredoka One', cursive;
font-size: clamp(16px, 2.6vh, 24px);
color: #fff;
background: linear-gradient(135deg,#FF9F43,#e67e22);
border: none; border-radius: 50px; cursor: pointer;
box-shadow: 0 6px 0 #c0690e, 0 9px 18px rgba(255,159,67,.4);
transition: transform .15s, box-shadow .15s;
animation: bpop .5s cubic-bezier(.175,.885,.32,1.275);
line-height: 1;
}
#rbtn:hover { transform:translateY(-4px); box-shadow:0 10px 0 #c0690e,0 12px 22px rgba(255,159,67,.4); }
#rbtn:active { transform:translateY(3px); box-shadow:0 2px 0 #c0690e; }
@keyframes bpop { 0%{transform:scale(0);opacity:0} 100%{transform:scale(1);opacity:1} }
/* ββ Confetti ββ */
.cp {
position: fixed; border-radius: 3px;
top: -20px; pointer-events: none; z-index: 999;
animation: cfall linear forwards;
}
@keyframes cfall { 0%{transform:translateY(0) rotate(0) scale(1);opacity:1} 90%{opacity:1} 100%{transform:translateY(110vh) rotate(720deg) scale(.5);opacity:0} }
.fst { position:fixed; font-size:30px; pointer-events:none; z-index:998; animation:fup 1.1s ease-out forwards; }
@keyframes fup { 0%{transform:translateY(0) scale(.5);opacity:1} 100%{transform:translateY(-110px) scale(1.2);opacity:0} }
</style>
</head>
<body>
<div class="cloud c1"></div>
<div class="cloud c2"></div>
<div class="cloud c3"></div>
<span class="sbg" style="top:10%;left:4%;animation-delay:0s">β</span>
<span class="sbg" style="top:16%;right:6%;animation-delay:.7s">β¨</span>
<span class="sbg" style="top:68%;left:2%;animation-delay:1.4s">π</span>
<span class="sbg" style="top:78%;right:3%;animation-delay:.3s">β</span>
<span class="sbg" style="top:42%;left:1%;animation-delay:1s">β¨</span>
<span class="sbg" style="top:55%;right:1.5%;animation-delay:1.8s">π</span>
<div class="wrap">
<div class="banner"><h1>πΊοΈ Treasure Hunt! π</h1></div>
<div class="sub">π Find the hidden treasure!</div>
<div id="buddy" class="buddy">π§ββοΈ</div>
<div class="atbar">
<span>π― Tries:</span>
<span id="atc" class="sc">0</span>
<span id="stars">βββ</span>
</div>
<div class="grid">
<button class="box" id="box1" onclick="check(1)"><span class="be">π</span><span>BOX 1</span></button>
<button class="box" id="box2" onclick="check(2)"><span class="be">πͺ</span><span>BOX 2</span></button>
<button class="box" id="box3" onclick="check(3)"><span class="be">π </span><span>BOX 3</span></button>
<button class="box" id="box4" onclick="check(4)"><span class="be">π¨</span><span>BOX 4</span></button>
<button class="box" id="box5" onclick="check(5)"><span class="be">π</span><span>BOX 5</span></button>
<button class="box" id="box6" onclick="check(6)"><span class="be">π―</span><span>BOX 6</span></button>
</div>
<div id="msg" class="ready">π§ββοΈ Pick a box to find the treasure!</div>
<button id="rbtn" onclick="restart()">π Play Again!</button>
</div>
<script>
const EMOJIS = ['π','πͺ','π ','π¨','π','π―'];
const WINS = ['π YOU FOUND IT! π','π TREASURE! AMAZING! π','β SUPERSTAR! β','π HOORAY! YOU WIN! π','π₯³ WOW! BRILLIANT! π₯³'];
const LOSES = ['π Oops! Try again!','π¨ Not here! Keep looking!','π Hmmβ¦ keep searching!','π
So close! Try another!','π€ Nope! Where could it be?'];
const BUDDS = ['π§ββοΈ','π¦','π','π¦','πΈ','π¦'];
const CONFCOLS = ['#FF6B6B','#4ECDC4','#FFD93D','#C77DFF','#6BCB77','#4D96FF','#FF9F43','#FF6FD8'];
let treasure, attempts, over;
function init() {
treasure = Math.floor(Math.random() * 6) + 1;
attempts = 0; over = false;
}
init();
function stars(n) { return n <= 2 ? 'βββ' : n <= 4 ? 'ββ' : 'β'; }
function check(n) {
if (over) return;
attempts++;
document.getElementById('atc').textContent = attempts;
document.getElementById('stars').textContent = stars(attempts);
const box = document.getElementById('box' + n);
if (n === treasure) {
over = true;
box.classList.add('correct');
box.innerHTML = `<span class="be" style="font-size:clamp(28px,6vw,48px)">π</span><span>FOUND IT!</span>`;
box.disabled = true;
const msg = document.getElementById('msg');
msg.className = 'win';
msg.innerHTML = WINS[Math.floor(Math.random() * WINS.length)];
const buddy = document.getElementById('buddy');
buddy.textContent = 'π'; buddy.classList.add('celebrating');
document.querySelectorAll('.box').forEach(b => b.disabled = true);
confetti();
['β','β¨','π'].forEach((e,i) => setTimeout(() => floatStar(box,e), i*280));
setTimeout(() => document.getElementById('rbtn').style.display = 'inline-block', 1000);
} else {
box.classList.add('wrong');
box.innerHTML = `<span class="be">π¨</span><span>Empty!</span>`;
box.disabled = true;
const msg = document.getElementById('msg');
msg.className = 'lose';
msg.innerHTML = LOSES[Math.floor(Math.random() * LOSES.length)];
document.getElementById('buddy').textContent = BUDDS[Math.floor(Math.random()*BUDDS.length)];
setTimeout(() => { if (!over) { msg.className='ready'; msg.innerHTML='π Keep looking! The treasure is hiding!'; } }, 1500);
}
}
function confetti() {
for (let i = 0; i < 70; i++) {
setTimeout(() => {
const p = document.createElement('div');
p.className = 'cp';
const dur = 1.5 + Math.random() * 2;
const sz = 8 + Math.random() * 13;
p.style.cssText = `left:${Math.random()*100}vw;background:${CONFCOLS[Math.floor(Math.random()*CONFCOLS.length)]};width:${sz}px;height:${sz}px;border-radius:${Math.random()>.5?'50%':'3px'};animation-duration:${dur}s`;
document.body.appendChild(p);
setTimeout(() => p.remove(), dur * 1000 + 200);
}, i * 28);
}
}
function floatStar(el, emoji) {
const r = el.getBoundingClientRect();
const s = document.createElement('span');
s.className = 'fst'; s.textContent = emoji;
s.style.left = (r.left + r.width/2 - 15) + 'px';
s.style.top = (r.top + r.height/2) + 'px';
document.body.appendChild(s);
setTimeout(() => s.remove(), 1200);
}
function restart() {
init();
document.getElementById('atc').textContent = '0';
document.getElementById('stars').textContent = 'βββ';
for (let i = 1; i <= 6; i++) {
const b = document.getElementById('box' + i);
b.disabled = false; b.className = 'box';
b.innerHTML = `<span class="be">${EMOJIS[i-1]}</span><span>BOX ${i}</span>`;
}
const msg = document.getElementById('msg');
msg.className = 'ready'; msg.innerHTML = 'π§ββοΈ Pick a box to find the treasure!';
const buddy = document.getElementById('buddy');
buddy.textContent = 'π§ββοΈ'; buddy.classList.remove('celebrating');
document.getElementById('rbtn').style.display = 'none';
}
</script>
</body>
</html>