/* --- QR & SPINNER --- */
#qr-result { margin-top: 25px; display: none; }
#canvas-container { margin-top: 10px; background: #fff; display: inline-block; padding: 8px; border-radius: 12px; border: 1px solid var(--tuyet-border-light); }
#qrcode, #qr-canvas-holder { position: absolute; left: 0; top: 0; z-index: -100; opacity: 0.01; pointer-events: none; }

.wheel-container { text-align: center; margin: 25px 0; position: relative; }
#spinning-wheel { width: 260px; height: 260px; margin: 0 auto; border-radius: 50%; background: conic-gradient(#ffffff 0deg 45deg, #e2e8f0 45deg 90deg, #ffffff 90deg 135deg, #e2e8f0 135deg 180deg, #ffffff 180deg 225deg, #e2e8f0 225deg 270deg, #ffffff 270deg 315deg, #e2e8f0 315deg 360deg); border: 6px solid #1e293b; position: relative; transition: transform 5s cubic-bezier(0.1, 0, 0.1, 1); box-shadow: 0 0 30px rgba(0,0,0,0.5); }
.wheel-container::after { content: '▼'; position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 2.2em; color: #00a8ff; z-index: 20; text-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.wheel-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 55px; height: 55px; background: #1e293b; border: 2px solid var(--tuyet-border-mid); border-radius: 50%; z-index: 10; display: flex; align-items: center; justify-content: center; font-size: 1.6em; box-shadow: 0 0 10px rgba(0,0,0,0.5); }

#result-message, #mg-result { margin-top: 15px; padding: 12px; background: rgba(0, 0, 0, 0.4); border-radius: 8px; font-weight: bold; color: #00a8ff; min-height: 45px; border: 1px solid var(--tuyet-border-light); }
#status, #store-status { margin-top: 20px; padding: 12px; border-radius: 8px; font-size: 0.95em; min-height: 25px; }
.success-box { background: rgba(46, 213, 115, 0.15); color: #2ed573; border: 1px solid rgba(46, 213, 115, 0.4); }
.error-box { background: rgba(255, 71, 87, 0.15); color: #ff4757; border: 1px solid rgba(255, 71, 87, 0.4); }

/* --- THƯ VIỆN ẢNH & CỬA HÀNG --- */
.gallery-container { position: relative; background: var(--tuyet-card-bg); backdrop-filter: blur(15px); padding: 15px; border-radius: 12px; border: 1px solid var(--tuyet-border-light); }
.swiper { width: 100%; height: 380px; padding-bottom: 30px; }
.swiper-slide { display: flex; justify-content: center; align-items: center; }
.swiper-slide img { width: 100%; height: 350px; object-fit: contain; border-radius: 8px; background-color: rgba(0,0,0,0.3); }
.gallery-close { position: absolute; top: -12px; right: -12px; background: #ff4757; color: white; border: none; border-radius: 50%; width: 32px; height: 32px; font-weight: bold; cursor: pointer; z-index: 100; box-shadow: 0 4px 10px rgba(0,0,0,0.5); font-size: 16px; display: flex; align-items: center; justify-content: center; }
.gallery-close:hover { background: #ff6b81; }

.store-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 12px; margin-top: 15px; }
.store-item { border: 1px solid var(--tuyet-border-light); padding: 12px; border-radius: 8px; background: rgba(0, 0, 0, 0.4); text-align: center; display: flex; flex-direction: column; justify-content: space-between;}
.store-item h4 { margin: 0 0 5px; color: var(--text-main); font-size: 1.1em; }

.store-tab-btn { flex: 1 1 20%; padding: 8px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--tuyet-border-mid); border-radius: 6px; color: var(--text-sub); transition: 0.3s; margin: 2px; }
.store-tab-btn.active { background: rgba(0, 168, 255, 0.3); border-color: #00a8ff; color: #fff; font-weight: bold; }

/* --- MINIGAMES CHUNG --- */
.ice-shard { position: fixed; background: rgba(255, 255, 255, 0.95); border: 1px solid #00a8ff; box-shadow: 0 0 10px rgba(0, 168, 255, 0.8); pointer-events: none; z-index: 10000; }
.mg-tab-btn.active-mg { background: rgba(0, 168, 255, 0.3) !important; border-color: #00a8ff !important; color: #fff !important; }

/* - Phá Băng */
.ice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 15px auto; max-width: 250px; }
.ice-block { background: linear-gradient(135deg, rgba(0, 168, 255, 0.2), rgba(0, 168, 255, 0.5)); border: 1px solid #00a8ff; height: 70px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 2em; transition: 0.3s; box-shadow: inset 0 0 10px rgba(255,255,255,0.2); }
.ice-block:hover { background: rgba(0, 168, 255, 0.6); transform: scale(1.05); }
.ice-block.revealed { background: rgba(0,0,0,0.5); cursor: default; transform: none; box-shadow: none; border-color: var(--tuyet-border-mid);}

/* - Rút Kiếm */
.sword-container { display: flex; justify-content: center; gap: 10px; margin: 25px 0; }
.sword-btn { background: #1e293b; border: 2px solid var(--tuyet-border-mid); padding: 15px 10px; font-size: 1.8em; border-radius: 8px; cursor: pointer; transition: 0.2s; box-shadow: 0 5px 10px rgba(0,0,0,0.5); }
.sword-btn:hover:not(.pulled) { transform: translateY(-10px); border-color: #00a8ff; }
.sword-btn.pulled { opacity: 0.3; cursor: not-allowed; transform: translateY(10px); }

/* - Câu Cá */
.fish-bar-container { position: relative; width: 100%; height: 40px; background: #0f172a; border-radius: 20px; overflow: hidden; border: 2px solid var(--tuyet-border-mid); margin: 25px 0; box-shadow: inset 0 0 15px rgba(0,0,0,0.8); }
.fish-target { position: absolute; height: 100%; background: rgba(46, 213, 115, 0.4); border-left: 2px solid #2ed573; border-right: 2px solid #2ed573; box-shadow: 0 0 15px rgba(46, 213, 115, 0.5); }
.fish-indicator { position: absolute; height: 120%; top: -10%; width: 6px; background: #ff4757; box-shadow: 0 0 10px #ff4757; border-radius: 3px; z-index: 2; }

/* - Lục Hợp */
.luchop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 15px; }
.luchop-btn { background: rgba(0,0,0,0.5); border: 1px solid var(--tuyet-border-mid); padding: 15px 0; font-size: 2em; border-radius: 8px; cursor: pointer; transition: 0.3s; }
.luchop-btn:hover { background: rgba(0,168,255,0.2); }
.luchop-btn.selected { border-color: #00a8ff; box-shadow: 0 0 15px rgba(0,168,255,0.5); background: rgba(0,168,255,0.3); transform: scale(1.05); }
.luchop-dice-container { display: flex; justify-content: center; gap: 15px; font-size: 3em; margin: 15px 0; min-height: 60px; background: rgba(0,0,0,0.4); padding: 10px; border-radius: 12px; }
.luchop-die.rolling { animation: diceShake 0.2s infinite alternate; }

/* --- CHAT BOX STYLES CHUẨN --- */
.messenger-container { display: flex; flex-direction: column; width: 100%; }

/* Ẩn scrollbar nhưng vẫn vuốt/lăn chuột được */
.chat-window { 
    flex: 1; min-height: 350px; background: rgba(0, 0, 0, 0.3); border-radius: 12px; 
    margin-bottom: 15px; border: 1px solid var(--tuyet-border-light); display: flex; 
    flex-direction: column; align-items: center; justify-content: flex-start; 
    position: relative; overflow-y: auto; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); 
    padding: 15px 10px; max-height: 400px;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.chat-window::-webkit-scrollbar { display: none; } /* Chrome, Safari, Opera */

.bg-lantern { position: absolute; bottom: -50px; font-size: 2em; opacity: 0; animation: float-up-bg 8s linear infinite; filter: drop-shadow(0 0 10px rgba(255, 159, 67, 0.5)); z-index: 0; user-select: none; pointer-events: none; }
@keyframes float-up-bg { 0% { transform: translateY(0) scale(0.8) rotate(-5deg); opacity: 0; } 10%, 90% { opacity: 0.6; } 100% { transform: translateY(-350px) scale(1) rotate(5deg); opacity: 0; } }

/* Chỉnh lại tin nhắn chat cho vừa vặn */
.chat-msg-row { display: flex; flex-direction: column; align-items: flex-start; background: rgba(15, 23, 42, 0.7); padding: 10px 14px; border-radius: 12px; border: 1px solid var(--tuyet-border-mid); word-break: break-word; text-align: left; animation: fadeInChat 0.3s ease forwards; width: fit-content; max-width: 90%; z-index: 2; }
.chat-msg-row.my-msg { align-self: flex-end; align-items: flex-end; background: rgba(0, 168, 255, 0.15); border-color: rgba(0, 168, 255, 0.4); text-align: right; }

/* Cân đối Tên, Thú, Viền, Cảnh giới */
.chat-msg-header { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 5px; font-size: 0.9em; }
.chat-msg-header .realm-badge { margin-top: 0; font-size: 0.75em; padding: 2px 8px; box-shadow: none; border-color: rgba(255,255,255,0.2); }

.chat-msg-content { color: var(--text-main); font-size: 0.95em; margin-top: 2px; line-height: 1.4; }
.chat-msg-time { font-size: 0.7em; color: rgba(255,255,255,0.4); margin-top: 5px; }

/* Nhãn dán gửi trong chat */
.chat-sticker { max-width: 120px; border-radius: 8px; margin-top: 5px; cursor: pointer; border: 1px solid var(--tuyet-border-mid); background: rgba(0,0,0,0.5); }
.chat-sticker-preview { width: 40px; height: 40px; object-fit: contain; cursor: pointer; transition: 0.2s; border-radius: 4px; }
.chat-sticker-preview:hover { transform: scale(1.2); }

@keyframes fadeInChat { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.messenger-input-wrapper { display: flex; align-items: center; background: rgba(0, 0, 0, 0.5); border-radius: 25px; padding: 5px 15px; border: 1px solid var(--tuyet-border-mid); position: relative; z-index: 5; }
.messenger-input-wrapper input { flex: 1; background: transparent; border: none; color: var(--text-main); padding: 12px 5px; font-size: 1em; outline: none; }
.messenger-action-btn { background: transparent; border: none; color: #00a8ff; font-size: 1.6em; cursor: pointer; padding: 5px; transition: 0.2s; display: flex; align-items: center; justify-content: center; min-width: 40px; }
.messenger-action-btn:hover { color: #0097e6; transform: scale(1.1); }

.emoji-picker { position: absolute; bottom: 60px; left: 0; background: var(--tuyet-card-bg); border: 1px solid var(--tuyet-border-light); border-radius: 12px; padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; width: 260px; box-shadow: 0 -5px 20px rgba(0,0,0,0.6); z-index: 100; backdrop-filter: blur(15px); }
/* Ẩn scrollbar cho Emoji/Sticker picker */
.emoji-picker { -ms-overflow-style: none; scrollbar-width: none; }
.emoji-picker::-webkit-scrollbar { display: none; }

.emoji-item { font-size: 1.6em; cursor: pointer; transition: 0.2s; padding: 5px; }
.emoji-item:hover { transform: scale(1.3); }

/* --- ĐÁNH BOSS --- */
.boss-container { display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle, rgba(255,71,87,0.1) 0%, rgba(0,0,0,0.6) 100%); border: 1px solid var(--tuyet-border-mid); padding: 20px; border-radius: 12px; margin-top: 15px; }
.boss-icon { font-size: 5em; animation: bossHover 2s infinite alternate; text-shadow: 0 0 20px rgba(255,71,87,0.5); }
@keyframes bossHover { from { transform: translateY(0); } to { transform: translateY(-10px); } }
.boss-hp-container { width: 100%; height: 25px; background: rgba(0,0,0,0.5); border: 2px solid #ff4757; border-radius: 12px; overflow: hidden; position: relative; margin: 15px 0; box-shadow: inset 0 0 10px rgba(0,0,0,0.8); }
.boss-hp-bar { height: 100%; width: 100%; background: linear-gradient(90deg, #ff4757, #ff6b81); transition: width 0.3s ease; box-shadow: 0 0 15px rgba(255,71,87,0.8); }
.boss-hp-text { position: absolute; width: 100%; top: 0; left: 0; text-align: center; font-weight: bold; font-size: 0.9em; line-height: 25px; color: #fff; text-shadow: 1px 1px 2px #000; }

/* --- LEADERBOARD & LÌ XÌ --- */
.lb-table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 0.9em; background: rgba(0,0,0,0.3); border-radius: 8px; overflow: hidden; }
.lb-table th { background: rgba(0,168,255,0.2); padding: 12px 8px; color: #00a8ff; text-transform: uppercase; font-size: 0.85em; }
.lb-table td { padding: 10px 8px; border-bottom: 1px solid var(--tuyet-border-light); color: var(--text-main); }
.lb-table tr:hover { background: rgba(255,255,255,0.05); }

.lixi-icon { font-size: 6em; cursor: pointer; transition: 0.3s; animation: pulse-intro 2s infinite alternate; display: inline-block; }
.lixi-icon:hover { transform: scale(1.1); }
/* --- HIỆU ỨNG THIÊN KIẾP (ĐỘ KIẾP) --- */
.lightning-strike {
    font-size: 5em;
    color: #f1c40f;
    text-shadow: 0 0 20px #f1c40f, 0 0 40px #fff;
    animation: lightning-flash 0.5s infinite;
}
@keyframes lightning-flash {
    0%, 100% { opacity: 1; transform: scale(1); filter: brightness(1.5); }
    50% { opacity: 0.2; transform: scale(0.9); filter: brightness(0.5); }
    80% { opacity: 0.8; transform: scale(1.1); filter: brightness(2); }
}

/* --- HỆ THỐNG LINH ĐIỀN (AFK FARMING) --- */
.farm-grid { 
    display: flex; gap: 15px; justify-content: center; margin: 20px 0; 
}
.farm-plot { 
    width: 80px; height: 80px; background: #654321; border: 3px solid #3e2723; 
    border-radius: 12px; position: relative; cursor: pointer; display: flex; 
    flex-direction: column; align-items: center; justify-content: center; 
    font-size: 2.2em; box-shadow: inset 0 0 15px rgba(0,0,0,0.9); transition: 0.3s; 
}
.farm-plot:hover { 
    filter: brightness(1.3); transform: translateY(-3px); 
}
.farm-timer { 
    font-size: 0.3em; color: white; background: rgba(0,0,0,0.8); padding: 3px 6px; 
    border-radius: 6px; position: absolute; bottom: 5px; font-weight: bold; font-family: 'Noto Serif', serif;
}
.seed-shop { 
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; 
    /* Ẩn thanh cuộn */
    -ms-overflow-style: none; scrollbar-width: none;
}
.seed-shop::-webkit-scrollbar { display: none; }

.seed-item { 
    flex: 1; min-width: 90px; background: rgba(0,0,0,0.5); 
    border: 1px solid var(--tuyet-border-mid); border-radius: 10px; 
    padding: 10px 5px; text-align: center; cursor: pointer; transition: 0.3s; 
}
.seed-item:hover { background: rgba(0,0,0,0.8); }
.seed-item.selected { 
    border-color: #2ed573; background: rgba(46, 213, 115, 0.25); 
    box-shadow: 0 0 10px rgba(46, 213, 115, 0.4); transform: scale(1.05); 
}
/* --- LƯỚI MENU GAME GỌN GÀNG (APP-STYLE) --- */
.mg-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 8px; 
    margin-bottom: 15px; 
}
@media (max-width: 400px) { .mg-grid { grid-template-columns: repeat(3, 1fr); } }

.mg-tab-btn { 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    padding: 10px 5px; font-size: 0.75em; 
    background: rgba(0,0,0,0.4); border: 1px solid var(--tuyet-border-mid); 
    border-radius: 8px; color: var(--text-sub); transition: 0.2s; 
    white-space: nowrap; margin: 0; cursor: pointer;
}
.mg-tab-btn:hover { background: rgba(0,168,255,0.2); color: #fff; }
.mg-tab-btn.active-mg { 
    background: rgba(0,168,255,0.3) !important; 
    border-color: #00a8ff !important; 
    color: #fff !important; 
    font-weight: bold; 
    transform: translateY(-2px); 
    box-shadow: 0 4px 10px rgba(0,168,255,0.3); 
}
.mg-ic { font-size: 1.8em; margin-bottom: 5px; }


/* --- HIỆU ỨNG THIÊN KIẾP (ĐỘ KIẾP) --- */
.lightning-strike {
    font-size: 5em;
    color: #f1c40f;
    text-shadow: 0 0 20px #f1c40f, 0 0 40px #fff;
    animation: lightning-flash 0.5s infinite;
}
@keyframes lightning-flash {
    0%, 100% { opacity: 1; transform: scale(1); filter: brightness(1.5); }
    50% { opacity: 0.2; transform: scale(0.9); filter: brightness(0.5); }
    80% { opacity: 0.8; transform: scale(1.1); filter: brightness(2); }
}

/* --- HỆ THỐNG LINH ĐIỀN (AFK FARMING) --- */
.farm-grid { 
    display: flex; gap: 15px; justify-content: center; margin: 15px 0; 
}
.farm-plot { 
    width: 80px; height: 80px; background: #654321; border: 3px solid #3e2723; 
    border-radius: 12px; position: relative; cursor: pointer; display: flex; 
    flex-direction: column; align-items: center; justify-content: center; 
    font-size: 2.2em; box-shadow: inset 0 0 15px rgba(0,0,0,0.9); transition: 0.3s; 
}
.farm-plot:hover { 
    filter: brightness(1.3); transform: translateY(-3px); 
}
.farm-timer { 
    font-size: 0.3em; color: white; background: rgba(0,0,0,0.8); padding: 3px 6px; 
    border-radius: 6px; position: absolute; bottom: 5px; font-weight: bold; font-family: 'Noto Serif', serif;
}
.seed-shop { 
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; 
    /* Ẩn thanh cuộn */
    -ms-overflow-style: none; scrollbar-width: none;
}
.seed-shop::-webkit-scrollbar { display: none; }

.seed-item { 
    flex: 1; min-width: 90px; background: rgba(0,0,0,0.5); 
    border: 1px solid var(--tuyet-border-mid); border-radius: 10px; 
    padding: 10px 5px; text-align: center; cursor: pointer; transition: 0.3s; 
}
.seed-item:hover { background: rgba(0,0,0,0.8); }
.seed-item.selected { 
    border-color: #2ed573; background: rgba(46, 213, 115, 0.25); 
    box-shadow: 0 0 10px rgba(46, 213, 115, 0.4); transform: scale(1.05); 
}