<!DOCTYPE html>
<html lang="vi" class="scroll-smooth">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Steal An Egg — Dịch Vụ Cày Thuê & Sự Kiện Storm Update 13</title>
<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=Be+Vietnam+Pro:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@500;700&display=swap" rel="stylesheet" />
<script src="https://cdn.tailwindcss.com"></script>
<style>
:root {
--glass-bg: rgba(11, 17, 30, 0.72);
--glass-border: rgba(255, 255, 255, 0.16);
}
* {
box-sizing: border-box;
}
html, body {
margin: 0;
padding: 0;
min-height: 100%;
overflow-x: hidden;
background-color: #13202e;
font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
color: #f8fafc;
}
.font-mono-code {
font-family: 'JetBrains Mono', monospace;
}
/* Thẻ kính mờ nổi trên nền phong cảnh 4 mùa */
.glass-panel {
background: var(--glass-bg);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border: 1px solid var(--glass-border);
box-shadow: 0 18px 40px -15px rgba(0, 0, 0, 0.55);
}
.glass-header {
background: rgba(9, 14, 26, 0.78);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
/* Thẻ gói dịch vụ */
.pkg-card {
background: rgba(15, 23, 42, 0.76);
border: 1.5px solid rgba(255, 255, 255, 0.14);
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
cursor: pointer;
user-select: none;
}
.pkg-card:hover {
transform: translateY(-2px);
border-color: rgba(250, 204, 21, 0.55);
background: rgba(22, 33, 58, 0.86);
}
.pkg-card.selected {
background: linear-gradient(145deg, rgba(49, 28, 92, 0.92), rgba(20, 35, 68, 0.92));
border-color: #facc15;
box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.35), 0 12px 28px -8px rgba(250, 204, 21, 0.35);
}
/* Chế độ ngắm nền thuần túy */
#app-content {
transition: opacity 0.35s ease;
}
body.scenery-only #app-content {
opacity: 0;
pointer-events: none;
}
/* Thanh cuộn gọn đẹp */
::-webkit-scrollbar {
width: 7px;
height: 7px;
}
::-webkit-scrollbar-track {
background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
background: rgba(148, 163, 184, 0.45);
border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(250, 204, 21, 0.7);
}
@keyframes pulseGlow {
0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.55); }
50% { box-shadow: 0 0 0 10px rgba(250, 204, 21, 0); }
}
.bubble-pulse {
animation: pulseGlow 2.4s infinite;
}
</style>
</head>
<body class="antialiased selection:bg-amber-400 selection:text-slate-950">
<!-- ===================================================================== -->
<!-- 1. LỚP NỀN CUỘN 4 MÙA CỐ ĐỊNH TOÀN MÀN HÌNH (XUÂN -> HẠ -> THU -> ĐÔNG) -->
<!-- ===================================================================== -->
<div id="background-stage" class="fixed inset-0 z-0 overflow-hidden pointer-events-none">
<canvas id="scene-canvas" class="absolute inset-0 w-full h-full block"></canvas>
<canvas id="particle-canvas" class="absolute inset-0 w-full h-full block"></canvas>
<div class="absolute inset-0 bg-gradient-to-b from-slate-950/35 via-slate-950/20 to-slate-950/45"></div>
</div>
<!-- Nút hiện lại giao diện khi đang bật chế độ Ngắm nền -->
<button id="btn-restore-ui" type="button"
class="fixed top-4 right-4 z-50 hidden px-4 py-2.5 rounded-full bg-amber-400 text-slate-950 font-bold text-xs sm:text-sm shadow-xl hover:bg-amber-300 active:scale-95 transition">
📝 Hiện lại bảng giá
</button>
<!-- ===================================================================== -->
<!-- 2. TOÀN BỘ GIAO DIỆN CHÍNH CỦA TRANG WEB -->
<!-- ===================================================================== -->
<div id="app-content" class="relative z-10 min-h-screen flex flex-col pb-28 lg:pb-14">
<!-- THANH ĐIỀU HƯỚNG TRÊN CÙNG -->
<header class="sticky top-0 z-30 glass-header">
<div class="max-w-6xl mx-auto px-3 sm:px-6 py-2.5 flex items-center justify-between gap-2">
<!-- Logo & Tên Shop -->
<div class="flex items-center gap-2.5 min-w-0">
<div class="w-9 h-9 sm:w-10 sm:h-10 rounded-xl bg-gradient-to-br from-amber-400 via-purple-500 to-indigo-600 flex items-center justify-center text-lg sm:text-xl shadow-md shrink-0">
🥚
</div>
<div class="min-w-0">
<div class="flex items-center gap-1.5">
<span class="font-extrabold text-sm sm:text-base tracking-tight text-white truncate">STEAL AN EGG</span>
<span class="hidden sm:inline-block px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-400/20 text-amber-300 border border-amber-400/40">UPDATE 13</span>
</div>
<p class="text-[11px] text-slate-300 truncate">Darkwolf Divine • Cày Thuê & Sự Kiện Storm</p>
</div>
</div>
<!-- Cụm nút công cụ bên phải -->
<div class="flex items-center gap-1.5 sm:gap-2 shrink-0">
<!-- Chỉ báo mùa theo vị trí cuộn -->
<div class="hidden md:flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white/10 border border-white/15 text-xs font-medium text-white">
<span id="season-badge-icon">🌸</span>
<span id="season-badge-text">Xuân Khởi Sắc</span>
</div>
<!-- Nút Quản lý 20 Số -->
<button id="btn-open-slots-modal" type="button"
class="px-2.5 sm:px-3.5 py-1.5 sm:py-2 rounded-xl bg-indigo-500/25 hover:bg-indigo-500/40 border border-indigo-400/40 text-indigo-200 text-xs font-semibold transition flex items-center gap-1.5">
<span>🔢</span>
<span>20 Số (<span id="header-free-count">20</span> trống)</span>
</button>
<!-- Nút Ngắm nền 4 mùa -->
<button id="btn-toggle-scenery" type="button"
class="px-2.5 sm:px-3 py-1.5 sm:py-2 rounded-xl bg-white/10 hover:bg-white/20 border border-white/15 text-white text-xs font-medium transition flex items-center gap-1"
title="Ẩn bảng giá để ngắm nền 4 mùa">
<span>👁️</span>
<span class="hidden sm:inline">Ngắm nền</span>
</button>
</div>
</div>
</header>
<!-- NỘI DUNG CHÍNH -->
<main class="max-w-6xl w-full mx-auto px-3 sm:px-6 pt-5 sm:pt-7 flex-1">
<!-- BANNER GIỚI THIỆU & BẢNG TRẠNG THÁI 20 SỐ THỨ TỰ -->
<section class="glass-panel rounded-3xl p-4 sm:p-6 mb-6">
<div class="flex flex-col lg:flex-row lg:items-center justify-between gap-4 pb-5 border-b border-white/10">
<div>
<div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-emerald-500/20 border border-emerald-400/40 text-emerald-300 text-xs font-semibold mb-2.5">
<span class="w-2 h-2 rounded-full bg-emerald-400 animate-ping"></span>
<span>HỆ THỐNG CẤP SỐ THỨ TỰ TỰ ĐỘNG #01 → #20</span>
</div>
<h1 class="text-xl sm:text-3xl font-black text-white leading-tight">
Cày Thuê <span class="text-amber-400">Steal An Egg</span> Chuyên Nghiệp
</h1>
<p class="text-xs sm:text-sm text-slate-300 mt-1.5 max-w-2xl leading-relaxed">
Chọn các gói cày bên dưới → Nhận ngay <strong>Form Đơn Điền Sẵn</strong> kèm <strong>Số Thứ Tự (1–20)</strong>. Mỗi số tự động giữ chỗ đúng theo thời gian gói bạn chọn và <strong>tự động Reset</strong> sau khi hết đơn.
</p>
</div>
<div class="flex flex-wrap gap-2 shrink-0">
<a href="#order-form-box"
class="px-4 py-2.5 rounded-xl bg-gradient-to-r from-amber-400 to-orange-500 text-slate-950 font-extrabold text-xs sm:text-sm shadow-lg hover:brightness-105 active:scale-95 transition">
⚡ Đặt Đơn Ngay
</a>
<button type="button" id="btn-hero-contact"
class="px-4 py-2.5 rounded-xl bg-white/10 hover:bg-white/20 border border-white/20 text-white font-semibold text-xs sm:text-sm transition">
💬 Liên Hệ Shop
</button>
</div>
</div>
<!-- Lưới trực quan 20 số thứ tự (#01 -> #20) -->
<div class="pt-4">
<div class="flex flex-wrap items-center justify-between gap-2 mb-2.5">
<span class="text-xs font-bold uppercase tracking-wider text-slate-300">
📊 Trạng thái 20 Số Thứ Tự trực tiếp (Tự Reset khi hết hạn đơn):
</span>
<div class="flex items-center gap-3 text-[11px]">
<span class="flex items-center gap-1 text-emerald-300"><span class="w-2.5 h-2.5 rounded-sm bg-emerald-500/40 border border-emerald-400"></span> Trống</span>
<span class="flex items-center gap-1 text-amber-300"><span class="w-2.5 h-2.5 rounded-sm bg-amber-500/40 border border-amber-400"></span> Đang chạy đơn</span>
</div>
</div>
<div id="slots-mini-grid" class="grid grid-cols-5 sm:grid-cols-10 gap-1.5 sm:gap-2"></div>
</div>
</section>
<!-- BỘ LỌC DANH MỤC GÓI CÀY -->
<div class="flex items-center gap-2 overflow-x-auto pb-2 mb-5 no-scrollbar">
<button type="button" data-filter="all" class="filter-tab active px-4 py-2 rounded-xl text-xs sm:text-sm font-bold bg-amber-400 text-slate-950 shrink-0 transition">
🌟 Tất cả gói cày
</button>
<button type="button" data-filter="storm" class="filter-tab px-4 py-2 rounded-xl text-xs sm:text-sm font-bold bg-slate-900/80 text-slate-200 border border-white/15 hover:border-amber-400/50 shrink-0 transition">
⚡ Sự Kiện Storm (Update 13)
</button>
<button type="button" data-filter="pro" class="filter-tab px-4 py-2 rounded-xl text-xs sm:text-sm font-bold bg-slate-900/80 text-slate-200 border border-white/15 hover:border-amber-400/50 shrink-0 transition">
👑 Gói 5 - Full AFK Pro
</button>
<button type="button" data-filter="basic" class="filter-tab px-4 py-2 rounded-xl text-xs sm:text-sm font-bold bg-slate-900/80 text-slate-200 border border-white/15 hover:border-amber-400/50 shrink-0 transition">
🥚 Gói Cày Cơ Bản
</button>
</div>
<!-- BỐ CỤC 2 CỘT: DANH SÁCH GÓI CÀY (TRÁI) & FORM CHỐT ĐƠN (PHẢI) -->
<div class="grid grid-cols-1 lg:grid-cols-12 gap-6 items-start">
<!-- CỘT TRÁI (7 CỘT): CÁC GÓI DỊCH VỤ -->
<div class="lg:col-span-7 space-y-6">
<!-- 1. GÓI SỰ KIỆN STORM & BLACK MARKET (UPDATE 13) -->
<section data-category="storm" class="pkg-section glass-panel rounded-3xl p-4 sm:p-6">
<div class="flex flex-wrap items-center justify-between gap-2 mb-3">
<div>
<span class="px-2.5 py-0.5 rounded-md bg-sky-500/20 border border-sky-400/40 text-sky-300 text-[11px] font-bold uppercase">Update 13 Mới Nhất</span>
<h2 class="text-lg sm:text-xl font-extrabold text-white mt-1">⚡ Gói Sự Kiện Storm & Black Market</h2>
</div>
<span class="text-xs text-sky-200 bg-sky-950/60 px-3 py-1 rounded-full border border-sky-400/25">Bấm để chọn nhiều gói</span>
</div>
<!-- Thông tin cơ chế Update 13 -->
<div class="rounded-2xl bg-slate-950/65 border border-sky-400/25 p-3.5 mb-4 text-xs text-slate-200 space-y-1.5">
<p>⭐ <strong class="text-amber-300">Slick Rick:</strong> Canh thương nhân Chợ Đen tại biome Aliens săn hàng làm mới.</p>
<p>⭐ <strong class="text-sky-300">Stormlands & Skyfall:</strong> Cày đủ <strong>150M Speed</strong> mở biome mới & đập đá Skyfall mỗi 30 phút gom <strong>Thunderstones</strong>.</p>
<p>⭐ <strong class="text-purple-300">Stormy Egg & Storm Rush:</strong> Đổi 200 Thunderstones mở trứng Stormy & gom Sparks lấy <strong>Thunderous Mutation</strong>.</p>
</div>
<p class="text-xs font-bold uppercase tracking-wider text-sky-300 mb-2">A. Gói Nhiệm Vụ Storm Lẻ</p>
<div id="grid-storm-tasks" class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-4"></div>
<p class="text-xs font-bold uppercase tracking-wider text-sky-300 mb-2">B. Gói Treo Full Event Storm Theo Thời Gian</p>
<div id="grid-storm-time" class="grid grid-cols-2 gap-3"></div>
</section>
<!-- 2. GÓI 5 - FULL AFK PRO (CÂU CÁ & DIVINE) -->
<section data-category="pro" class="pkg-section glass-panel rounded-3xl p-4 sm:p-6">
<div class="flex flex-wrap items-center justify-between gap-2 mb-3">
<div>
<span class="px-2.5 py-0.5 rounded-md bg-amber-500/20 border border-amber-400/40 text-amber-300 text-[11px] font-bold uppercase">VIP • Câu Cá Là Chính</span>
<h2 class="text-lg sm:text-xl font-extrabold text-white mt-1">👑 Gói 5 – Full AFK Pro</h2>
</div>
<span class="text-xs text-amber-200 bg-amber-950/60 px-3 py-1 rounded-full border border-amber-400/25">Cam kết Egg/s theo từng gói</span>
</div>
<!-- Quyền lợi chung -->
<div class="grid grid-cols-2 gap-2 rounded-2xl bg-slate-950/65 border border-amber-400/25 p-3.5 mb-4 text-xs text-slate-200">
<div>✅ Auto câu cá 24/7 – Săn cá hiếm</div>
<div>✅ Cam kết nhận <strong>Divine 👑</strong></div>
<div>✅ Auto Money + Speed mốc cao ⚡</div>
<div>✅ Mở Egg, thu thập Pet & Index 🐾</div>
</div>
<div id="grid-pro" class="grid grid-cols-1 sm:grid-cols-2 gap-3"></div>
</section>
<!-- 3. GÓI CÀY THUÊ CƠ BẢN -->
<section data-category="basic" class="pkg-section glass-panel rounded-3xl p-4 sm:p-6">
<div class="flex flex-wrap items-center justify-between gap-2 mb-3">
<div>
<span class="px-2.5 py-0.5 rounded-md bg-purple-500/20 border border-purple-400/40 text-purple-300 text-[11px] font-bold uppercase">Nhanh Gọn • Tiết Kiệm</span>
<h2 class="text-lg sm:text-xl font-extrabold text-white mt-1">🥚 Gói Cày Thuê Cơ Bản</h2>
</div>
<span class="text-xs text-purple-200 bg-purple-950/60 px-3 py-1 rounded-full border border-purple-400/25">Treo Speed • Nhặt Trứng</span>
</div>
<div class="rounded-2xl bg-slate-950/65 border border-purple-400/25 p-3 mb-4 text-xs text-slate-200">
Treo cày Speed liên tục, tự động nhặt trứng hiếm trên bản đồ và hỗ trợ làm tiến độ sự kiện cơ bản 24/24.
</div>
<div id="grid-basic" class="grid grid-cols-2 gap-3"></div>
</section>
</div>
<!-- CỘT PHẢI (5 CỘT): GIỎ HÀNG & FORM ĐĂNG KÝ ĐƠN -->
<aside id="order-form-box" class="lg:col-span-5 lg:sticky lg:top-20">
<div class="glass-panel rounded-3xl p-4 sm:p-6 border border-amber-400/30">
<div class="flex items-center justify-between gap-2 pb-3 mb-4 border-b border-white/10">
<div>
<h2 class="text-base sm:text-lg font-extrabold text-white">📋 Phiếu Đăng Ký Đơn Hàng</h2>
<p class="text-xs text-slate-300">Tự động cấp số từ #01 đến #20 sau khi bấm tạo</p>
</div>
<button type="button" id="btn-clear-cart"
class="text-xs text-rose-300 hover:text-rose-200 underline">
Xóa chọn
</button>
</div>
<!-- Danh sách gói đã chọn -->
<div class="mb-4">
<div class="text-xs font-bold text-slate-300 mb-2">Gói dịch vụ đã chọn (<span id="cart-count">0</span>):</div>
<div id="cart-items-list" class="space-y-2 max-h-48 overflow-y-auto pr-1">
<div class="rounded-xl bg-slate-950/60 border border-dashed border-white/15 p-3.5 text-center text-xs text-slate-400">
Chưa chọn gói nào. Hãy bấm vào thẻ gói cày bên trái để thêm vào đơn!
</div>
</div>
</div>
<!-- Tổng tiền & Thời gian giữ số -->
<div class="rounded-2xl bg-gradient-to-r from-slate-900/90 to-indigo-950/80 border border-white/15 p-3.5 mb-4 space-y-1.5">
<div class="flex items-center justify-between text-xs text-slate-300">
<span>Thời hạn giữ Số Thứ Tự:</span>
<span id="cart-duration-text" class="font-bold text-sky-300">0 giờ</span>
</div>
<div class="flex items-center justify-between">
<span class="text-xs sm:text-sm font-bold text-white">Tổng thanh toán:</span>
<span id="cart-total-price" class="text-xl sm:text-2xl font-black text-amber-400">0đ</span>
</div>
</div>
<!-- Các trường nhập thông tin khách hàng -->
<div class="space-y-3">
<div>
<label for="input-roblox-user" class="block text-xs font-bold text-slate-200 mb-1">
1. Tên nhân vật Roblox (Username) <span class="text-rose-400">*</span>
</label>
<input id="input-roblox-user" type="text" placeholder="Ví dụ: DarkWolf_VN123"
class="w-full px-3.5 py-2.5 rounded-xl bg-slate-950/80 border border-white/15 focus:border-amber-400 focus:outline-none text-sm text-white placeholder-slate-500" />
</div>
<div>
<label for="input-contact" class="block text-xs font-bold text-slate-200 mb-1">
2. SĐT Zalo / Tên Discord / Link FB của bạn <span class="text-rose-400">*</span>
</label>
<input id="input-contact" type="text" placeholder="Ví dụ: Zalo 0912xxx hoặc Discord user#1234"
class="w-full px-3.5 py-2.5 rounded-xl bg-slate-950/80 border border-white/15 focus:border-amber-400 focus:outline-none text-sm text-white placeholder-slate-500" />
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2.5">
<div>
<label for="input-account-mode" class="block text-xs font-bold text-slate-200 mb-1">
3. Hình thức giao acc
</label>
<select id="input-account-mode"
class="w-full px-3 py-2.5 rounded-xl bg-slate-950/80 border border-white/15 focus:border-amber-400 focus:outline-none text-xs sm:text-sm text-white">
<option value="Gửi TK/MK qua Zalo hoặc Discord sau khi tạo form">Gửi TK/MK qua Zalo/Discord</option>
<option value="Giao dịch Trade trực tiếp trong game">Giao dịch Trade trong game</option>
<option value="Kéo chung Server VIP (Không đưa acc)">Kéo chung Server VIP</option>
</select>
</div>
<div>
<label for="input-payment" class="block text-xs font-bold text-slate-200 mb-1">
4. Thanh toán qua
</label>
<select id="input-payment"
class="w-full px-3 py-2.5 rounded-xl bg-slate-950/80 border border-white/15 focus:border-amber-400 focus:outline-none text-xs sm:text-sm text-white">
<option value="Chuyển khoản Ngân hàng / Momo">Chuyển khoản / Momo</option>
<option value="Thẻ cào (Viettel / Garena)">Thẻ cào điện thoại</option>
<option value="Robux (Gamepass)">Robux (Gamepass)</option>
</select>
</div>
</div>
<div>
<label for="input-note" class="block text-xs font-bold text-slate-200 mb-1">
5. Ghi chú thêm cho chủ shop (Tùy chọn)
</label>
<input id="input-note" type="text" placeholder="Ví dụ: Cày giúp mình sau 8h tối nay..."
class="w-full px-3.5 py-2.5 rounded-xl bg-slate-950/80 border border-white/15 focus:border-amber-400 focus:outline-none text-sm text-white placeholder-slate-500" />
</div>
<button id="btn-submit-order" type="button"
class="w-full py-3.5 px-4 rounded-2xl bg-gradient-to-r from-amber-400 via-orange-500 to-rose-500 hover:brightness-110 active:scale-[0.99] text-slate-950 font-black text-sm sm:text-base shadow-xl transition flex items-center justify-center gap-2">
<span>🎫</span>
<span>ĐĂNG KÝ ĐƠN & NHẬN FORM (SỐ 1 - 20)</span>
</button>
<p class="text-[11px] text-center text-slate-300 leading-relaxed">
🔒 Bảo mật 100%: Không cần nhập mật khẩu Roblox trên web. Sau khi nhận Form có sẵn số thứ tự, bạn chỉ cần Copy và gửi qua Zalo hoặc Discord của shop.
</p>
</div>
</div>
</aside>
</div>
</main>
</div>
<!-- ===================================================================== -->
<!-- 3. THANH GIỎ HÀNG NHANH DƯỚI ĐÁY MÀN HÌNH (CHO ĐIỆN THOẠI) -->
<!-- ===================================================================== -->
<div id="mobile-sticky-bar"
class="fixed bottom-0 left-0 right-0 z-30 lg:hidden glass-header px-3 py-2.5 flex items-center justify-between gap-3">
<div class="min-w-0">
<div class="text-[11px] text-slate-300">Đã chọn <strong id="mobile-count" class="text-white">0</strong> gói • Giữ số <span id="mobile-duration" class="text-sky-300">0h</span></div>
<div id="mobile-total" class="text-base font-black text-amber-400 truncate">0đ</div>
</div>
<a href="#order-form-box"
class="px-4 py-2.5 rounded-xl bg-amber-400 text-slate-950 font-extrabold text-xs shrink-0 shadow-lg active:scale-95 transition">
Điền Form & Lấy Số ↓
</a>
</div>
<!-- ===================================================================== -->
<!-- 4. BONG BÓNG LIÊN HỆ VỚI CHÚNG TÔI (TIKTOK / ZALO / DISCORD) -->
<!-- ===================================================================== -->
<div id="contact-widget" class="fixed bottom-16 lg:bottom-6 right-4 z-40 flex flex-col items-end">
<!-- Bảng thông tin liên hệ bật lên khi chạm bong bóng -->
<div id="contact-popup"
class="hidden mb-3 w-80 max-w-[calc(100vw-2rem)] rounded-3xl glass-panel border border-white/25 p-4 shadow-2xl">
<div class="flex items-center justify-between pb-2.5 mb-3 border-b border-white/10">
<div class="flex items-center gap-2">
<span class="w-2.5 h-2.5 rounded-full bg-emerald-400"></span>
<h3 class="text-sm font-extrabold text-white">Liên hệ với chúng tôi</h3>
</div>
<button id="btn-close-contact" type="button"
class="w-7 h-7 rounded-full bg-white/10 hover:bg-white/20 text-xs flex items-center justify-center text-white">
✕
</button>
</div>
<div class="space-y-2.5">
<!-- 1. TIKTOK: darkwolf.divine -->
<a id="link-tiktok" href="https://www.tiktok.com/@darkwolf.divine" target="_blank" rel="noopener noreferrer"
class="flex items-center justify-between gap-2.5 p-2.5 rounded-2xl bg-slate-950/75 hover:bg-slate-900 border border-white/15 hover:border-pink-400/50 transition group">
<div class="flex items-center gap-2.5 min-w-0">
<!-- Avatar TikTok -->
<div class="w-10 h-10 rounded-full bg-gradient-to-tr from-cyan-400 via-slate-900 to-rose-500 p-0.5 shrink-0">
<div class="w-full h-full rounded-full bg-slate-950 flex items-center justify-center">
<svg class="w-5 h-5 text-white" viewBox="0 0 24 24" fill="currentColor">
<path d="M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64 2.93 2.93 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 5 20.1a6.34 6.34 0 0 0 10.86-4.43v-7a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1-.1z"/>
</svg>
</div>
</div>
<div class="min-w-0">
<div class="text-xs font-extrabold text-white truncate">TikTok Chính Chủ</div>
<div class="text-[11px] text-pink-300 font-mono-code truncate">@darkwolf.divine</div>
</div>
</div>
<span class="px-2.5 py-1.5 rounded-xl bg-gradient-to-r from-cyan-500 to-rose-500 text-white text-[11px] font-bold shrink-0 group-hover:scale-105 transition">
Mở kênh
</span>
</a>
<!-- 2. ZALO: 0398787088 (Nút Copy SĐT) -->
<div class="flex items-center justify-between gap-2.5 p-2.5 rounded-2xl bg-slate-950/75 border border-white/15">
<div class="flex items-center gap-2.5 min-w-0">
<!-- Icon Zalo -->
<div class="w-10 h-10 rounded-full bg-sky-500 flex items-center justify-center font-black text-white text-xs shrink-0 shadow-md">
Zalo
</div>
<div class="min-w-0">
<div class="text-xs font-extrabold text-white">Zalo Hỗ Trợ Nhanh</div>
<div class="text-xs text-sky-300 font-mono-code font-bold">0398787088</div>
</div>
</div>
<button id="btn-copy-zalo" type="button"
class="px-2.5 py-1.5 rounded-xl bg-sky-500 hover:bg-sky-400 active:scale-95 text-white text-[11px] font-bold shrink-0 transition">
Copy SĐT
</button>
</div>
<!-- 3. DISCORD SERVER: https://discord.gg/weMRWT9pW -->
<a id="link-discord" href="https://discord.gg/weMRWT9pW" target="_blank" rel="noopener noreferrer"
class="flex items-center justify-between gap-2.5 p-2.5 rounded-2xl bg-slate-950/75 hover:bg-slate-900 border border-white/15 hover:border-indigo-400/50 transition group">
<div class="flex items-center gap-2.5 min-w-0">
<!-- Icon Discord -->
<div class="w-10 h-10 rounded-full bg-[#5865F2] flex items-center justify-center text-white shrink-0 shadow-md">
<svg class="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994.021-.041.001-.09-.041-.106a13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.028zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"/>
</svg>
</div>
<div class="min-w-0">
<div class="text-xs font-extrabold text-white truncate">Server Discord Shop</div>
<div class="text-[11px] text-indigo-300 truncate">discord.gg/weMRWT9pW</div>
</div>
</div>
<span class="px-2.5 py-1.5 rounded-xl bg-[#5865F2] text-white text-[11px] font-bold shrink-0 group-hover:scale-105 transition">
Vào SV
</span>
</a>
</div>
</div>
<!-- Nút Bong Bóng Nổi -->
<button id="btn-contact-bubble" type="button"
class="bubble-pulse px-4 py-3 rounded-full bg-gradient-to-r from-amber-400 via-orange-500 to-pink-500 text-slate-950 font-extrabold text-xs sm:text-sm shadow-2xl hover:scale-105 active:scale-95 transition flex items-center gap-2">
<span class="text-base sm:text-lg">💬</span>
<span>Liên hệ với chúng tôi</span>
</button>
</div>
<!-- ===================================================================== -->
<!-- 5. MODAL PHIẾU FORM ĐƠN ĐÃ ĐIỀN SẴN KÈM SỐ THỨ TỰ (1 - 20) -->
<!-- ===================================================================== -->
<div id="receipt-modal" class="fixed inset-0 z-50 hidden items-center justify-center p-3 sm:p-4 bg-slate-950/80 backdrop-blur-md">
<div class="w-full max-w-lg rounded-3xl bg-slate-900 border border-amber-400/40 p-4 sm:p-6 shadow-2xl max-h-[92vh] overflow-y-auto">
<div class="flex items-start justify-between gap-3 mb-3">
<div>
<span class="px-2.5 py-0.5 rounded-full bg-emerald-500/20 border border-emerald-400/40 text-emerald-300 text-[11px] font-bold">
✅ ĐĂNG KÝ ĐƠN THÀNH CÔNG
</span>
<h3 class="text-lg sm:text-xl font-black text-white mt-1">Form Đơn Hàng Đã Điền Sẵn</h3>
</div>
<button id="btn-close-receipt" type="button"
class="w-8 h-8 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center">
✕
</button>
</div>
<!-- Thẻ Số Thứ Tự Lớn + Đếm ngược hết hạn -->
<div class="rounded-2xl bg-gradient-to-r from-amber-500/20 via-purple-500/20 to-sky-500/20 border border-amber-400/45 p-3.5 mb-3.5 flex items-center justify-between gap-3">
<div>
<div class="text-[11px] uppercase tracking-wider text-amber-200 font-bold">Số Thứ Tự Đơn Của Bạn</div>
<div id="receipt-slot-number" class="text-2xl sm:text-3xl font-black text-amber-400 font-mono-code">SỐ #01 / 20</div>
</div>
<div class="text-right">
<div class="text-[11px] text-slate-300">Tự động Reset sau:</div>
<div id="receipt-countdown" class="text-sm sm:text-base font-bold text-sky-300 font-mono-code">--:--:--</div>
</div>
</div>
<!-- Nội dung Form đã điền sẵn toàn bộ lựa chọn -->
<div class="mb-3">
<div class="flex items-center justify-between mb-1.5">
<span class="text-xs font-bold text-slate-300">Nội dung Form (Đã điền đủ thông tin bạn chọn):</span>
<button id="btn-copy-receipt" type="button"
class="px-3 py-1 rounded-lg bg-amber-400 hover:bg-amber-300 active:scale-95 text-slate-950 font-extrabold text-xs transition">
📋 Copy Form
</button>
</div>
<textarea id="receipt-textarea" readonly rows="10"
class="w-full p-3 rounded-2xl bg-slate-950 border border-white/15 text-xs font-mono-code text-slate-100 leading-relaxed focus:outline-none resize-none"></textarea>
</div>
<!-- Nút gửi nhanh Form đã copy qua Zalo hoặc Discord -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2.5">
<button id="btn-receipt-zalo" type="button"
class="py-2.5 px-3.5 rounded-xl bg-sky-500 hover:bg-sky-400 active:scale-95 text-white font-bold text-xs sm:text-sm transition flex items-center justify-center gap-1.5">
<span>📲</span>
<span>Copy & Gửi Zalo (0398787088)</span>
</button>
<a id="btn-receipt-discord" href="https://discord.gg/weMRWT9pW" target="_blank" rel="noopener noreferrer"
class="py-2.5 px-3.5 rounded-xl bg-[#5865F2] hover:brightness-110 active:scale-95 text-white font-bold text-xs sm:text-sm transition flex items-center justify-center gap-1.5">
<span>🎮</span>
<span>Copy & Mở Discord Shop</span>
</a>
</div>
</div>
</div>
<!-- ===================================================================== -->
<!-- 6. MODAL QUẢN LÝ 20 SỐ THỨ TỰ (XEM CHI TIẾT & RESET SỚM) -->
<!-- ===================================================================== -->
<div id="slots-manager-modal" class="fixed inset-0 z-50 hidden items-center justify-center p-3 sm:p-4 bg-slate-950/80 backdrop-blur-md">
<div class="w-full max-w-2xl rounded-3xl bg-slate-900 border border-white/20 p-4 sm:p-6 shadow-2xl max-h-[90vh] overflow-y-auto">
<div class="flex items-center justify-between gap-3 pb-3 mb-4 border-b border-white/10">
<div>
<h3 class="text-lg font-extrabold text-white">🔢 Bảng Theo Dõi & Reset 20 Số Thứ Tự</h3>
<p class="text-xs text-slate-300">Mỗi số tự động hết hạn & Reset khi hết thời gian gói. Chủ shop có thể Reset thủ công tại đây.</p>
</div>
<button id="btn-close-slots-modal" type="button"
class="w-8 h-8 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center">
✕
</button>
</div>
<div id="slots-detail-list" class="grid grid-cols-1 sm:grid-cols-2 gap-2.5 mb-4"></div>
<div class="flex flex-wrap items-center justify-between gap-2 pt-3 border-t border-white/10">
<span class="text-[11px] text-slate-400">Bấm "Trả số" để giải phóng ngay số thứ tự cho khách mới.</span>
<button id="btn-reset-all-slots" type="button"
class="px-3.5 py-2 rounded-xl bg-rose-500/20 hover:bg-rose-500/35 border border-rose-400/40 text-rose-200 text-xs font-bold transition">
🔄 Reset toàn bộ 20 số
</button>
</div>
</div>
</div>
<!-- THÔNG BÁO NỔI (TOAST) -->
<div id="toast-banner"
class="fixed top-16 left-1/2 -translate-x-1/2 z-[60] px-4 py-2.5 rounded-full bg-slate-900/95 border border-amber-400/50 text-white text-xs sm:text-sm font-semibold shadow-2xl opacity-0 pointer-events-none transition-all duration-200 -translate-y-2 text-center max-w-[92vw]">
</div>
<!-- ===================================================================== -->
<!-- 7. JAVASCRIPT HOÀN CHỈNH (ĐƠN HÀNG 1-20 + LIÊN HỆ + NỀN CUỘN 4 MÙA) -->
<!-- ===================================================================== -->
<script>
(() => {
'use strict';
/* -------------------------------------------------------------------
PHẦN 1: DỮ LIỆU GÓI DỊCH VỤ STEAL AN EGG (STORM + PRO + CƠ BẢN)
------------------------------------------------------------------- */
const PACKAGES = [
// Gói Sự Kiện Storm & Black Market (Update 13) - Nhiệm vụ lẻ
{
id: 'storm-speed',
category: 'storm',
group: 'storm-tasks',
name: 'Mở Khóa Stormlands (150M Speed)',
price: 15000,
hours: 6,
durationLabel: '6 Tiếng',
badge: 'Update 13',
desc: 'Cày đủ mốc 150M Speed để mở khóa khu vực Stormlands mới.'
},
{
id: 'storm-stones',
category: 'storm',
group: 'storm-tasks',
name: 'Farm 1.000 Thunderstones (Skyfall)',
price: 25000,
hours: 12,
durationLabel: '12 Tiếng',
badge: 'Đập Đá',
desc: 'Tự động săn sự kiện Skyfall mỗi 30 phút gom đủ 1.000 Thunderstones.'
},
{
id: 'storm-egg',
category: 'storm',
group: 'storm-tasks',
name: 'Mở Stormy Egg + Canh Slick Rick',
price: 30000,
hours: 12,
durationLabel: '12 Tiếng',
badge: 'Chợ Đen',
desc: 'Đổi Thunderstones mở trứng Stormy (200 đá/trứng) & canh thương nhân Slick Rick.'
},
{
id: 'storm-rush',
category: 'storm',
group: 'storm-tasks',
name: 'Cày Storm Rush (Thunderous Mutation)',
price: 25000,
hours: 12,
durationLabel: '12 Tiếng',
badge: 'Đột Biến',
desc: 'Thu thập Sparks trong Storm Rush để đổi hiệu ứng Thunderous Mutation.'
},
// Gói Sự Kiện Storm & Black Market - Treo theo thời gian
{
id: 'storm-6h',
category: 'storm',
group: 'storm-time',
name: 'Treo Event Storm — 6 Tiếng',
price: 10000,
hours: 6,
durationLabel: '6 Tiếng',
badge: '6H',
desc: 'Full auto sự kiện Storm, đập đá Skyfall & canh Chợ Đen liên tục 6 tiếng.'
},
{
id: 'storm-1d',
category: 'storm',
group: 'storm-time',
name: 'Treo Event Storm — 1 Ngày',
price: 25000,
hours: 24,
durationLabel: '1 Ngày',
badge: '24H',
desc: 'Full auto sự kiện Storm 24/24, gom Thunderstones, Sparks & trứng Stormy.'
},
{
id: 'storm-3d',
category: 'storm',
group: 'storm-time',
name: 'Treo Event Storm — 3 Ngày',
price: 65000,
hours: 72,
durationLabel: '3 Ngày',
badge: '3 Ngày',
desc: 'Treo trọn vẹn chuỗi sự kiện Storm & Slick Rick 72 giờ liên tục.'
},
{
id: 'storm-7d',
category: 'storm',
group: 'storm-time',
name: 'Treo Event Storm — 7 Ngày',
price: 120000,
hours: 168,
durationLabel: '7 Ngày',
badge: '7 Ngày',
desc: 'Cày tối đa toàn bộ tài nguyên Update 13 suốt 1 tuần không nghỉ.'
},
// Gói 5 - Full AFK Pro (Cập nhật mốc Egg/s riêng từng gói theo yêu cầu)
{
id: 'pro-5h',
category: 'pro',
group: 'pro',
name: 'Gói Pro — 5 Tiếng',
price: 5000,
hours: 5,
durationLabel: '5 Tiếng',
badge: '5K',
guarantee: 'Auto câu cá + Săn cá hiếm',
desc: 'Auto câu cá 24/7, farm Money, Speed và mở Egg liên tục trong 5 tiếng.'
},
{
id: 'pro-1d',
category: 'pro',
group: 'pro',
name: 'Gói Pro — 1 Ngày (Egg > 30B/s)',
price: 20000,
hours: 24,
durationLabel: '1 Ngày',
badge: 'Egg > 30B/s',
guarantee: 'Đảm bảo Egg > 30B/s + Divine 👑',
desc: 'Auto câu cá 24/7, cam kết nhận Divine & đảm bảo mốc Egg > 30B/s.'
},
{
id: 'pro-3d',
category: 'pro',
group: 'pro',
name: 'Gói Pro — 3 Ngày (Egg > 100B/s)',
price: 60000,
hours: 72,
durationLabel: '3 Ngày',
badge: 'Egg > 100B/s',
guarantee: 'Đảm bảo Egg > 100B/s + Divine 👑',
desc: 'Auto câu cá 24/7, cam kết nhận Divine & đảm bảo mốc Egg > 100B/s.'
},
{
id: 'pro-5d',
category: 'pro',
group: 'pro',
name: 'Gói Pro — 5 Ngày (Egg > 200B/s)',
price: 80000,
hours: 120,
durationLabel: '5 Ngày',
badge: 'Egg > 200B/s',
guarantee: 'Đảm bảo Egg > 200B/s + Divine 👑',
desc: 'Auto câu cá 24/7, cam kết nhận Divine & đảm bảo mốc Egg > 200B/s.'
},
{
id: 'pro-7d',
category: 'pro',
group: 'pro',
name: 'Gói Pro — 7 Ngày (Egg > 300B/s)',
price: 100000,
hours: 168,
durationLabel: '7 Ngày',
badge: 'Egg > 300B/s',
guarantee: 'Đảm bảo Egg > 300B/s + Divine 👑',
desc: 'Gói VIP cao nhất: Cam kết nhận Divine & đảm bảo mốc Egg > 300B/s.'
},
// Gói Cày Thuê Cơ Bản
{
id: 'basic-10h',
category: 'basic',
group: 'basic',
name: 'Gói Cơ Bản — 10 Tiếng',
price: 5000,
hours: 10,
durationLabel: '10 Tiếng',
badge: '5K',
desc: 'Treo Speed, tự động nhặt trứng và làm sự kiện trong 10 tiếng.'
},
{
id: 'basic-1d',
category: 'basic',
group: 'basic',
name: 'Gói Cơ Bản — 1 Ngày',
price: 10000,
hours: 24,
durationLabel: '1 Ngày',
badge: '10K',
desc: 'Treo Speed, tự động nhặt trứng và làm sự kiện suốt 24 giờ.'
},
{
id: 'basic-3d',
category: 'basic',
group: 'basic',
name: 'Gói Cơ Bản — 3 Ngày',
price: 25000,
hours: 72,
durationLabel: '3 Ngày',
badge: '25K',
desc: 'Treo Speed, nhặt trứng và làm sự kiện liên tục 3 ngày.'
},
{
id: 'basic-7d',
category: 'basic',
group: 'basic',
name: 'Gói Cơ Bản — 7 Ngày',
price: 50000,
hours: 168,
durationLabel: '7 Ngày',
badge: '50K',
desc: 'Treo Speed, nhặt trứng và làm sự kiện trọn gói 7 ngày.'
}
];
/* -------------------------------------------------------------------
PHẦN 2: TIỆN ÍCH BỘ NHỚ AN TOÀN & THÔNG BÁO (TOAST / COPY)
------------------------------------------------------------------- */
const STORAGE_KEY = 'steal_an_egg_slots_20_v1';
let memorySlotsFallback = {};
function readSlotsStorage() {
try {
const raw = window.localStorage.getItem(STORAGE_KEY);
return raw ? JSON.parse(raw) : {};
} catch (e) {
return { ...memorySlotsFallback };
}
}
function writeSlotsStorage(data) {
memorySlotsFallback = { ...data };
try {
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
} catch (e) {
// Bỏ qua nếu trình duyệt chặn localStorage trong iframe
}
}
const toastEl = document.getElementById('toast-banner');
let toastTimeout = null;
function showToast(text) {
if (!toastEl) return;
toastEl.textContent = text;
toastEl.classList.remove('opacity-0', '-translate-y-2');
clearTimeout(toastTimeout);
toastTimeout = setTimeout(() => {
toastEl.classList.add('opacity-0', '-translate-y-2');
}, 3000);
}
function copyToClipboard(text, successMsg) {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(text).then(() => {
if (successMsg) showToast(successMsg);
}).catch(() => {
fallbackCopy(text, successMsg);
});
} else {
fallbackCopy(text, successMsg);
}
}
function fallbackCopy(text, successMsg) {
const temp = document.createElement('textarea');
temp.value = text;
temp.style.position = 'fixed';
temp.style.opacity = '0';
document.body.appendChild(temp);
temp.select();
temp.setSelectionRange(0, 99999);
try {
document.execCommand('copy');
if (successMsg) showToast(successMsg);
} catch (e) {
showToast('Hãy bôi đen và sao chép thủ công nhé!');
}
document.body.removeChild(temp);
}
function formatVND(amount) {
return amount.toLocaleString('vi-VN') + 'đ';
}
function formatDuration(hours) {
if (hours % 24 === 0) {
const days = hours / 24;
return `${days} Ngày (${hours}h)`;
}
return `${hours} Tiếng`;
}
function formatCountdown(msRemaining) {
if (msRemaining <= 0) return '00:00:00';
const totalSec = Math.floor(msRemaining / 1000);
const days = Math.floor(totalSec / 86400);
const hrs = Math.floor((totalSec % 86400) / 3600);
const mins = Math.floor((totalSec % 3600) / 60);
const secs = totalSec % 60;
const pad = (n) => String(n).padStart(2, '0');
if (days > 0) {
return `${days}d ${pad(hrs)}:${pad(mins)}:${pad(secs)}`;
}
return `${pad(hrs)}:${pad(mins)}:${pad(secs)}`;
}
function formatDateTime(ts) {
const d = new Date(ts);
const pad = (n) => String(n).padStart(2, '0');
return `${pad(d.getHours())}:${pad(d.getMinutes())} ${pad(d.getDate())}/${pad(d.getMonth() + 1)}/${d.getFullYear()}`;
}
/* -------------------------------------------------------------------
PHẦN 3: QUẢN LÝ 20 SỐ THỨ TỰ (#01 -> #20) TỰ ĐỘNG RESET KHI HẾT ĐƠN
------------------------------------------------------------------- */
function getCleanSlots() {
const slots = readSlotsStorage();
const now = Date.now();
let changed = false;
for (let i = 1; i <= 20; i++) {
const key = String(i);
if (slots[key] && now >= slots[key].expiresAt) {
delete slots[key];
changed = true;
}
}
if (changed) {
writeSlotsStorage(slots);
}
return slots;
}
function allocateNextSlot(orderPayload) {
const slots = getCleanSlots();
let chosenSlot = null;
for (let i = 1; i <= 20; i++) {
if (!slots[String(i)]) {
chosenSlot = i;
break;
}
}
if (!chosenSlot) {
return null;
}
const now = Date.now();
const durationMs = orderPayload.totalHours * 3600 * 1000;
const record = {
slotNumber: chosenSlot,
...orderPayload,
createdAt: now,
expiresAt: now + durationMs
};
slots[String(chosenSlot)] = record;
writeSlotsStorage(slots);
return record;
}
function releaseSlot(slotNum) {
const slots = getCleanSlots();
delete slots[String(slotNum)];
writeSlotsStorage(slots);
renderSlotsUI();
showToast(`✅ Đã Reset Số #${String(slotNum).padStart(2, '0')} về trạng thái Trống!`);
}
function resetAllSlots() {
writeSlotsStorage({});
renderSlotsUI();
showToast('🔄 Đã Reset toàn bộ 20 số thứ tự về trạng thái Trống!');
}
/* -------------------------------------------------------------------
PHẦN 4: HIỂN THỊ GÓI DỊCH VỤ, GIỎ HÀNG & FORM ĐƠN ĐÃ ĐIỀN SẴN
------------------------------------------------------------------- */
const selectedIds = new Set();
let activeReceiptRecord = null;
function renderPackageCards() {
const containers = {
'storm-tasks': document.getElementById('grid-storm-tasks'),
'storm-time': document.getElementById('grid-storm-time'),
'pro': document.getElementById('grid-pro'),
'basic': document.getElementById('grid-basic')
};
Object.values(containers).forEach((el) => {
if (el) el.innerHTML = '';
});
PACKAGES.forEach((pkg) => {
const target = containers[pkg.group];
if (!target) return;
const isSelected = selectedIds.has(pkg.id);
const card = document.createElement('div');
card.className = `pkg-card rounded-2xl p-3.5 flex flex-col justify-between ${isSelected ? 'selected' : ''}`;
card.setAttribute('data-pkg-id', pkg.id);
const guaranteeHtml = pkg.guarantee
? `<div class="mt-2 px-2 py-1 rounded-lg bg-amber-400/15 border border-amber-400/35 text-[11px] font-bold text-amber-300">👑 ${pkg.guarantee}</div>`
: '';
card.innerHTML = `
<div>
<div class="flex items-start justify-between gap-2 mb-1.5">
<span class="px-2 py-0.5 rounded-md bg-white/10 text-[10px] font-bold text-slate-200">${pkg.badge}</span>
<span class="w-5 h-5 rounded-full flex items-center justify-center text-xs font-bold ${isSelected ? 'bg-amber-400 text-slate-950' : 'bg-white/10 text-slate-400'}">
${isSelected ? '✓' : '+'}
</span>
</div>
<h3 class="text-xs sm:text-sm font-extrabold text-white leading-snug">${pkg.name}</h3>
<p class="text-[11px] text-slate-300 mt-1 leading-relaxed">${pkg.desc}</p>
${guaranteeHtml}
</div>
<div class="pt-3 mt-3 border-t border-white/10 flex items-center justify-between">
<span class="text-[11px] text-sky-300 font-semibold">⏱ ${pkg.durationLabel}</span>
<span class="text-sm sm:text-base font-black text-amber-400">${formatVND(pkg.price)}</span>
</div>
`;
card.addEventListener('click', () => {
if (selectedIds.has(pkg.id)) {
selectedIds.delete(pkg.id);
} else {
selectedIds.add(pkg.id);
}
renderPackageCards();
updateCartUI();
});
target.appendChild(card);
});
}
function getCartSummary() {
const items = PACKAGES.filter((p) => selectedIds.has(p.id));
const totalPrice = items.reduce((sum, p) => sum + p.price, 0);
// Thời hạn giữ số = tổng thời gian các gói đã chọn (hoặc tối thiểu bằng gói dài nhất)
const totalHours = items.reduce((sum, p) => sum + p.hours, 0);
return { items, totalPrice, totalHours };
}
function updateCartUI() {
const { items, totalPrice, totalHours } = getCartSummary();
document.getElementById('cart-count').textContent = items.length;
document.getElementById('cart-total-price').textContent = formatVND(totalPrice);
document.getElementById('cart-duration-text').textContent = totalHours > 0 ? formatDuration(totalHours) : '0 giờ';
document.getElementById('mobile-count').textContent = items.length;
document.getElementById('mobile-total').textContent = formatVND(totalPrice);
document.getElementById('mobile-duration').textContent = totalHours > 0 ? `${totalHours}h` : '0h';
const listEl = document.getElementById('cart-items-list');
if (items.length === 0) {
listEl.innerHTML = `
<div class="rounded-xl bg-slate-950/60 border border-dashed border-white/15 p-3.5 text-center text-xs text-slate-400">
Chưa chọn gói nào. Hãy bấm vào thẻ gói cày bên trái để thêm vào đơn!
</div>
`;
return;
}
listEl.innerHTML = items.map((item) => `
<div class="flex items-center justify-between gap-2 px-3 py-2 rounded-xl bg-slate-950/80 border border-white/10 text-xs">
<div class="min-w-0">
<div class="font-bold text-white truncate">${item.name}</div>
<div class="text-[11px] text-slate-400">${item.guarantee ? item.guarantee : item.durationLabel}</div>
</div>
<div class="flex items-center gap-2 shrink-0">
<span class="font-extrabold text-amber-400">${formatVND(item.price)}</span>
<button type="button" data-remove-id="${item.id}"
class="w-5 h-5 rounded-md bg-rose-500/20 hover:bg-rose-500/40 text-rose-300 flex items-center justify-center text-[11px]">
✕
</button>
</div>
</div>
`).join('');
listEl.querySelectorAll('[data-remove-id]').forEach((btn) => {
btn.addEventListener('click', (e) => {
e.stopPropagation();
const id = btn.getAttribute('data-remove-id');
selectedIds.delete(id);
renderPackageCards();
updateCartUI();
});
});
}
function buildFormattedOrderText(record) {
const slotStr = String(record.slotNumber).padStart(2, '0');
const pkgLines = record.items.map((item, idx) => {
const extra = item.guarantee ? ` [${item.guarantee}]` : '';
return ` ${idx + 1}. ${item.name}${extra} — ${formatVND(item.price)}`;
}).join('\n');
return [
`========================================`,
`🥚 ĐƠN CÀY THUÊ STEAL AN EGG — SỐ #${slotStr} / 20`,
`========================================`,
`• Số thứ tự giữ chỗ: #${slotStr} / 20 (Tự Reset sau khi hết đơn)`,
`• Tên Roblox: ${record.robloxUser}`,
`• Liên hệ khách: ${record.contact}`,
`• Hình thức giao acc: ${record.accountMode}`,
`• Thanh toán qua: ${record.payment}`,
`----------------------------------------`,
`📦 DANH SÁCH GÓI ĐÃ ĐĂNG KÝ:`,
pkgLines,
`----------------------------------------`,
`💰 TỔNG TIỀN: ${formatVND(record.totalPrice)}`,
`⏱ THỜI HẠN GÓI: ${formatDuration(record.totalHours)}`,
`🕒 Đặt lúc: ${formatDateTime(record.createdAt)}`,
`⌛ Hết hạn & Reset số lúc: ${formatDateTime(record.expiresAt)}`,
record.note ? `📝 Ghi chú: ${record.note}` : `📝 Ghi chú: Không có`,
`========================================`
].join('\n');
}
function openReceiptModal(record) {
activeReceiptRecord = record;
const slotStr = String(record.slotNumber).padStart(2, '0');
document.getElementById('receipt-slot-number').textContent = `SỐ #${slotStr} / 20`;
document.getElementById('receipt-countdown').textContent = formatCountdown(record.expiresAt - Date.now());
document.getElementById('receipt-textarea').value = buildFormattedOrderText(record);
const modal = document.getElementById('receipt-modal');
modal.classList.remove('hidden');
modal.classList.add('flex');
}
function renderSlotsUI() {
const slots = getCleanSlots();
const now = Date.now();
let freeCount = 0;
const miniGrid = document.getElementById('slots-mini-grid');
const detailList = document.getElementById('slots-detail-list');
if (miniGrid) miniGrid.innerHTML = '';
if (detailList) detailList.innerHTML = '';
for (let i = 1; i <= 20; i++) {
const numStr = String(i).padStart(2, '0');
const rec = slots[String(i)];
if (!rec) freeCount++;
// Ô nhỏ trên bảng trạng thái
if (miniGrid) {
const cell = document.createElement('button');
cell.type = 'button';
if (rec) {
const remain = formatCountdown(rec.expiresAt - now);
cell.className = 'rounded-xl p-1.5 bg-amber-500/20 border border-amber-400/50 text-center hover:bg-amber-500/30 transition';
cell.innerHTML = `
<div class="text-xs font-black text-amber-300 font-mono-code">#${numStr}</div>
<div class="text-[9px] text-amber-100 truncate font-mono-code">${remain}</div>
`;
cell.title = `Số #${numStr}: ${rec.robloxUser} (Còn ${remain})`;
cell.addEventListener('click', () => openReceiptModal(rec));
} else {
cell.className = 'rounded-xl p-1.5 bg-emerald-500/15 border border-emerald-400/35 text-center';
cell.innerHTML = `
<div class="text-xs font-extrabold text-emerald-300 font-mono-code">#${numStr}</div>
<div class="text-[9px] text-emerald-200/80">Trống</div>
`;
}
miniGrid.appendChild(cell);
}
// Thẻ chi tiết trong Modal Quản lý 20 số
if (detailList) {
const row = document.createElement('div');
if (rec) {
const remain = formatCountdown(rec.expiresAt - now);
row.className = 'rounded-2xl p-3 bg-slate-950/90 border border-amber-400/40 flex items-center justify-between gap-2';
row.innerHTML = `
<div class="min-w-0">
<div class="flex items-center gap-2">
<span class="px-2 py-0.5 rounded bg-amber-400 text-slate-950 font-black text-xs font-mono-code">#${numStr}</span>
<span class="text-xs font-bold text-white truncate">${rec.robloxUser}</span>
</div>
<div class="text-[11px] text-slate-300 mt-1 truncate">${rec.items.length} gói • ${formatVND(rec.totalPrice)}</div>
<div class="text-[11px] text-sky-300 font-mono-code">Reset sau: ${remain}</div>
</div>
<div class="flex flex-col gap-1.5 shrink-0">
<button type="button" data-view-slot="${i}" class="px-2.5 py-1 rounded-lg bg-white/10 hover:bg-white/20 text-[11px] font-semibold text-white">Xem Form</button>
<button type="button" data-free-slot="${i}" class="px-2.5 py-1 rounded-lg bg-rose-500/25 hover:bg-rose-500/40 text-[11px] font-bold text-rose-200">Trả số</button>
</div>
`;
} else {
row.className = 'rounded-2xl p-3 bg-slate-950/50 border border-white/10 flex items-center justify-between';
row.innerHTML = `
<div class="flex items-center gap-2">
<span class="px-2 py-0.5 rounded bg-emerald-500/20 text-emerald-300 font-bold text-xs font-mono-code">#${numStr}</span>
<span class="text-xs text-slate-400">Đang trống — Sẵn sàng nhận đơn</span>
</div>
`;
}
detailList.appendChild(row);
}
}
const headerFree = document.getElementById('header-free-count');
if (headerFree) headerFree.textContent = freeCount;
if (detailList) {
detailList.querySelectorAll('[data-view-slot]').forEach((btn) => {
btn.addEventListener('click', () => {
const idx = btn.getAttribute('data-view-slot');
const current = getCleanSlots()[idx];
if (current) {
document.getElementById('slots-manager-modal').classList.add('hidden');
document.getElementById('slots-manager-modal').classList.remove('flex');
openReceiptModal(current);
}
});
});
detailList.querySelectorAll('[data-free-slot]').forEach((btn) => {
btn.addEventListener('click', () => {
const idx = Number(btn.getAttribute('data-free-slot'));
releaseSlot(idx);
});
});
}
// Cập nhật đồng hồ đếm ngược nếu Modal Receipt đang mở
if (activeReceiptRecord) {
const latest = slots[String(activeReceiptRecord.slotNumber)];
const cdEl = document.getElementById('receipt-countdown');
if (latest && cdEl) {
cdEl.textContent = formatCountdown(latest.expiresAt - now);
} else if (cdEl) {
cdEl.textContent = 'ĐÃ HẾT HẠN (ĐÃ RESET)';
}
}
}
/* -------------------------------------------------------------------
PHẦN 5: GẮN SỰ KIỆN CHO TẤT CẢ NÚT BẤM & BONG BÓNG LIÊN HỆ
------------------------------------------------------------------- */
function initUIEvents() {
// Bộ lọc danh mục gói cày
document.querySelectorAll('.filter-tab').forEach((tab) => {
tab.addEventListener('click', () => {
document.querySelectorAll('.filter-tab').forEach((t) => {
t.classList.remove('active', 'bg-amber-400', 'text-slate-950');
t.classList.add('bg-slate-900/80', 'text-slate-200');
});
tab.classList.add('active', 'bg-amber-400', 'text-slate-950');
tab.classList.remove('bg-slate-900/80', 'text-slate-200');
const filter = tab.getAttribute('data-filter');
document.querySelectorAll('.pkg-section').forEach((sec) => {
if (filter === 'all' || sec.getAttribute('data-category') === filter) {
sec.classList.remove('hidden');
} else {
sec.classList.add('hidden');
}
});
});
});
// Xóa chọn giỏ hàng
document.getElementById('btn-clear-cart').addEventListener('click', () => {
selectedIds.clear();
renderPackageCards();
updateCartUI();
showToast('Đã xóa toàn bộ gói đang chọn.');
});
// Nút Đăng Ký Đơn & Nhận Form Số 1 - 20
document.getElementById('btn-submit-order').addEventListener('click', () => {
const { items, totalPrice, totalHours } = getCartSummary();
if (items.length === 0) {
showToast('⚠️ Bạn vui lòng chọn ít nhất 1 gói cày trước nhé!');
return;
}
const robloxUser = document.getElementById('input-roblox-user').value.trim();
const contact = document.getElementById('input-contact').value.trim();
const accountMode = document.getElementById('input-account-mode').value;
const payment = document.getElementById('input-payment').value;
const note = document.getElementById('input-note').value.trim();
if (!robloxUser) {
showToast('⚠️ Vui lòng nhập Tên nhân vật Roblox của bạn!');
document.getElementById('input-roblox-user').focus();
return;
}
if (!contact) {
showToast('⚠️ Vui lòng nhập SĐT Zalo, Discord hoặc Link FB để shop liên hệ!');
document.getElementById('input-contact').focus();
return;
}
const record = allocateNextSlot({
robloxUser,
contact,
accountMode,
payment,
note,
items,
totalPrice,
totalHours
});
if (!record) {
showToast('⚠️ Hiện đã kín cả 20/20 số thứ tự! Vui lòng liên hệ Zalo/Discord shop.');
return;
}
renderSlotsUI();
openReceiptModal(record);
showToast(`🎉 Tạo đơn thành công! Bạn được cấp SỐ #${String(record.slotNumber).padStart(2, '0')} / 20`);
});
// Modal Form Đơn Hàng
const receiptModal = document.getElementById('receipt-modal');
document.getElementById('btn-close-receipt').addEventListener('click', () => {
receiptModal.classList.add('hidden');
receiptModal.classList.remove('flex');
});
receiptModal.addEventListener('click', (e) => {
if (e.target === receiptModal) {
receiptModal.classList.add('hidden');
receiptModal.classList.remove('flex');
}
});
document.getElementById('btn-copy-receipt').addEventListener('click', () => {
const txt = document.getElementById('receipt-textarea').value;
copyToClipboard(txt, '📋 Đã sao chép Form đơn hàng!');
});
document.getElementById('btn-receipt-zalo').addEventListener('click', () => {
const txt = document.getElementById('receipt-textarea').value;
copyToClipboard(txt, '📋 Đã Copy Form & SĐT Zalo 0398787088! Hãy dán gửi cho shop nhé.');
});
document.getElementById('btn-receipt-discord').addEventListener('click', () => {
const txt = document.getElementById('receipt-textarea').value;
copyToClipboard(txt, '📋 Đã Copy Form! Đang mở Server Discord của shop...');
});
// Modal Quản lý 20 Số Thứ Tự
const slotsModal = document.getElementById('slots-manager-modal');
document.getElementById('btn-open-slots-modal').addEventListener('click', () => {
renderSlotsUI();
slotsModal.classList.remove('hidden');
slotsModal.classList.add('flex');
});
document.getElementById('btn-close-slots-modal').addEventListener('click', () => {
slotsModal.classList.add('hidden');
slotsModal.classList.remove('flex');
});
slotsModal.addEventListener('click', (e) => {
if (e.target === slotsModal) {
slotsModal.classList.add('hidden');
slotsModal.classList.remove('flex');
}
});
document.getElementById('btn-reset-all-slots').addEventListener('click', resetAllSlots);
// Bong bóng Liên hệ với chúng tôi
const contactPopup = document.getElementById('contact-popup');
const toggleContactPopup = (forceOpen) => {
const isHidden = contactPopup.classList.contains('hidden');
const shouldOpen = typeof forceOpen === 'boolean' ? forceOpen : isHidden;
if (shouldOpen) {
contactPopup.classList.remove('hidden');
} else {
contactPopup.classList.add('hidden');
}
};
document.getElementById('btn-contact-bubble').addEventListener('click', () => toggleContactPopup());
document.getElementById('btn-hero-contact').addEventListener('click', () => toggleContactPopup(true));
document.getElementById('btn-close-contact').addEventListener('click', () => toggleContactPopup(false));
// Copy SĐT Zalo 0398787088
document.getElementById('btn-copy-zalo').addEventListener('click', () => {
copyToClipboard('0398787088', '✅ Đã copy SĐT Zalo: 0398787088');
});
// TikTok & Discord backup thông báo + copy link phòng khi sandbox chặn mở tab mới
document.getElementById('link-tiktok').addEventListener('click', () => {
copyToClipboard('https://www.tiktok.com/@darkwolf.divine', '🎵 Đang mở TikTok @darkwolf.divine (Đã copy link dự phòng)');
});
document.getElementById('link-discord').addEventListener('click', () => {
copyToClipboard('https://discord.gg/weMRWT9pW', '🎮 Đang mở Discord Server (Đã copy link dự phòng)');
});
// Nút Ngắm nền 4 mùa
const btnRestoreUI = document.getElementById('btn-restore-ui');
document.getElementById('btn-toggle-scenery').addEventListener('click', () => {
document.body.classList.add('scenery-only');
btnRestoreUI.classList.remove('hidden');
showToast('Đang bật chế độ ngắm toàn cảnh 4 mùa — Cuộn trang để đổi mùa!');
});
btnRestoreUI.addEventListener('click', () => {
document.body.classList.remove('scenery-only');
btnRestoreUI.classList.add('hidden');
});
}
/* -------------------------------------------------------------------
PHẦN 6: ĐỘNG CƠ NỀN CUỘN PHONG CẢNH 4 MÙA (TỰ KHỚP ĐỘ DÀI TRANG)
------------------------------------------------------------------- */
const SEASONS_META = [
{ subtitle: 'Xuân Khởi Sắc', icon: '🌸' },
{ subtitle: 'Hạ Nắng Rực', icon: '☀️' },
{ subtitle: 'Thu Hoàng Hôn', icon: '🍂' },
{ subtitle: 'Đông Tuyết Trắng', icon: '❄️' }
];
const WORLD_W = 2280;
const WORLD_H = 1280;
const bgState = {
width: window.innerWidth,
height: window.innerHeight,
dpr: Math.min(window.devicePixelRatio || 1, 2),
targetScroll: 0,
currentScroll: 0,
time: 0,
pointerX: 0,
pointerY: 0,
smoothPointerX: 0,
smoothPointerY: 0
};
const clamp = (v, min, max) => Math.max(min, Math.min(max, v));
const lerp = (a, b, t) => a + (b - a) * t;
const smoothstep = (e0, e1, x) => {
const t = clamp((x - e0) / (e1 - e0), 0, 1);
return t * t * (3 - 2 * t);
};
const seasonWeight = (seasonT, idx, radius = 0.85) => smoothstep(radius, 0, Math.abs(seasonT - idx));
function hexToRgb(hex) {
const num = parseInt(hex.replace('#', ''), 16);
return [(num >> 16) & 255, (num >> 8) & 255, num & 255];
}
function samplePalette(palRgb, seasonT, alpha = 1) {
const idx = Math.floor(clamp(seasonT, 0, 2.9999));
const frac = clamp(seasonT - idx, 0, 1);
const c1 = palRgb[idx];
const c2 = palRgb[idx + 1];
const r = Math.round(lerp(c1[0], c2[0], frac));
const g = Math.round(lerp(c1[1], c2[1], frac));
const b = Math.round(lerp(c1[2], c2[2], frac));
return alpha >= 0.999 ? `rgb(${r},${g},${b})` : `rgba(${r},${g},${b},${alpha})`;
}
function mulberry32(seed) {
let a = seed;
return function () {
let t = (a += 0x6d2b79f5);
t = Math.imul(t ^ (t >>> 15), t | 1);
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
const rng = mulberry32(202604);
const PAL = {
skyTop: ['#4db7f0', '#1888e8', '#4d5d8c', '#5f7691'].map(hexToRgb),
skyMid: ['#8fd8fb', '#5dc0f8', '#dd8554', '#9cb2c8'].map(hexToRgb),
skyHorizon: ['#dff7ff', '#c9f0ff', '#ffda8c', '#dce7f2'].map(hexToRgb),
sunColor: ['#fff9db', '#fff5b8', '#ffad54', '#eef6ff'].map(hexToRgb),
cloudFill: ['#ffffff', '#ffffff', '#ffe0b8', '#e5eef6'].map(hexToRgb),
cloudShade: ['#c8e5f7', '#b6dbf5', '#d08b69', '#b2c4d6'].map(hexToRgb),
farMtn: ['#8bb5c9', '#67a5c2', '#9d7c79', '#8fa5bc'].map(hexToRgb),
farMtnLight: ['#bdd9e6', '#94c5db', '#d6a488', '#d9e7f3'].map(hexToRgb),
midMtn: ['#5fa382', '#38876d', '#8c5f4e', '#7c94ad'].map(hexToRgb),
midMtnLight: ['#8cc9a1', '#5eb089', '#c78552', '#c8daea'].map(hexToRgb),
nearHill: ['#5ca84f', '#358940', '#a9622e', '#d6e3ef'].map(hexToRgb),
pineColor: ['#2e6e50', '#1f5b40', '#5a4939', '#4c677d'].map(hexToRgb),
waterTop: ['#69c5e3', '#39a7d6', '#e3a574', '#86a6be'].map(hexToRgb),
waterBot: ['#3c8db5', '#1d6f9e', '#88686d', '#5c7c96'].map(hexToRgb),
meadowBack: ['#79c84c', '#4ca637', '#c77f34', '#e3edf7'].map(hexToRgb),
meadowFront: ['#5cb037', '#2f822b', '#9c5a22', '#eff5fb'].map(hexToRgb),
pathColor: ['#d9c398', '#cbb283', '#b88652', '#d7e3ef'].map(hexToRgb),
pathEdge: ['#b69d70', '#a68c5f', '#8e6238', '#bacadd'].map(hexToRgb),
oakLeafDark: ['#4e9d36', '#1e6e2c', '#9e2e19', '#8aa0b5'].map(hexToRgb),
oakLeafMid: ['#75c247', '#359339', '#d85b1b', '#c6d6e6'].map(hexToRgb),
oakLeafLight: ['#a9e062', '#64bd47', '#f7a528', '#eef6fc'].map(hexToRgb),
trunkDark: ['#4a3525', '#443022', '#472f21', '#3b3c44'].map(hexToRgb),
trunkLight: ['#76583e', '#6d5039', '#754e35', '#686e7a'].map(hexToRgb),
cabinWall: ['#92704e', '#896745', '#7f593b', '#6d625a'].map(hexToRgb),
cabinShade: ['#664b33', '#5f442d', '#593b25', '#4c4643'].map(hexToRgb),
cabinRoof: ['#594a3f', '#4e4238', '#523b30', '#edf5fc'].map(hexToRgb)
};
const STARS = Array.from({ length: 80 }, () => ({
x: rng() * WORLD_W,
y: rng() * 440,
r: 0.9 + rng() * 1.8,
phase: rng() * Math.PI * 2
}));
const CLOUDS = [
{ x: 180, y: 165, s: 1.15, sp: 5.5, layer: 0 },
{ x: 640, y: 120, s: 1.35, sp: 4.0, layer: 0 },
{ x: 1250, y: 155, s: 1.05, sp: 6.2, layer: 1 },
{ x: 1760, y: 115, s: 1.4, sp: 4.6, layer: 0 },
{ x: 2120, y: 190, s: 0.95, sp: 7.0, layer: 1 }
];
const DISTANT_PINES = Array.from({ length: 46 }, (_, i) => ({
x: 60 + i * 33 + (rng() - 0.5) * 16,
y: 668 + Math.sin(i * 0.25) * 10,
h: 34 + rng() * 40,
w: 14 + rng() * 13
}));
const SPRING_FLOWERS = Array.from({ length: 120 }, () => {
const palette = ['#ffd84d', '#ffffff', '#c580ff', '#ff85b3', '#ffe57f'];
return {
x: 160 + rng() * 1950,
y: 830 + rng() * 420,
r: 2.5 + rng() * 3.6,
color: palette[Math.floor(rng() * palette.length)],
phase: rng() * Math.PI * 2
};
});
const FALLEN_LEAVES = Array.from({ length: 125 }, () => {
const colors = ['#d94e1f', '#f08c1e', '#f5bc38', '#a82b18', '#e66e22'];
return {
x: 300 + rng() * 1750,
y: 810 + rng() * 430,
rx: 4 + rng() * 4.5,
ry: 2 + rng() * 2.2,
rot: rng() * Math.PI,
color: colors[Math.floor(rng() * colors.length)]
};
});
const OAK_CLUSTERS = [
{ dx: -175, dy: -220, r: 92, tier: 0 }, { dx: -95, dy: -285, r: 105, tier: 0 },
{ dx: 10, dy: -310, r: 112, tier: 0 }, { dx: 120, dy: -275, r: 100, tier: 0 },
{ dx: 190, dy: -205, r: 88, tier: 0 }, { dx: -220, dy: -145, r: 78, tier: 0 },
{ dx: 225, dy: -135, r: 75, tier: 0 }, { dx: -155, dy: -200, r: 80, tier: 1 },
{ dx: -70, dy: -255, r: 94, tier: 1 }, { dx: 35, dy: -280, r: 96, tier: 1 },
{ dx: 130, dy: -235, r: 86, tier: 1 }, { dx: -30, dy: -175, r: 84, tier: 1 },
{ dx: 95, dy: -165, r: 78, tier: 1 }, { dx: -120, dy: -245, r: 58, tier: 2 },
{ dx: -15, dy: -298, r: 66, tier: 2 }, { dx: 85, dy: -275, r: 62, tier: 2 },
{ dx: 165, dy: -215, r: 52, tier: 2 }, { dx: 45, dy: -210, r: 56, tier: 2 }
];
const PARTICLES = Array.from({ length: 85 }, () => ({
x: rng(),
y: rng(),
size: 2.5 + rng() * 5.2,
speedY: 0.035 + rng() * 0.07,
speedX: -0.015 + rng() * 0.03,
phase: rng() * Math.PI * 2,
rot: rng() * Math.PI * 2,
rotSpeed: (rng() - 0.5) * 2.2,
depth: 0.4 + rng() * 0.8,
variant: Math.floor(rng() * 4)
}));
const sceneCanvas = document.getElementById('scene-canvas');
const sceneCtx = sceneCanvas.getContext('2d');
const particleCanvas = document.getElementById('particle-canvas');
const particleCtx = particleCanvas.getContext('2d');
function resizeCanvases() {
bgState.width = window.innerWidth;
bgState.height = window.innerHeight;
bgState.dpr = Math.min(window.devicePixelRatio || 1, 2);
[sceneCanvas, particleCanvas].forEach((canvas) => {
canvas.width = Math.round(bgState.width * bgState.dpr);
canvas.height = Math.round(bgState.height * bgState.dpr);
canvas.style.width = `${bgState.width}px`;
canvas.style.height = `${bgState.height}px`;
});
sceneCtx.setTransform(bgState.dpr, 0, 0, bgState.dpr, 0, 0);
particleCtx.setTransform(bgState.dpr, 0, 0, bgState.dpr, 0, 0);
}
function renderScene(seasonT, t) {
const ctx = sceneCtx;
const w = bgState.width;
const h = bgState.height;
ctx.clearRect(0, 0, w, h);
const isPortrait = h > w * 1.05;
const baseScale = isPortrait ? Math.max(w / 1480, h / 1450) : Math.max(w / WORLD_W, h / WORLD_H);
const scale = baseScale * (1 + bgState.currentScroll * 0.035);
const focusX = isPortrait ? 1165 : WORLD_W * 0.5;
const focusY = isPortrait ? 730 : WORLD_H * 0.54;
const offsetX = w * 0.5 - focusX * scale - bgState.smoothPointerX * 14;
const offsetY = h * 0.5 - focusY * scale - bgState.smoothPointerY * 8;
const viewRect = {
left: (-offsetX) / scale - 60,
top: (-offsetY) / scale - 60,
right: (w - offsetX) / scale + 60,
bottom: (h - offsetY) / scale + 60
};
viewRect.width = viewRect.right - viewRect.left;
viewRect.height = viewRect.bottom - viewRect.top;
ctx.save();
ctx.translate(offsetX, offsetY);
ctx.scale(scale, scale);
const px = bgState.smoothPointerX;
const winterW = seasonWeight(seasonT, 3, 0.9);
// 1. Bầu trời
const grad = ctx.createLinearGradient(0, viewRect.top, 0, 740);
grad.addColorStop(0, samplePalette(PAL.skyTop, seasonT));
grad.addColorStop(0.55, samplePalette(PAL.skyMid, seasonT));
grad.addColorStop(1, samplePalette(PAL.skyHorizon, seasonT));
ctx.fillStyle = grad;
ctx.fillRect(viewRect.left, viewRect.top, viewRect.width, 760 - viewRect.top);
if (winterW > 0.02) {
STARS.forEach((st) => {
const twinkle = 0.45 + 0.55 * Math.sin(t * 1.9 + st.phase);
ctx.fillStyle = `rgba(240,248,255,${winterW * twinkle * 0.72})`;
ctx.beginPath();
ctx.arc(st.x, st.y - 60, st.r, 0, Math.PI * 2);
ctx.fill();
});
}
// Mặt trời
const sunX = lerp(470, 390, clamp(seasonT / 3, 0, 1));
const sunY = seasonT < 1 ? lerp(255, 200, seasonT) : seasonT < 2 ? lerp(200, 505, seasonT - 1) : lerp(505, 315, seasonT - 2);
const sunR = seasonT > 1.3 && seasonT < 2.6 ? 68 : 48;
const halo = ctx.createRadialGradient(sunX, sunY, sunR * 0.2, sunX, sunY, sunR * 5.2);
halo.addColorStop(0, samplePalette(PAL.sunColor, seasonT, 0.95));
halo.addColorStop(0.28, samplePalette(PAL.sunColor, seasonT, 0.42));
halo.addColorStop(1, samplePalette(PAL.sunColor, seasonT, 0));
ctx.fillStyle = halo;
ctx.beginPath();
ctx.arc(sunX, sunY, sunR * 5.2, 0, Math.PI * 2);
ctx.fill();
// 2. Mây
const fillCol = samplePalette(PAL.cloudFill, seasonT, 0.92);
const shadeCol = samplePalette(PAL.cloudShade, seasonT, 0.65);
CLOUDS.forEach((c) => {
const cx = ((c.x + t * c.sp + px * (c.layer === 0 ? 12 : 24)) % (WORLD_W + 460)) - 230;
ctx.save();
ctx.translate(cx, c.y);
ctx.scale(c.s, c.s);
ctx.fillStyle = shadeCol;
ctx.beginPath();
ctx.ellipse(0, 14, 92, 22, 0, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = fillCol;
[[-58, 6, 30], [-25, -10, 42], [22, -14, 46], [62, 4, 32], [0, 8, 38]].forEach(([x, y, r]) => {
ctx.beginPath();
ctx.arc(x, y, r, 0, Math.PI * 2);
ctx.fill();
});
ctx.restore();
});
// 3. Núi xa & rừng thông
const snowCapAlpha = clamp(seasonWeight(seasonT, 0, 0.95) * 0.85 + seasonWeight(seasonT, 1, 0.6) * 0.12 + winterW, 0, 1);
ctx.save();
ctx.translate(px * 8, 0);
const farPeaks = [[-120, 690], [180, 465], [420, 560], [670, 415], [920, 535], [1160, 455], [1480, 575], [1780, 435], [2080, 520], [2420, 690]];
ctx.fillStyle = samplePalette(PAL.farMtn, seasonT);
ctx.beginPath();
ctx.moveTo(-160, 720);
farPeaks.forEach(([x, y]) => ctx.lineTo(x, y));
ctx.lineTo(2460, 720);
ctx.closePath();
ctx.fill();
for (let i = 1; i < farPeaks.length - 1; i += 2) {
const [px0, py0] = farPeaks[i - 1];
const [px1, py1] = farPeaks[i];
ctx.fillStyle = samplePalette(PAL.farMtnLight, seasonT, 0.55);
ctx.beginPath();
ctx.moveTo(px0, py0);
ctx.lineTo(px1, py1);
ctx.lineTo(px1 - 35, 695);
ctx.closePath();
ctx.fill();
if (snowCapAlpha > 0.05) {
ctx.fillStyle = `rgba(246,251,255,${snowCapAlpha * 0.92})`;
ctx.beginPath();
ctx.moveTo(px1, py1);
ctx.lineTo(px1 - 68, py1 + 58);
ctx.lineTo(px1 - 24, py1 + 42);
ctx.lineTo(px1 + 5, py1 + 60);
ctx.lineTo(px1 + 30, py1 + 45);
ctx.lineTo(px1 + 68, py1 + 62);
ctx.closePath();
ctx.fill();
}
}
ctx.restore();
// Núi trung cảnh & thông
ctx.save();
ctx.translate(px * 15, 0);
ctx.fillStyle = samplePalette(PAL.midMtn, seasonT);
ctx.beginPath();
ctx.moveTo(-150, 720);
ctx.bezierCurveTo(140, 520, 380, 540, 620, 645);
ctx.bezierCurveTo(840, 545, 1140, 570, 1460, 665);
ctx.bezierCurveTo(1750, 520, 2060, 490, 2430, 680);
ctx.lineTo(2430, 740);
ctx.lineTo(-150, 740);
ctx.closePath();
ctx.fill();
const pineBase = samplePalette(PAL.pineColor, seasonT);
DISTANT_PINES.forEach((p) => {
ctx.fillStyle = pineBase;
ctx.beginPath();
ctx.moveTo(p.x, p.y - p.h);
ctx.lineTo(p.x - p.w * 0.55, p.y);
ctx.lineTo(p.x + p.w * 0.55, p.y);
ctx.closePath();
ctx.fill();
});
ctx.restore();
// 4. Mặt hồ
const lakeGrad = ctx.createLinearGradient(0, 665, 0, 1020);
lakeGrad.addColorStop(0, samplePalette(PAL.waterTop, seasonT));
lakeGrad.addColorStop(1, samplePalette(PAL.waterBot, seasonT));
ctx.fillStyle = lakeGrad;
ctx.fillRect(-100, 665, 1650, 380);
for (let i = 0; i < 14; i++) {
const y = 682 + i * 16;
const rw = (140 - i * 5) + Math.sin(t * 2.1 + i * 1.3) * 16;
const offset = Math.sin(t * 1.4 + i * 0.9) * 14;
ctx.fillStyle = samplePalette(PAL.sunColor, seasonT, 0.26 - i * 0.012);
ctx.beginPath();
ctx.ellipse(sunX + offset, y, Math.max(12, rw), 2.8, 0, 0, Math.PI * 2);
ctx.fill();
}
// 5. Đồi cỏ & lối mòn
ctx.fillStyle = samplePalette(PAL.nearHill, seasonT);
ctx.beginPath();
ctx.moveTo(980, 750);
ctx.bezierCurveTo(1320, 635, 1780, 585, 2420, 665);
ctx.lineTo(2420, 920);
ctx.lineTo(980, 920);
ctx.closePath();
ctx.fill();
const meadowGrad = ctx.createLinearGradient(0, 745, 0, viewRect.bottom);
meadowGrad.addColorStop(0, samplePalette(PAL.meadowBack, seasonT));
meadowGrad.addColorStop(1, samplePalette(PAL.meadowFront, seasonT));
ctx.fillStyle = meadowGrad;
ctx.beginPath();
ctx.moveTo(-120, 905);
ctx.bezierCurveTo(220, 865, 580, 855, 840, 825);
ctx.bezierCurveTo(1010, 805, 1140, 752, 1340, 738);
ctx.bezierCurveTo(1660, 715, 2020, 725, 2440, 770);
ctx.lineTo(2440, viewRect.bottom + 80);
ctx.lineTo(-120, viewRect.bottom + 80);
ctx.closePath();
ctx.fill();
// Lối mòn chính
ctx.fillStyle = samplePalette(PAL.pathColor, seasonT, 0.88);
ctx.beginPath();
ctx.moveTo(1290, 865);
ctx.bezierCurveTo(1275, 935, 1490, 995, 1620, 1105);
ctx.bezierCurveTo(1705, 1178, 1760, 1245, 1810, 1330);
ctx.lineTo(1570, 1330);
ctx.bezierCurveTo(1525, 1225, 1460, 1140, 1355, 1055);
ctx.bezierCurveTo(1220, 955, 1190, 905, 1220, 862);
ctx.closePath();
ctx.fill();
// 6. Cây sồi cổ thụ
const baseX = 1040;
const baseY = 825;
const wind = Math.sin(t * 1.25) * 4.5;
ctx.fillStyle = samplePalette(PAL.trunkDark, seasonT);
ctx.beginPath();
ctx.moveTo(baseX - 72, baseY + 12);
ctx.bezierCurveTo(baseX - 38, baseY - 25, baseX - 32, baseY - 125, baseX - 36, baseY - 220);
ctx.lineTo(baseX + 36, baseY - 220);
ctx.bezierCurveTo(baseX + 34, baseY - 120, baseX + 42, baseY - 25, baseX + 78, baseY + 12);
ctx.closePath();
ctx.fill();
const foliageAlpha = 1 - smoothstep(2.15, 2.88, seasonT);
if (foliageAlpha > 0.02) {
ctx.save();
ctx.globalAlpha = foliageAlpha;
const colors = [
samplePalette(PAL.oakLeafDark, seasonT),
samplePalette(PAL.oakLeafMid, seasonT),
samplePalette(PAL.oakLeafLight, seasonT)
];
OAK_CLUSTERS.forEach((cl, idx) => {
const sway = Math.sin(t * 1.5 + idx * 0.7) * 3.5 + wind * 0.4;
ctx.fillStyle = colors[cl.tier];
ctx.beginPath();
ctx.arc(baseX + cl.dx + sway, baseY - 95 + cl.dy, cl.r, 0, Math.PI * 2);
ctx.fill();
});
ctx.restore();
}
// 7. Ngôi nhà gỗ & ánh đèn mùa đông
const cx = 1365;
const cy = 855;
const glowW = clamp(seasonWeight(seasonT, 2, 0.7) * 0.45 + winterW, 0, 1);
// Khói bếp
const smokeAlpha = 0.28 + seasonWeight(seasonT, 2, 0.9) * 0.22 + winterW * 0.35;
for (let i = 0; i < 7; i++) {
const progress = ((t * 0.28 + i / 7) % 1);
const sx = cx + 110 + Math.sin(progress * 5 + t) * 18 + progress * 48;
const sy = cy - 235 - progress * 155;
ctx.fillStyle = `rgba(245,248,252,${(1 - progress) * smokeAlpha})`;
ctx.beginPath();
ctx.arc(sx, sy, 8 + progress * 24, 0, Math.PI * 2);
ctx.fill();
}
ctx.fillStyle = '#6f6965';
ctx.fillRect(cx + 96, cy - 232, 28, 72);
ctx.fillStyle = samplePalette(PAL.cabinWall, seasonT);
ctx.beginPath();
ctx.moveTo(cx - 125, cy);
ctx.lineTo(cx - 125, cy - 125);
ctx.lineTo(cx, cy - 220);
ctx.lineTo(cx + 125, cy - 125);
ctx.lineTo(cx + 125, cy);
ctx.closePath();
ctx.fill();
// Cửa chính & cửa sổ
ctx.fillStyle = '#5a3d27';
ctx.fillRect(cx - 86, cy - 92, 50, 92);
ctx.fillStyle = glowW > 0.1 ? `rgba(255,214,102,${0.45 + glowW * 0.55})` : '#46677d';
ctx.fillRect(cx + 22, cy - 86, 48, 44);
ctx.fillRect(cx - 17, cy - 178, 34, 34);
ctx.fillStyle = samplePalette(PAL.cabinRoof, seasonT);
ctx.beginPath();
ctx.moveTo(cx - 148, cy - 116);
ctx.lineTo(cx, cy - 234);
ctx.lineTo(cx + 148, cy - 116);
ctx.lineTo(cx + 132, cy - 106);
ctx.lineTo(cx, cy - 212);
ctx.lineTo(cx - 132, cy - 106);
ctx.closePath();
ctx.fill();
if (winterW > 0.08) {
ctx.fillStyle = `rgba(246,251,255,${winterW})`;
ctx.beginPath();
ctx.moveTo(cx - 152, cy - 116);
ctx.lineTo(cx, cy - 240);
ctx.lineTo(cx + 152, cy - 116);
ctx.bezierCurveTo(cx + 120, cy - 104, cx + 60, cy - 148, cx, cy - 218);
ctx.bezierCurveTo(cx - 60, cy - 148, cx - 120, cy - 104, cx - 152, cy - 116);
ctx.closePath();
ctx.fill();
}
// 8. Chi tiết đặc trưng từng mùa (Anh đào Xuân / Thuyền Hạ / Hươu Thu / Người tuyết Đông)
const wSpring = seasonWeight(seasonT, 0, 0.9);
if (wSpring > 0.02) {
ctx.save();
ctx.globalAlpha = wSpring;
SPRING_FLOWERS.forEach((f) => {
ctx.fillStyle = f.color;
ctx.beginPath();
ctx.arc(f.x + Math.sin(t * 1.7 + f.phase) * 2, f.y, f.r, 0, Math.PI * 2);
ctx.fill();
});
ctx.restore();
}
const wAutumn = seasonWeight(seasonT, 2, 0.9);
if (wAutumn > 0.02) {
ctx.save();
ctx.globalAlpha = wAutumn;
FALLEN_LEAVES.forEach((lf) => {
ctx.save();
ctx.translate(lf.x, lf.y);
ctx.rotate(lf.rot);
ctx.fillStyle = lf.color;
ctx.beginPath();
ctx.ellipse(0, 0, lf.rx, lf.ry, 0, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
});
ctx.restore();
}
if (winterW > 0.05) {
ctx.save();
ctx.globalAlpha = winterW;
const sx = 1438;
const sy = 895;
ctx.fillStyle = '#ffffff';
ctx.beginPath();
ctx.arc(sx, sy - 20, 26, 0, Math.PI * 2);
ctx.arc(sx, sy - 54, 19, 0, Math.PI * 2);
ctx.arc(sx, sy - 82, 14, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = '#dc2626';
ctx.fillRect(sx - 13, sy - 70, 26, 6);
ctx.restore();
}
ctx.restore();
}
function renderParticles(seasonT, dt, t) {
const ctx = particleCtx;
const w = bgState.width;
const h = bgState.height;
ctx.clearRect(0, 0, w, h);
const wSpring = seasonWeight(seasonT, 0, 0.85);
const wSummer = seasonWeight(seasonT, 1, 0.85);
const wAutumn = seasonWeight(seasonT, 2, 0.85);
const wWinter = seasonWeight(seasonT, 3, 0.9);
PARTICLES.forEach((p, idx) => {
const dirY = wSummer > 0.55 ? -0.35 : 1;
p.y += p.speedY * dirY * p.depth * dt;
p.x += (p.speedX + Math.sin(t * 1.1 + p.phase) * 0.015) * p.depth * dt;
p.rot += p.rotSpeed * dt;
if (p.y > 1.05) { p.y = -0.05; p.x = rng(); }
if (p.y < -0.05) { p.y = 1.05; p.x = rng(); }
if (p.x > 1.05) p.x = -0.05;
if (p.x < -0.05) p.x = 1.05;
const px = p.x * w;
const py = p.y * h;
if (wSpring > 0.04 && idx % 2 === 0) {
ctx.save();
ctx.translate(px, py);
ctx.rotate(p.rot);
ctx.fillStyle = `rgba(255,192,220,${wSpring * 0.85})`;
ctx.beginPath();
ctx.ellipse(0, 0, p.size * 0.95, p.size * 0.52, 0, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
}
if (wSummer > 0.04 && idx % 2 === 1) {
const pulse = 0.4 + 0.6 * Math.sin(t * 3 + p.phase);
ctx.fillStyle = `rgba(255,248,175,${wSummer * pulse * 0.8})`;
ctx.beginPath();
ctx.arc(px, py, p.size * 0.75, 0, Math.PI * 2);
ctx.fill();
}
if (wAutumn > 0.04 && idx % 2 === 0) {
const leafCols = ['#e11d48', '#ea580c', '#f59e0b', '#b45309'];
ctx.save();
ctx.translate(px, py);
ctx.rotate(p.rot);
ctx.globalAlpha = wAutumn * 0.9;
ctx.fillStyle = leafCols[p.variant];
ctx.beginPath();
ctx.ellipse(0, 0, p.size, p.size * 0.55, 0, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
}
if (wWinter > 0.04) {
ctx.fillStyle = `rgba(255,255,255,${wWinter * (0.45 + p.depth * 0.45)})`;
ctx.beginPath();
ctx.arc(px, py, p.size * 0.58 * p.depth, 0, Math.PI * 2);
ctx.fill();
}
});
}
// Tự động tính tỷ lệ cuộn khớp 100% với chiều cao thực tế của trang web
function computeTargetScroll() {
const doc = document.documentElement;
const body = document.body;
const fullHeight = Math.max(doc.scrollHeight, body.scrollHeight);
const maxScroll = Math.max(1, fullHeight - window.innerHeight);
bgState.targetScroll = clamp(window.scrollY / maxScroll, 0, 1);
}
let lastSeasonBadgeIdx = -1;
const seasonBadgeIcon = document.getElementById('season-badge-icon');
const seasonBadgeText = document.getElementById('season-badge-text');
function updateSeasonBadge(seasonT) {
const idx = clamp(Math.round(seasonT), 0, 3);
if (idx !== lastSeasonBadgeIdx) {
lastSeasonBadgeIdx = idx;
if (seasonBadgeIcon) seasonBadgeIcon.textContent = SEASONS_META[idx].icon;
if (seasonBadgeText) seasonBadgeText.textContent = SEASONS_META[idx].subtitle;
}
}
window.addEventListener('scroll', computeTargetScroll, { passive: true });
window.addEventListener('resize', () => {
resizeCanvases();
computeTargetScroll();
});
window.addEventListener('mousemove', (e) => {
bgState.pointerX = (e.clientX / Math.max(1, bgState.width) - 0.5) * 2;
bgState.pointerY = (e.clientY / Math.max(1, bgState.height) - 0.5) * 2;
}, { passive: true });
if (typeof ResizeObserver !== 'undefined') {
const ro = new ResizeObserver(() => computeTargetScroll());
ro.observe(document.body);
}
let lastFrameTime = performance.now();
function animationLoop(now) {
const dt = Math.min(0.05, Math.max(0.001, (now - lastFrameTime) / 1000));
lastFrameTime = now;
bgState.time += dt;
bgState.currentScroll += (bgState.targetScroll - bgState.currentScroll) * Math.min(1, dt * 8.5);
bgState.smoothPointerX += (bgState.pointerX - bgState.smoothPointerX) * Math.min(1, dt * 4);
bgState.smoothPointerY += (bgState.pointerY - bgState.smoothPointerY) * Math.min(1, dt * 4);
const seasonT = clamp(bgState.currentScroll * 3, 0, 3);
renderScene(seasonT, bgState.time);
renderParticles(seasonT, dt, bgState.time);
updateSeasonBadge(seasonT);
requestAnimationFrame(animationLoop);
}
/* -------------------------------------------------------------------
PHẦN 7: KHỞI CHẠY TOÀN BỘ HỆ THỐNG
------------------------------------------------------------------- */
function bootstrap() {
resizeCanvases();
computeTargetScroll();
bgState.currentScroll = bgState.targetScroll;
renderPackageCards();
updateCartUI();
renderSlotsUI();
initUIEvents();
// Cập nhật đếm ngược 20 số thứ tự & tự động Reset khi hết hạn mỗi giây
setInterval(renderSlotsUI, 1000);
lastFrameTime = performance.now();
requestAnimationFrame(animationLoop);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', bootstrap);
} else {
bootstrap();
}
})();
</script>
</body>
</html>