/* =========================================================================
   FIXED ALIPAYHK SIDEBAR GRAPHICAL RULES (Requirement 1a)
   ========================================================================= */
.alipay-sidebar-sticky-badge {
    position: fixed !important;
    right: 0 !important;          /* Hard-anchored completely flush to the screen edge */
    top: 50% !important;
    left: auto !important;         /* Blocks any theme flex positioning alignments */
    transform: translateY(-50%) !important;
    background-color: #108ee9 !important; /* Official Alipay Blue */
    color: #ffffff !important;
    padding: 12px 10px 12px 10px !important;
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    box-shadow: -3px 4px 16px rgba(0, 0, 0, 0.18) !important;
    cursor: pointer !important;
    z-index: 999999999 !important; /* Forces it stays high above theme header navigation layers */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    text-align: center !important;
    user-select: none !important;
    width: 80px !important;
    height: auto !important;
    box-sizing: border-box !important;
    display: block !important;
    transition: background-color 0.2s ease !important;
}

.alipay-sidebar-sticky-badge:hover {
    background-color: #0076ce !important;
    transform: translateY(-50%) translateX(0) !important; /* Enforces zero horizontal movement */
    right: 0 !important;
}

.alipay-sidebar-content-inner {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

.alipay-sidebar-text-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: 0.3px !important;
    text-transform: uppercase !important;
    display: block !important;
    color: #ffffff !important;
}

.sct-sidebar-clean-logo-img {
    width: 44px !important;
    height: 44px !important;
    object-fit: contain !important; /* Prevents any skewing, compression, or distortion */
    border-radius: 8px !important;
    display: block !important;
    margin: 0 auto !important;
}

/* Responsive Mobile Layout Adaptations (Fixed for Chinese Mobile Layouts) */
@media (max-width: 768px) {
    .alipay-sidebar-sticky-badge {
        top: auto !important;
        bottom: 20px !important;
        transform: none !important;
        border-radius: 50% !important;       /* Transforms rectangle button into a circular floating coin on mobile */
        width: 54px !important;
        height: 54px !important;
        padding: 0 !important;
        right: 15px !important;              /* Locks visible layout position on phone frames */
        left: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
    }
    .alipay-sidebar-sticky-badge:hover {
        transform: scale(1.05) !important;
        right: 15px !important;
        background-color: #0076ce !important;
    }
    .alipay-sidebar-text-label {
        display: none !important;            /* Hide text layers on mobile screens to keep the view neat */
    }
    .sct-sidebar-clean-logo-img {
        width: 32px !important;
        height: 32px !important;
        margin: 0 !important;
    }
}

/* ... [All your existing CSS rules are up here] ... */

/* =========================================================================
   MOBILE COIN BADGE CENTER-ALIGNMENT FIX
   ========================================================================= */
@media (max-width: 768px) {
    /* Target the parent circular container button */
    #alipay-express-sidebar.alipay-sidebar-sticky-badge {
        display: flex !important;
        align-items: center !important;     /* Perfect vertical centering */
        justify-content: center !important;   /* Perfect horizontal centering */
        padding: 0 !important;               /* Strip uneven padding boundaries */
        box-sizing: border-box !important;
    }

    /* Target the inner centering layout wrapper if present */
    #alipay-express-sidebar .alipay-sidebar-content-inner {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Override inherited theme layout rules on the logo element itself */
    #alipay-express-sidebar .sct-sidebar-clean-logo-img {
        margin: 0 !important;                /* Block any theme-inherited margins pushing it off-center */
        position: static !important;         /* Prevent structural relative shifts */
        transform: none !important;          /* Strip arbitrary theme transform adjustments */
        display: block !important;
        flex-shrink: 0 !important;           /* Protects it from shrinking inside the flex tracking row */
        
        /* Enforce tight rendering boundaries matching your reference image */
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
    }
}
