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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Luckify | Test Your Luck</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<!-- Updated font to Plus Jakarta Sans for a more premium, modern feel -->
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;600;800&display=swap" rel="stylesheet">
|
| 10 |
+
<style>
|
| 11 |
+
body {
|
| 12 |
+
font-family: 'Plus Jakarta Sans', sans-serif;
|
| 13 |
+
background: #050505;
|
| 14 |
+
background-image:
|
| 15 |
+
radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
|
| 16 |
+
radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
|
| 17 |
+
min-height: 100vh;
|
| 18 |
+
display: flex;
|
| 19 |
+
align-items: center;
|
| 20 |
+
justify-content: center;
|
| 21 |
+
color: white;
|
| 22 |
+
margin: 0;
|
| 23 |
+
overflow-y: auto;
|
| 24 |
+
padding: 2rem 1rem;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.luck-card {
|
| 28 |
+
background: rgba(255, 255, 255, 0.02);
|
| 29 |
+
backdrop-filter: blur(25px);
|
| 30 |
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
| 31 |
+
border-radius: 32px;
|
| 32 |
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
.input-luck {
|
| 36 |
+
background: rgba(255, 255, 255, 0.03);
|
| 37 |
+
border: 2px solid rgba(255, 255, 255, 0.05);
|
| 38 |
+
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.input-luck:focus {
|
| 42 |
+
background: rgba(255, 255, 255, 0.07);
|
| 43 |
+
border-color: #818cf8;
|
| 44 |
+
box-shadow: 0 0 25px rgba(129, 140, 248, 0.2);
|
| 45 |
+
transform: translateY(-2px);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.btn-gradient {
|
| 49 |
+
background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
|
| 50 |
+
transition: all 0.3s ease;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.btn-gradient:hover {
|
| 54 |
+
filter: brightness(1.1);
|
| 55 |
+
transform: translateY(-2px);
|
| 56 |
+
box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.btn-gradient:active {
|
| 60 |
+
transform: translateY(0);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
@keyframes float {
|
| 64 |
+
0%, 100% { transform: translateY(0) scale(1); }
|
| 65 |
+
50% { transform: translateY(-10px) scale(1.02); }
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.animate-luck {
|
| 69 |
+
animation: float 4s ease-in-out infinite;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
.result-box {
|
| 73 |
+
transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
.hidden-card {
|
| 77 |
+
opacity: 0;
|
| 78 |
+
transform: translateY(20px) scale(0.9);
|
| 79 |
+
pointer-events: none;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
::-webkit-scrollbar {
|
| 83 |
+
width: 8px;
|
| 84 |
+
}
|
| 85 |
+
::-webkit-scrollbar-track {
|
| 86 |
+
background: #050505;
|
| 87 |
+
}
|
| 88 |
+
::-webkit-scrollbar-thumb {
|
| 89 |
+
background: #312e81;
|
| 90 |
+
border-radius: 10px;
|
| 91 |
+
}
|
| 92 |
+
</style>
|
| 93 |
+
</head>
|
| 94 |
+
<body>
|
| 95 |
+
|
| 96 |
+
<main class="w-full max-w-md luck-card p-10 relative z-10">
|
| 97 |
+
<div class="text-center mb-12">
|
| 98 |
+
<h1 class="text-5xl font-extrabold tracking-tight bg-gradient-to-b from-white to-slate-400 bg-clip-text text-transparent mb-3">
|
| 99 |
+
Luckify
|
| 100 |
+
</h1>
|
| 101 |
+
<p class="text-slate-500 font-medium tracking-tight">Guess the Number, Win the Prize</p>
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
<form id="luckForm" class="space-y-8">
|
| 105 |
+
<div class="relative">
|
| 106 |
+
<div class="flex justify-between items-end mb-3 px-1">
|
| 107 |
+
<label for="numberInput" class="text-sm font-semibold text-slate-300">
|
| 108 |
+
Pick a Number
|
| 109 |
+
</label>
|
| 110 |
+
<span class="text-[11px] font-bold text-slate-500 bg-slate-800/50 px-2 py-1 rounded">1 — 10</span>
|
| 111 |
+
</div>
|
| 112 |
+
<input
|
| 113 |
+
type="number"
|
| 114 |
+
id="numberInput"
|
| 115 |
+
required
|
| 116 |
+
min="1"
|
| 117 |
+
max="10"
|
| 118 |
+
placeholder="Enter your guess..."
|
| 119 |
+
class="w-full input-luck rounded-2xl px-6 py-5 text-2xl font-bold text-white outline-none placeholder:text-slate-700 text-center"
|
| 120 |
+
>
|
| 121 |
+
</div>
|
| 122 |
+
|
| 123 |
+
<button
|
| 124 |
+
type="submit"
|
| 125 |
+
id="submitBtn"
|
| 126 |
+
class="w-full btn-gradient py-5 rounded-2xl font-extrabold text-xl tracking-wide flex items-center justify-center gap-3"
|
| 127 |
+
>
|
| 128 |
+
<span id="btnText">Test Your Luck</span>
|
| 129 |
+
<div id="loader" class="hidden">
|
| 130 |
+
<svg class="animate-spin h-6 w-6 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
| 131 |
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
| 132 |
+
<path class="opacity-75" fill="currentColor" d="4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
| 133 |
+
</svg>
|
| 134 |
+
</div>
|
| 135 |
+
</button>
|
| 136 |
+
</form>
|
| 137 |
+
|
| 138 |
+
<div id="resultContainer" class="mt-10 result-box hidden-card">
|
| 139 |
+
<div class="bg-gradient-to-br from-indigo-500/5 to-purple-500/5 border border-white/5 rounded-3xl p-8 text-center animate-luck">
|
| 140 |
+
<div class="w-12 h-1 w-1/4 bg-indigo-500/30 mx-auto mb-6 rounded-full"></div>
|
| 141 |
+
<p id="resultText" class="text-xl text-slate-100 font-semibold leading-relaxed tracking-tight"></p>
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
|
| 145 |
+
<footer class="mt-12 text-center border-t border-white/5 pt-8">
|
| 146 |
+
<p class="text-slate-600 text-xs font-bold tracking-[0.2em] uppercase">Developed by Hamza</p>
|
| 147 |
+
</footer>
|
| 148 |
+
</main>
|
| 149 |
+
|
| 150 |
+
<script>
|
| 151 |
+
const luckForm = document.getElementById('luckForm');
|
| 152 |
+
const numberInput = document.getElementById('numberInput');
|
| 153 |
+
const submitBtn = document.getElementById('submitBtn');
|
| 154 |
+
const btnText = document.getElementById('btnText');
|
| 155 |
+
const loader = document.getElementById('loader');
|
| 156 |
+
const resultContainer = document.getElementById('resultContainer');
|
| 157 |
+
const resultText = document.getElementById('resultText');
|
| 158 |
+
|
| 159 |
+
const BASE_URL = 'https://humza7656-guess-backend.hf.space';
|
| 160 |
+
|
| 161 |
+
luckForm.addEventListener('submit', async (e) => {
|
| 162 |
+
e.preventDefault();
|
| 163 |
+
|
| 164 |
+
const guessValue = parseInt(numberInput.value);
|
| 165 |
+
|
| 166 |
+
if (isNaN(guessValue) || guessValue < 1 || guessValue > 10) {
|
| 167 |
+
showFeedback("Pick a number between 1 and 10.");
|
| 168 |
+
return;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
setLoading(true);
|
| 172 |
+
resultContainer.classList.add('hidden-card');
|
| 173 |
+
|
| 174 |
+
try {
|
| 175 |
+
const url = new URL(`${BASE_URL}/guess_it`);
|
| 176 |
+
url.searchParams.append('number', guessValue);
|
| 177 |
+
|
| 178 |
+
const response = await fetch(url.toString(), {
|
| 179 |
+
method: 'GET',
|
| 180 |
+
headers: { 'Accept': 'application/json' }
|
| 181 |
+
});
|
| 182 |
+
|
| 183 |
+
if (!response.ok) throw new Error('API is taking a nap');
|
| 184 |
+
|
| 185 |
+
const data = await response.json();
|
| 186 |
+
showFeedback(data.Guessy || "The crystal ball is cloudy. Try again.");
|
| 187 |
+
|
| 188 |
+
} catch (error) {
|
| 189 |
+
showFeedback(`System Error: ${error.message}`);
|
| 190 |
+
} finally {
|
| 191 |
+
setLoading(false);
|
| 192 |
+
}
|
| 193 |
+
});
|
| 194 |
+
|
| 195 |
+
function setLoading(isLoading) {
|
| 196 |
+
if (isLoading) {
|
| 197 |
+
loader.classList.remove('hidden');
|
| 198 |
+
btnText.textContent = '';
|
| 199 |
+
submitBtn.disabled = true;
|
| 200 |
+
submitBtn.classList.add('opacity-90', 'cursor-not-allowed');
|
| 201 |
+
} else {
|
| 202 |
+
loader.classList.add('hidden');
|
| 203 |
+
btnText.textContent = 'Test Your Luck';
|
| 204 |
+
submitBtn.disabled = false;
|
| 205 |
+
submitBtn.classList.remove('opacity-90', 'cursor-not-allowed');
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
function showFeedback(message) {
|
| 210 |
+
resultText.textContent = message;
|
| 211 |
+
resultContainer.classList.remove('hidden-card');
|
| 212 |
+
}
|
| 213 |
+
</script>
|
| 214 |
+
</body>
|
| 215 |
+
</html>
|