:root {
    --bg-dark: #050505;
    --bg-panel: rgba(18, 18, 18, 0.7);
    --gold-primary: #eab308;
    --text-main: #f3f4f6;
    --nav-height: 60px; /* Chiều cao menu đáy */
}
body { 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    font-family: 'Nunito', sans-serif; 
    position: fixed; inset: 0; height: 100dvh; overflow: hidden; 
    -webkit-tap-highlight-color: transparent; 
}

h1, h2, h3, .cultivation-font { font-family: 'Merriweather', serif; }

/* SCROLLBAR */
.custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; transition: background 0.3s; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--gold-primary); }

/* GLASSMORPHISM */
.glass-panel { 
    background: var(--bg-panel); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.glass-panel:hover { border-color: rgba(255, 255, 255, 0.15); }

/* --- REALM COLORS & EFFECTS --- */

/* 0. Luyện Khí (Trắng Xám) */
.realm-0 { color: #9ca3af; }

/* 1. Trúc Cơ (Xanh Lá) */
.realm-1 { color: #4ade80; }

/* 2. Kết Đan (Xanh Lam + Soft Shadow) */
.realm-2 { color: #3b82f6; text-shadow: 0 0 5px rgba(59, 130, 246, 0.4); }

/* 3. Nguyên Anh (Tím Mộng Mơ + Purple Glow) */
.realm-3 { color: #a855f7; text-shadow: 0 0 8px rgba(168, 85, 247, 0.6); }

/* 4. Hóa Thần (Cam Rực + Light Glow) */
.realm-4 { color: #f97316; text-shadow: 0 0 10px rgba(249, 115, 22, 0.6); }

/* 5. Luyện Hư (Đỏ Thẫm + Red Aura) */
.realm-5 { color: #ef4444; text-shadow: 0 0 10px rgba(239, 68, 68, 0.7); }

/* 6. Hợp Thể (Hồng Cánh Sen + Pink Aura) */
.realm-6 { color: #ec4899; text-shadow: 0 0 12px rgba(236, 72, 153, 0.8); }

/* 7. Đại Thừa (Vàng Kim + Golden Glow) */
.realm-7 { color: #eab308; text-shadow: 0 0 15px rgba(234, 179, 8, 0.8); }

/* 8. Độ Kiếp (Tím Than + Sét - Lightning Anim) */
.realm-8 { 
    color: #d8b4fe;
    text-shadow: 0 0 10px #7e22ce;
    animation: text-lightning 3s infinite;
}

/* 9. Chân Tiên (Ngọc Bích + Ethereal Glow) */
.realm-9 { color: #10b981; text-shadow: 0 0 20px rgba(16, 185, 129, 0.9); }

/* 10. Kim Tiên (Vàng Ròng + Shimmer) */
.realm-10 {
    background: linear-gradient(to bottom, #fef08a, #eab308, #a16207);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(234, 179, 8, 0.5);
    animation: text-shimmer 2s infinite linear;
    background-size: 200% auto;
}

/* 11. Thái Ất (Xanh Băng + Frost Mist) */
.realm-11 {
    background: linear-gradient(to right, #22d3ee, #e0f2fe, #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(6, 182, 212, 0.8);
    animation: text-mist 4s infinite ease-in-out;
}

/* 12. Đại La (Thất Sắc + Flowing) */
.realm-12 {
    background: linear-gradient(to right, #ef4444, #eab308, #22c55e, #3b82f6, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: text-rainbow 3s linear infinite;
    background-size: 300% auto;
    font-weight: 900;
}

/* 13. Đạo Tổ (Hư Vô - Đen/Trắng + Void Pulse) */
.realm-13 {
    color: #ffffff;
    text-shadow: 0 0 5px #000, 0 0 10px #fff, 0 0 20px #000;
    animation: text-void 4s infinite alternate;
}

/* Sub-Realm Modifiers */
.sub-0 { opacity: 0.85; font-weight: normal; } /* Sơ Kỳ */
.sub-1 { opacity: 1; font-weight: normal; }    /* Trung Kỳ */
.sub-2 { opacity: 1; font-weight: bold; }      /* Hậu Kỳ */
.sub-3 { opacity: 1; font-weight: 900; letter-spacing: 1px; } /* Viên Mãn */

/* --- RARITY COLORS & EFFECTS --- */
/* 1. Bình thường (Normal) - Trắng */
.r-0 { color: #e5e7eb; text-shadow: 0 0 2px rgba(255,255,255,0.2); } 
.glow-0 { border-color: #4b5563; }

/* 2. Tinh xảo (Fine) - Xanh lá */
.r-1 { color: #4ade80; text-shadow: 0 0 5px rgba(74, 222, 128, 0.4); } 
.glow-1 { border-color: #166534; box-shadow: 0 0 5px rgba(22, 101, 52, 0.3) inset; }

/* 3. Ưu tú (Superior) - Xanh nước biển */
.r-2 { color: #3b82f6; text-shadow: 0 0 8px rgba(59, 130, 246, 0.5); font-weight: 700; }
.glow-2 { border-color: #1e40af; box-shadow: 0 0 8px rgba(30, 64, 175, 0.4) inset; }

/* 4. Trác việt (Distinguished) - Tím óng ánh */
.r-3 { 
    color: #d8b4fe; 
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.8); 
    font-weight: 800;
    animation: shimmer-purple 3s infinite alternate;
} 
.glow-3 { border-color: #7e22ce; box-shadow: 0 0 12px rgba(126, 34, 206, 0.5) inset; animation: border-breathe-purple 3s infinite; }

/* 5. Hoàn hảo (Perfect) - Vàng kim óng ánh */
.r-4 { 
    color: #facc15; 
    text-shadow: 0 0 15px rgba(234, 179, 8, 0.8); 
    font-weight: 900; 
    animation: shimmer-gold 2s infinite;
}
.glow-4 { border-color: #a16207; box-shadow: 0 0 15px rgba(202, 138, 4, 0.6) inset; animation: border-pulse-gold 2s infinite; }

/* 6. Thần thánh (Divine) - Đỏ Rực + Tia sét */
.r-5 { 
    color: #ff0000;
    font-weight: 900; 
    text-shadow: 0 0 10px #ef4444, 0 0 20px #991b1b;
    animation: divine-lightning 4s infinite;
    position: relative;
    display: inline-block;
}
.glow-5 { 
    border-color: #ef4444; 
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5) inset, 0 0 10px rgba(255,255,255,0.3); 
    animation: border-lightning 0.5s infinite alternate; 
}

/* --- ANIMATIONS --- */

@keyframes shimmer-purple {
    0% { color: #d8b4fe; text-shadow: 0 0 5px #a855f7; }
    100% { color: #e9d5ff; text-shadow: 0 0 15px #c084fc, 0 0 5px #fff; }
}

@keyframes shimmer-gold {
    0% { color: #facc15; filter: brightness(1); }
    50% { color: #fef08a; filter: brightness(1.3) drop-shadow(0 0 2px gold); }
    100% { color: #facc15; filter: brightness(1); }
}

@keyframes divine-lightning {
    0%, 90%, 100% { color: #ff0000; text-shadow: 0 0 10px #ef4444; transform: scale(1); }
    92% { color: #ffffff; text-shadow: 0 0 20px #ffffff, 0 0 40px #ff0000; transform: scale(1.02); }
    94% { color: #ff0000; text-shadow: 0 0 10px #ef4444; }
    96% { color: #fee2e2; text-shadow: 0 0 15px #ffffff; }
}

@keyframes border-breathe-purple { 0%, 100% { box-shadow: 0 0 5px rgba(168, 85, 247, 0.2) inset; } 50% { box-shadow: 0 0 15px rgba(168, 85, 247, 0.5) inset; } }
@keyframes border-pulse-gold { 0%, 100% { box-shadow: 0 0 5px rgba(234, 179, 8, 0.3) inset; border-color: #854d0e; } 50% { box-shadow: 0 0 20px rgba(234, 179, 8, 0.6) inset; border-color: #facc15; } }
@keyframes border-lightning { 
    0% { border-color: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.5) inset; } 
    100% { border-color: #fee2e2; box-shadow: 0 0 25px rgba(239, 68, 68, 0.8) inset, 0 0 10px #fff; } 
}

@keyframes slideInUp { to { opacity: 1; transform: translateY(0); } }

/* UI ELEMENTS */
.progress-bar-fill { transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.log-entry-anim { animation: slideInUp 0.3s ease-out forwards; opacity: 0; transform: translateY(10px); }
#sidebar { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.sidebar-closed { transform: translateX(-100%); } @media (min-width: 1024px) { .sidebar-closed { transform: translateX(0); } }
.sidebar-open { transform: translateX(0) !important; }

#global-tooltip { position: fixed; z-index: 9999; pointer-events: none; opacity: 0; transition: opacity 0.1s; background-color: rgba(10,10,10,0.98); border: 1px solid #444; padding: 12px; border-radius: 8px; width: 260px; color: #fff; font-size: 11px; box-shadow: 0 10px 30px rgba(0,0,0,1); display: none; backdrop-filter: blur(4px); }
.stats-divider { border-bottom: 1px solid #333; margin: 6px 0; padding-bottom: 2px; color: #666; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; font-weight: bold; }

.avatar-container { position: relative; width: 8rem; height: 8rem; margin: 0 auto; z-index: 1; transition: transform 0.3s; }
.avatar-container:hover { transform: scale(1.05); }
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; position: relative; z-index: 10; border: 3px solid #333; box-shadow: 0 0 20px rgba(0,0,0,0.9); }

/* Hiệu ứng Tĩnh Tọa/Lịch Luyện */
.aura-meditate::after { 
    content: ''; position: absolute; inset: -5px; border-radius: 50%; 
    box-shadow: 0 0 0 rgba(234, 179, 8, 0); 
    animation: shockwave-gold 2s infinite cubic-bezier(0,0,0.2,1); 
    z-index: 0; 
}
.aura-adventure::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; box-shadow: 0 0 0 rgba(239, 68, 68, 0); animation: shockwave 2s infinite cubic-bezier(0,0,0.2,1); z-index: 0; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes shockwave { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); } 100% { box-shadow: 0 0 0 30px rgba(239, 68, 68, 0); } }
@keyframes shockwave-gold { 0% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.6); } 100% { box-shadow: 0 0 0 30px rgba(234, 179, 8, 0); } }

.badge-new { position: absolute; top: -4px; right: -4px; background: linear-gradient(45deg, #ef4444, #b91c1c); color: white; font-size: 8px; font-weight: 900; padding: 2px 5px; border-radius: 4px; z-index: 25; box-shadow: 0 2px 5px rgba(0,0,0,0.5); animation: bounce 2s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.locked-item { filter: grayscale(100%); opacity: 0.4; pointer-events: none; position: relative; transition: all 0.3s; }
.locked-overlay::after { content: '\f023'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 2rem; color: #666; z-index: 10; text-shadow: 0 2px 5px black; }

/* ITEM CARD */
.item-card { 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    position: relative; 
}
.item-card:hover { 
    z-index: 10; 
}

.btn-action { background: #1f2937; border: 1px solid #374151; transition: all 0.2s; }
.btn-action:active { transform: scale(0.96); }

/* LOG FILTERS */
.log-filter-btn { transition: all 0.2s; }
button.log-filter-active, .log-filter-active { background-color: #ca8a04 !important; color: #000 !important; font-weight: 800 !important; border-color: #eab308 !important; box-shadow: 0 0 10px rgba(0,0,0,0.3) !important; }
.log-entry-hidden { display: none !important; }

/* VISUAL EFFECTS */
.fx-burst { position: fixed; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle, rgba(234,179,8,0.8) 0%, rgba(234,179,8,0) 70%); transform: translate(-50%, -50%) scale(0.5); pointer-events: none; z-index: 9999; animation: burst-anim 0.4s ease-out forwards; box-shadow: 0 0 15px rgba(234,179,8,0.6); }
@keyframes burst-anim { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; } }

/* [VISUAL UPGRADE] 5. Hiệu Ứng Rơi Vật Phẩm (Loot Drop Animation) */
.fx-fly-item { 
    position: fixed; 
    z-index: 9999; 
    pointer-events: none; 
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); 
    font-size: 2rem; 
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
    animation: loot-spin 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Hiệu ứng xoay và thu nhỏ khi bay */
@keyframes loot-spin {
    0% { transform: scale(0.5) rotate(0deg); opacity: 0; }
    20% { transform: scale(1.5) rotate(180deg); opacity: 1; }
    100% { transform: scale(0.2) rotate(720deg); opacity: 0; }
}

/* Hiệu ứng bùng nổ khi nhặt được đồ xịn (Rarity >= 3) */
.loot-flash {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    z-index: 9998;
    animation: flash-fade 0.3s ease-out forwards;
    pointer-events: none;
}

@keyframes flash-fade {
    0% { opacity: 0.5; }
    100% { opacity: 0; }
}

/* [VISUAL UPGRADE] 6. Bối Cảnh Động (Parallax Backgrounds) */
.parallax-bg {
    background-attachment: fixed; /* Key for parallax */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    transition: background-image 0.5s ease-in-out;
    position: relative;
}

.parallax-fog {
    position: absolute;
    inset: 0;
    background: url('https://huyenmon.com/client/img/may.png');
    opacity: 0.3;
    animation: fog-move 60s linear infinite;
    pointer-events: none;
}

@keyframes fog-move {
    0% { background-position: 0 0; }
    100% { background-position: 1000px 0; }
}

/* [VISUAL UPGRADE] 9. Tooltips So Sánh Trang Bị (Comparison Tooltips) */
#global-tooltip.compare-mode {
    width: 520px; /* Rộng gấp đôi bình thường */
    display: flex;
    gap: 10px;
    padding: 0; 
    background: transparent; 
    border: none; 
    box-shadow: none;
}

.tooltip-col {
    flex: 1;
    background-color: rgba(10,10,10,0.98); 
    border: 1px solid #444; 
    padding: 12px; 
    border-radius: 8px; 
    box-shadow: 0 10px 30px rgba(0,0,0,1);
    backdrop-filter: blur(4px);
}

.tooltip-header {
    text-align: center;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    padding-bottom: 5px;
    margin-bottom: 5px;
    border-bottom: 1px dashed #444;
    color: #888;
}

.stat-diff-pos { color: #4ade80; font-weight: bold; }
.stat-diff-neg { color: #ef4444; font-weight: bold; }
.stat-diff-neu { color: #9ca3af; }

/* COMBAT ANIMATIONS */
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.combat-shake { animation: shake 0.5s; animation-iteration-count: 1; }

/* [VISUAL UPGRADE] 4. Combat Text Chuyên Nghiệp */
.combat-dmg-text {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%) scale(0);
    font-weight: 900; text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    pointer-events: none; z-index: 50; white-space: nowrap;
    opacity: 0;
}

@keyframes dmg-pop-up {
    0% { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(0); }
    20% { opacity: 1; transform: translateX(-50%) scale(1.5) translateY(-20px); }
    40% { transform: translateX(-50%) scale(1.2) translateY(-30px); }
    100% { opacity: 0; transform: translateX(-50%) scale(1) translateY(-60px); }
}

@keyframes crit-pop-up {
    0% { opacity: 0; transform: translateX(-50%) scale(0.5) rotate(-10deg); }
    20% { opacity: 1; transform: translateX(-50%) scale(2.5) rotate(0deg); }
    30% { transform: translateX(-50%) scale(2.0) rotate(5deg); }
    100% { opacity: 0; transform: translateX(-50%) scale(1.5) translateY(-50px); }
}

.combat-dmg-text.normal { 
    font-size: 1.5rem; color: #ffffff; 
    animation: dmg-pop-up 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; 
}
.combat-dmg-text.crit { 
    font-size: 2.5rem; color: #fbbf24; /* Yellow-400 */
    background: -webkit-linear-gradient(#fcd34d, #f59e0b); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: crit-pop-up 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; 
}
.combat-dmg-text.heal { 
    font-size: 1.5rem; color: #4ade80; 
    animation: dmg-pop-up 1s forwards; 
}
.combat-dmg-text.player { 
    font-size: 1.5rem; color: #ef4444; 
    animation: dmg-pop-up 0.8s forwards; 
}

.attack-anim { transition: transform 0.1s; }
.attack-thrust-right { transform: translateX(30px); }
.attack-thrust-left { transform: translateX(-30px); }

/* [VISUAL UPGRADE] 1. Thanh Trạng Thái 3D (Clean Liquid Tube) */
.stat-bar-3d-container {
    height: 16px;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
}

.stat-bar-3d-fill {
    height: 100%;
    position: relative;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 2px 0 5px rgba(0,0,0,0.5);
    /* Ngăn tràn */
    overflow: hidden;
    border-radius: 10px 0 0 10px; 
    z-index: 0;
}

/* Hiệu ứng chất lỏng chảy (SHINE) */
.stat-bar-3d-fill::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    background: linear-gradient(
        90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.1) 25%, 
        rgba(255,255,255,0.25) 50%, 
        rgba(255,255,255,0.1) 75%, 
        rgba(255,255,255,0) 100%
    );
    background-size: 200% 100%;
    animation: liquid-flow 2s infinite linear;
    
    mix-blend-mode: normal;
    z-index: 2;
    pointer-events: none;
}

/* [NEW ANIMATION] Gradient Flow Animation - Ping Pong Smooth Slow */
@keyframes bar-gradient-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes liquid-flow { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* [NEW COLORS] Màu sắc động (Gradient Moving) - Ping Pong, Slow (10s) */
.bar-hp { 
    /* Đỏ -> Đỏ Đậm -> Đỏ */
    background: linear-gradient(90deg, #ef4444, #7f1d1d, #ef4444);
    background-size: 200% 100%;
    animation: bar-gradient-flow 10s infinite ease-in-out;
}
.bar-mp { 
    /* Xanh -> Xanh Đậm -> Xanh */
    background: linear-gradient(90deg, #3b82f6, #1e3a8a, #3b82f6);
    background-size: 200% 100%;
    animation: bar-gradient-flow 10s infinite ease-in-out;
}
.bar-exp { 
    /* Vàng -> Nâu Vàng -> Vàng */
    background: linear-gradient(90deg, #eab308, #713f12, #eab308);
    background-size: 200% 100%;
    animation: bar-gradient-flow 10s infinite ease-in-out;
}

/* [VISUAL UPGRADE] 2. Hiệu Ứng Hào Quang Cảnh Giới (Aura Particle) */
.realm-aura-container {
    position: relative;
    display: inline-block;
    padding: 5px 15px;
}

.realm-aura-bg {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    filter: blur(10px);
    z-index: 0;
    opacity: 0.5;
    animation: aura-pulse 3s infinite alternate;
}

.realm-aura-text {
    position: relative;
    z-index: 1;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
}

/* Particle giả lập bằng CSS */
.realm-particle {
    position: absolute;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: white;
    opacity: 0;
    pointer-events: none;
    animation: particle-float 2s infinite;
}

.realm-particle:nth-child(1) { left: 10%; bottom: 0; animation-delay: 0s; }
.realm-particle:nth-child(2) { left: 30%; bottom: 0; animation-delay: 0.5s; transform: scale(0.5); }
.realm-particle:nth-child(3) { left: 70%; bottom: 0; animation-delay: 1.2s; }
.realm-particle:nth-child(4) { left: 90%; bottom: 0; animation-delay: 0.8s; transform: scale(0.8); }

@keyframes aura-pulse { 0% { opacity: 0.3; transform: scale(0.95); } 100% { opacity: 0.6; transform: scale(1.05); } }
@keyframes particle-float { 
    0% { transform: translateY(0) scale(1); opacity: 0; } 
    50% { opacity: 0.8; }
    100% { transform: translateY(-30px) scale(0); opacity: 0; } 
}

/* Màu Aura theo Realm - Full 14 Cảnh giới */
.aura-0 { background: #9ca3af; } /* Luyện Khí (Xám) */
.aura-1 { background: #4ade80; } /* Trúc Cơ (Xanh Lá) */
.aura-2 { background: #3b82f6; } /* Kết Đan (Xanh Lam) */
.aura-3 { background: #a855f7; } /* Nguyên Anh (Tím) */
.aura-4 { background: #f97316; } /* Hóa Thần (Cam) */
.aura-5 { background: #ef4444; } /* Luyện Hư (Đỏ) */
.aura-6 { background: #ec4899; } /* Hợp Thể (Hồng) */
.aura-7 { background: #eab308; } /* Đại Thừa (Vàng) */
.aura-8 { background: #d8b4fe; } /* Độ Kiếp (Tím Nhạt/Sét) */
.aura-9 { background: #10b981; } /* Chân Tiên (Ngọc Bích) */
.aura-10 { background: #fcd34d; } /* Kim Tiên (Vàng Ròng) */
.aura-11 { background: #22d3ee; } /* Thái Ất (Xanh Băng) */
.aura-12 { background: linear-gradient(45deg, #ef4444, #eab308, #22c55e, #3b82f6, #a855f7); } /* Đại La (Thất Sắc) */
.aura-13 { background: #ffffff; box-shadow: 0 0 10px #fff; } /* Đạo Tổ (Hư Vô/Trắng) */

/* MAP VISUAL STYLES */
@keyframes avatar-breath {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(234,179,8,0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(234,179,8,0.6); }
}
.animate-avatar-breath { animation: avatar-breath 3s infinite ease-in-out; }

/* Map Entities */
.map-entity {
    position: absolute;
    z-index: 15;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.8));
    animation: entity-spawn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: all 0.3s;
}

@keyframes entity-spawn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.entity-vanish {
    animation: float-up-fade 0.8s forwards;
}

@keyframes float-up-fade {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.5); opacity: 0; }
}

.map-shake-screen { animation: map-shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }

@keyframes map-shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}

.encounter-glow {
    box-shadow: 0 0 50px 20px rgba(234, 179, 8, 0.5) inset;
    animation: encounter-pulse 1s infinite alternate;
}
@keyframes encounter-pulse {
    from { box-shadow: 0 0 50px 20px rgba(234, 179, 8, 0.5) inset; }
    to { box-shadow: 0 0 80px 40px rgba(234, 179, 8, 0.8) inset; }
}

#modal-combat {
    background-color: rgba(0, 0, 0, 0.3) !important; 
    backdrop-filter: blur(2px); 
}

/* MOBILE BOTTOM NAV STYLES */
/* Ẩn trên màn hình lớn */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    display: none; /* Mặc định ẩn */
    height: var(--nav-height);
}

/* Chỉ hiện trên mobile */
@media (max-width: 1024px) {
    .bottom-nav {
        display: grid; /* Grid cho 6 cột */
        grid-template-columns: repeat(6, 1fr);
        align-items: center;
        justify-items: center;
    }
    
    /* Ẩn sidebar trên mobile */
    #sidebar, #sidebar-overlay {
        display: none !important; 
    }
    
    /* Điều chỉnh main content padding */
    #main-content {
        padding-bottom: calc(var(--nav-height) + 20px) !important;
    }
    
    /* Nút menu sidebar trên header cũng ẩn đi */
    header button.lg\:hidden {
        display: none;
    }
}

.bottom-nav-item {
    display: flex;
    flex-col: column;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9ca3af; /* text-gray-400 */
    font-size: 10px;
    transition: all 0.2s;
    gap: 2px;
}

.bottom-nav-item i {
    font-size: 18px;
    margin-bottom: 2px;
}

.bottom-nav-item.active {
    color: var(--gold-primary);
    background: linear-gradient(to top, rgba(234, 179, 8, 0.1), transparent);
    border-top: 2px solid var(--gold-primary);
}

/* SUBMENU BOTTOM SHEET */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 101;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #1a1a1a;
    border-top: 1px solid #333;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    z-index: 102;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    max-height: 60vh;
    overflow-y: auto;
}

.bottom-sheet.open {
    transform: translateY(0);
}

.bottom-sheet-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    color: #ccc;
}

.sheet-item i {
    font-size: 20px;
    color: var(--gold-primary);
}