/* ===== ROOT VARIABLES FOR OPTIMIZATION ===== */
:root {
    --backdrop-blur: blur(3px);
    --backdrop-filter: blur(3px);
    --shadow-base: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-backdrop: 0 10px 15px var(--swal2-backdrop);
    --border-radius-sm: 5px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --transition-base: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --backdrop-bg: rgba(255, 255, 255, 0.05);
    --text-shadow: 2px 2px 4px #000;
    --glow-orange: 0 0 20px var(--swal2-footer-border-color);
    --button-bg: linear-gradient(145deg, #2c2c5e, #1a1a3a);
    --button-border: 4px double var(--swal2-footer-border-color);
}
/* ==================== POPUP MISSION ==================== */
.modal-dialog {
    height: 100% !important;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header span {
    font-weight: bold;
    font-size: 18px;
    text-transform: uppercase;
}
.modal-body {
    padding: 0;
    overflow: hidden !important;
    position: relative;
}
div:where(.swal2-container).swal2-center > .swal2-popup, .modal-content {
    border-radius: 5px !important;
    background: radial-gradient(circle at center, #7800ffa3, rgb(0 0 0)) !important;
    box-shadow: 0 4px 15px #fff, inset 0 0 10px #f8f9fa !important;
    backdrop-filter: blur(3px) !important;
    -webkit-backdrop-filter: blur(3px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    outline: 1px solid rgba(255, 255, 255, 0.8) !important;
    color: #e5d7ff !important;
}
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
}
#openPopupMission, #openPopupShops, .main-icon, .guide-trigger {
    border-radius: 50% !important;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
    margin-bottom: 10px;
}
#openPopupMission, #openPopupShops, .main-icon, .guide-trigger {
    height: 30px;
    width: 30px;
    background: #fff;
    border-radius: 2px;
    display: flex;
    flex-direction: center;
    align-items: center;
    justify-content: space-around;
}
.guide-trigger img {
    width: 100%;
}
.global-fade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 10000;
    transition: opacity 2s ease-in-out;
}
/* ==================== HEADER & LISTS ==================== */
.user-image img{
    border-radius: 50%;
    width: 30px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.header-wrapper {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 5px;
    padding: 5px;
    width: 100%;
    height: 40px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 0 10px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    outline: 1px solid rgba(255, 255, 255, 0.8);
}
.header-row {
    justify-content: flex-start;
    position: absolute;
    top: 0;
    z-index: 1001;
    background-color: white;
    border-radius: inherit;
}
.stat-container {
    display: flex;
    align-items: center;
    padding: 0 0 0 10px;
    gap: 15px;
    background-color: var(--swal2-backdrop);
    color: #fff;
    border-radius: 20px;
}
.mission-list {
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
    width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.mission-list::-webkit-scrollbar { display: none; }
.mission-new {
    position: absolute;
    top: -20px;
    right: 30px;
    width: 50px;
    z-index: -1;
}
.map-menu {
    display: flex;
    position: absolute;
    top: 0px;
    right: 50px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    padding: 10px;
    gap: 10px;
    z-index: 1000;
}
.layer-icon {
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}
.layer-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}
.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.stat-item i {
    color: var(--orange);
}
.stat-item span {
    font-size: 12px;
}
.pay-button {
    color: #fff !important;
    border-radius: 50%;
    background: var(--swal2-backdrop);
    padding: 8px;
    font-size: 12px;
}
/* ==================== CARD & IMAGE STYLES ==================== */
.border-wrapper {
    position: relative;
}
.img-wrapper,
.mission-img {
    border-radius: var(--border-radius-sm);
    background: var(--backdrop-bg);
    box-shadow: var(--shadow-base), inset 0 0 10px rgba(255, 255, 255, 0.5);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-filter);
    border: 1px solid rgba(255, 255, 255, 0.6);
    outline: 1px solid rgba(255, 255, 255, 0.8);
}
.mission-img {
    width: 100%;
    height: auto;
}
/* ==================== AI LIST ==================== */
.ai-overlay {
    position: absolute;
    width: 119px;
    height: 120px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
}
.ai-overlay.show {
    opacity: 1;
}
.ai-opponent-item {
    position: absolute;
    width: 40px;
    height: 40px;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}
.ai-opponent-item img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    filter: drop-shadow(0 0 20px var(--orange));
    background: var(--backdrop-bg);
    box-shadow: var(--shadow-base), inset 0 0 10px rgba(255, 255, 255, 0.5);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-filter);
    border: 1px solid rgba(255, 255, 255, 0.6);
    outline: 1px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
}
.hunter-marker {
    filter: drop-shadow(0 0 20px var(--blue));
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: var(--backdrop-bg);
    box-shadow: var(--shadow-base), inset 0 0 10px rgba(255, 255, 255, 0.5);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-filter);
    border: 1px solid rgba(255, 255, 255, 0.6);
    outline: 1px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
}
/* ==================== GAME CARD ==================== */
.game-card {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px;
    height: 80px;
    margin-bottom: 30px;
    border-radius: 15px;
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.35);
}
.game-card h5 { margin: 0 !important; }
.card-image { width: 100px; }
.game-card .card-icon-personal,
.game-card .card-icon-team,
.game-card .card-icon-travel {
    position: absolute;
    color: white;
    opacity: 0.3;
    font-size: 30px;
}
/* Icon positions (giữ nguyên) */
.card-icon-personal.icon-personal-1 { top:15%; left:25%; transform:rotate(20deg); }
.card-icon-personal.icon-personal-2 { top:55%; left:65%; transform:rotate(-15deg); }
.card-icon-personal.icon-personal-3 { top:75%; left:35%; transform:rotate(10deg); }
.card-icon-personal.icon-personal-4 { top:35%; left:85%; transform:rotate(10deg); }
.card-icon-team.icon-team-1 { top:25%; left:70%; transform:rotate(-20deg); }
.card-icon-team.icon-team-2 { top:65%; left:20%; transform:rotate(25deg); }
.card-icon-team.icon-team-3 { top:35%; left:50%; transform:rotate(-10deg); }
.card-icon-team.icon-team-4 { top:45%; left:40%; transform:rotate(-40deg); }
.card-icon-travel.icon-travel-1 { top:20%; left:30%; transform:rotate(15deg); }
.card-icon-travel.icon-travel-2 { top:60%; left:75%; transform:rotate(-25deg); }
.card-icon-travel.icon-travel-3 { top:40%; left:45%; transform:rotate(5deg); }
/* ==================== ANIMATIONS ==================== */
/* Wolf animations */
@keyframes sleeping { 100% { background-position: -236px; } }
@keyframes wakeup   { 100% { background-position: -253px; } }
@keyframes walk     { 100% { background-position: -320px; } }
@keyframes run      { 100% { background-position: -320px; } }
@keyframes bark     { 100% { background-position: -256px; } }
/* Marquee */
@keyframes marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}
/* ==================== BOTTOM BAR ELEMENTS ==================== */
#wolf-container,
#shark-container {
    position: absolute;
    width: 100%;
    bottom: 0;
    z-index: 2;
    padding: 0;
    margin: 0;
}
#wolf-container { max-height: 100px; overflow: hidden; display: flex; align-items: flex-end; }
#sharkCanvas {
    position: absolute;
    bottom: -30px;
    left: 0;
    width: 100%;
    height: 150px;
    pointer-events: none;
}
#dragon-skull-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 300px;
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
}
#dragon-skullCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* ==================== RADAR ==================== */
#room-radar-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
#radar-image {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 210px;
    aspect-ratio: 1 / 1;
    pointer-events: none;
    z-index: 1;
}
.radar-bg {
    position: absolute;
    inset: 0;
    background-size: contain;
    background-position: center;
}
.radar-bg.default-background {
    filter: grayscale(100%);
}
#radar_item, #radar_no_item {
    width: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, #043b0b30, #021e04);
    border: 2px solid rgba(0, 255, 0, 0.5);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}
/* ==================== SHOP & TABS ==================== */
#shopsTab, #treasureTab, #friendTabs, #connectTabs, #connectJourneyTabs {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    margin-bottom: 0;
    border-radius: 5px;
}
#shopsTab { padding: 0; margin: 0; list-style: none; overflow-y: auto; }
#shopsTab .nav-item { width: 100%; padding: 0 5px 0 0; }
#shopsTab .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    font-size: 16px;
    color: #fff !important;
    background-color: var(--swal2-validation-message-color);
    border: 1px solid #444;
    border-radius: 5px;
    margin-bottom: 10px;
    transition: all 0.3s;
}
#shopsTab .nav-link i { margin-right: 10px; }
#shopsTab .nav-link:hover,
#shopsTab .nav-link:focus {
    background: #444;
    color: #f39c12;
    box-shadow: 0 0 10px rgba(243,156,18,0.8);
    transform: translateX(5px);
}
#shopsTab .nav-link.active {
    background: #f39c12;
    color: #fff;
    box-shadow: 0 0 10px rgba(243,156,18,1);
    font-weight: bold;
}
#shopsTab .nav-link { opacity: 0; animation: fadeIn 0.5s forwards; }
.shops-view-items { transition: filter 0.3s, opacity 0.3s; }
/* ==================== LOADING ==================== */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    color: white;
    font-size: 16px;
    transition: opacity 0.3s;
}
#image-container { width: 300px; height: 25px; position: relative; overflow: hidden; }
#image-container img { width: 50px; position: absolute; left: 0; transition: left 0.3s; }
#loading-progress { width: 300px; height: 10px; border-radius: 10px; overflow: hidden; background: var(--backdrop-bg); box-shadow: var(--shadow-base), inset 0 0 10px rgba(255, 255, 255, 0.5); backdrop-filter: var(--backdrop-blur); -webkit-backdrop-filter: var(--backdrop-filter); }
#progress-bar { width: 0%; height: 100%; background: var(--orange); transition: width 0.3s; }
#loading-text { max-width: 250px; text-align: center; white-space: normal; word-wrap: break-word; font-size:14px}
/* ==================== LAYOUT & MAP ==================== */
.container-fluid { max-width: 100%; }
.h-vh-100 { height: 100dvh; overflow-x: hidden; box-sizing: border-box; }
#header-section {
    height: 100%;
    flex: 1;
}
.leaflet-container { position: absolute; inset: 0; width: 100%; height: 100% !important; z-index: 1; }
/* ==================== RESPONSIVE ==================== */
@media (min-width: 768px) {
    #shark-container,
    #wolf-container,
    #radar-container { position: absolute; bottom: 0; }
    #radar-container { bottom: 60px; }
    #dragon-skull-container { position: fixed; bottom: 50px; }
}
@media (max-width: 768px) {
    #dragon-skull-container { position: fixed; bottom: 50px; }
}
@media (min-width: 1025px) {
    #sidebar, #sidebar-content, .card-body { height: calc(100vh - 50px); overflow: hidden; }
    .tab-container { height: 100%; position: relative; }
}
/* ==================== MISC ==================== */
.gap-1 { gap: 10px; }
.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-lg) !important;
    cursor: pointer !important;
    text-shadow: var(--text-shadow) !important;
    border: var(--button-border) !important;
    background: var(--button-bg) !important;
    color: var(--white) !important;
    --swal2-action-button-focus-box-shadow: none !important;
    box-shadow: var(--glow-orange) !important;
    transition: var(--transition-base) !important;
    overflow: hidden !important;
    padding: 10px;
}
.back-button i { color: #fff; font-size: 18px; }
.circle-with-label {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 60px;
}
.circle-with-label > .label {
    font-size: 10px;
    color: #000;
    text-align: center;
    line-height: normal;
    margin-top: -15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    background: linear-gradient(to right, rgba(130, 129, 129, 0) 0%, #fff 30%, #fff 70%, rgba(130, 129, 129, 0) 100%), 
                linear-gradient(to bottom, rgba(130, 129, 129, 0) 0%, #82818140 10px, #82818140 calc(100% - 10px), rgba(130, 129, 129, 0) 100%);
    background-blend-mode: multiply;
    border-radius: 3px;
    z-index: inherit;
}
.circle-with-label i {
    font-size: 16px;
}
#notificationContainer {
    color: #fff;
    text-align: center;
    line-height: normal;
    margin-top: 0px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 30%, rgba(0, 0, 0, 0.8) 70%, rgba(0, 0, 0, 0) 100%), linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 10px, rgba(0, 0, 0, 0.5) calc(100% - 10px), rgba(0, 0, 0, 0) 100%);
    background-blend-mode: multiply;
    border-radius: 3px;
    z-index: 2;
    position: absolute;
    top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 40px;
    justify-content: center;
}
.marquee-container { overflow: hidden; position: relative; text-align: center; }
.marquee-text {
    display: inline-block;
    white-space: nowrap;
    animation: marquee 8s linear infinite;
    font-size: 12px;
    color: #fff;
    padding-left: 100%;
}
.marquee-text:hover { animation-play-state: paused; }
.static-text { font-size: 12px; color: #fff; text-align: center; font-weight: bold; }
.leaflet-div-icon { background: none; border: none; }
.leaflet-touch .leaflet-bar { border: none !important; }