/* Character Info */
.character-info {
    position: absolute;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 5px;
    z-index: 1;
}
.character-bar {
    max-width: 200px;
    width: 100%;
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}
.avatar-bg {
    position: absolute;
    left: 20px;
    height: 80%;
    width: 100%;
    background: linear-gradient(90deg, rgba(18, 18, 18, 0.65) 0%, rgba(18, 18, 18, 0.45) 15%, rgba(18, 18, 18, 0.25) 35%, rgba(18, 18, 18, 0.08) 60%, rgba(18, 18, 18, 0.02) 85%, rgba(18, 18, 18, 0) 100%);
    pointer-events: none;
}
.character-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 80px;
    aspect-ratio: 1 / 1;
}
.avatar-frame {
    width: 100%;
    animation: ringRotate 20s linear infinite;
}
.avatar-icon {
    position: absolute;
    border-radius: 50%;
    width: 80%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    animation: avatarFloat 4s ease-in-out infinite;
}
.character-name {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    font-size: 0.8em;
    color: #eee;
    z-index: 1;
}
.character-swap {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.checkin-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    cursor: pointer;
}
.progress-bar-bg {
    width: 100%;
    height: 14px;
    background: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bar-treasure {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    z-index: 2;
}
.treasure-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 0.65em;
    color: #ffdd88;
    z-index: 3;
    position: relative;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(180deg, rgba(76, 109, 145, .78) 0%, rgba(39, 63, 93, .90) 40%, rgb(0 110 255 / 96%) 100%);
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 5px;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
}
.map-vietnam {
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.5;
}
.check-in {
    position: absolute !important;
    inset: 0;
    gap: 10px;
}
.character-user {
    max-width: 200px;
    filter: drop-shadow(-6px 8px 12px rgba(0, 4, 16, 0.6));
    border-radius: 5px;
}
.user-gem {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    background: rgb(0 0 0 / 5%);
    height: 80%;
    padding: 5px;
    border-radius: 12px;
    color: #eee !important;
    font-size: 0.8em;
}
.user-gem img {
    animation: gemGlow 2s infinite;
}
.character-setting {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #fff;
}
.seting-item {
    color: #eee;
    background: rgb(0 0 0 / 20%);
    border-radius: 50%;
    padding: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}
.seting-item:hover {
    transform: scale(1.06);
}
.shop-ongbut,
.rank-index,
.setting-avatar {
    width: 30px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
}
/* ================= POPUP MENU ================= */
.shopongbut,
.user-pet,
.user-clan,
.user-backpack,
.user-setting,
.user-gem-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.user-setting .character-user {
    aspect-ratio: 1 / 1;
}
.clan-header {
    text-align: center;
    margin-bottom: 12px;
}
.clan-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
}
.clan-name {
    color: #ffd86b;
    margin: 8px 0 4px;
}
.clan-meta {
    color: #a0f7ff;
    margin: 0;
}
.popup-body-mobile.rank {
    width: 100%;
    overflow-y: auto;
    scrollbar-width: none;
}
.popup-body-mobile.rank::-webkit-scrollbar { display: none; }
.friend-item.is-me {
    background: rgba(255, 216, 107, 0.12);
    border: 1px solid #ffe68a;
    height: 100%;
}
.auth-form-body {
    transition: opacity .18s ease;
}
.auth-field {
    background: rgb(0 0 0 / 50%);
    border: none;
    color: #fff;
    font-size: 0.9em;
    border-radius: 4px;
    padding: 8px 10px;
    outline: none;
}
.auth-error {
    min-height: 18px;
    color: #ff8a8a;
    font-size: 0.85em;
}
.auth-switch {
    margin-top: 8px;
    font-size: 0.85em;
    color: #ccc;
}
.auth-link {
    color: #ffd86b;
    cursor: pointer;
}
/* ================= GEM BAR ================= */
.gem-bar {
    padding: 5px 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
}
.gem-bar .img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    z-index: 2;
}
.fund-label {
    color: #ddd;
    font-size: 0.8em;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.fund-label strong {
    color: #ffdd88;
}
.user-gem-info span {
    text-align: left;
    white-space: pre-line;
    font-size: 1em;
}
/* ================= FUND TABLE ================= */
.fund-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.fund-balance {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}
.fund-total {
    font-size: 13px;
    opacity: 0.7;
    font-weight: 400;
}
.fund-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    overflow: hidden;
}
.fund-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd86b, #ff9f43);
    border-radius: 20px;
}
.fund-percent {
    font-size: 11px;
    color: #a0f7ff;
}
.fund-peak {
    font-size: 12px;
    color: #a0f7ff;
    margin-top: 4px;
}
.fund-peak strong {
    color: #7CFF9A;
}
/* Bảng 4 cột */
.fund-table {
    width: 100%;
    border-radius: 5px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
}
.fund-row {
    display: grid;
    grid-template-columns: 55px 1.4fr 60px 85px;
    align-items: center;
    padding: 9px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12.5px;
}
.fund-row:last-child {
    border-bottom: none;
}
.fund-progress-fill {
    width: var(--fund-percent, 0%);
}
.fund-row.fund-empty .fund-col {
    grid-column: 1 / -1;
    text-align: center;
    color: #aaa;
}
.fund-header {
    background: rgba(255, 216, 107, 0.12);
    color: #ffd86b;
    font-weight: 600;
    font-size: 12px;
}
.fund-col.id {
    color: #aaa;
    font-size: 11px;
}
.fund-col.name {
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fund-col.eat {
    text-align: center;
    font-weight: 600;
    color: #fff;
}
.fund-col.donate {
    text-align: right;
    font-weight: 600;
}
.fund-col.donate.has-donate {
    color: #7CFF9A;
}
.fund-col.donate.no-donate {
    color: #ff9f9f;
    opacity: 0.85;
}
.fund-note {
    font-size: 11.5px;
    color: #bbb;
    padding: 0 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
/* =====================================================
   9. CART
   ===================================================== */
.cart .friend-avatar .img {
    border-radius: 2px !important;
}

.popup-body-mobile.cart {
    width: 100%;
    overflow-y: auto;
    scrollbar-width: none;
}

#ordersPopup .friend-item.is-me {
    background: rgba(255, 216, 107, 0.12);
    border: none;
    height: 100%;
}
.cancel-order-popup {
    
}
.friend-level {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.cart-price {
    font-family: Arial, sans-serif;
    font-weight: 700;
    color: #FF9800;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.product-img {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.product-img .frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 1;
}
.product-img .img {
    width: 90%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 2px;
    z-index: 1;
}
.order-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.72);
    color: #FFE082;
    font-size: 0.68em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 1;
}