@keyframes wsn-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.4); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(229, 57, 53, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 57, 53, 0); }
}

.wsn-container {
    margin-bottom: 20px;
    font-size: 14px;
    color: #333;
    min-height: 42px; 
    display: flex;
    align-items: center;
    position: relative; 
    z-index: 99; 
    clear: both; 
}

.wsn-content {
    display: inline-flex;
    align-items: center;
    gap: 10px; 
    padding: 6px 15px; 
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e0e0e0;
    border-radius: 50px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-width: 100%; 
    box-sizing: border-box; 
    /* 移除之前的 flex 设置，让其自适应内容宽度 */
}

.wsn-icon {
    font-size: 1.2em;
    line-height: 1;
    animation: wsn-pulse 2s infinite;
    background: #ffebee;
    color: #e53935;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0; 
}

.wsn-sold-badge {
    background: #ffebee;
    color: #e53935;
    padding: 4px 8px; 
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9em; 
    display: inline-flex;
    align-items: center;
    gap: 4px;
    animation: wsn-pulse 2s infinite;
    white-space: nowrap; 
    flex-shrink: 0;      
}

/* 文本容器：关键修复 */
.wsn-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.3;
    position: relative;
    height: 1.3em; 
    overflow: hidden; 
    display: block; 
    /* Web端策略：自适应宽度，但给足够空间 */
    flex: 1; 
    min-width: 250px; /* 增加最小宽度，防止长名字截断 */
}

/* 单条消息样式 */
.wsn-msg-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden; /* 防止超出容器 */
    text-overflow: ellipsis; /* 长名字显示省略号 */
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
    will-change: transform, opacity;
}

/* 动画状态 */
.wsn-msg-enter {
    transform: translateY(100%);
    opacity: 0;
}
.wsn-msg-enter-active {
    transform: translateY(0);
    opacity: 1;
}
.wsn-msg-leave-active {
    transform: translateY(-100%);
    opacity: 0;
}

.wsn-text strong {
    color: #d32f2f;
    font-weight: 700;
}

.wsn-time {
    color: #757575;
    font-size: 0.9em;
    margin-left: 4px;
    white-space: nowrap; 
}

/* 适配移动端 */
@media (max-width: 768px) {
    .wsn-container {
        font-size: 12px; 
        min-height: 38px;
        position: relative;
        z-index: 999; 
        display: flex !important;
        margin-top: 15px !important; 
        margin-bottom: 15px !important;
        width: 100%;
        justify-content: flex-start; 
    }
    
    .wsn-content {
        padding: 5px 10px; 
        justify-content: flex-start; 
        width: 100%; /* 强制占满，给内部文字足够空间 */
        max-width: 100%;
        overflow: hidden;
        display: flex; /* 确保是 flex 布局 */
    }

    .wsn-text {
        min-width: 0; /* 允许缩小 */
        flex: 1; /* 占满剩余空间 */
        width: auto; /* 自动宽度 */
        height: 1.4em; 
        display: block; /* 必须是 block 才能 hidden */
        position: relative;
    }

    .wsn-msg-item {
        /* 移动端强制显示，即使很长也显示省略号，而不是消失 */
        overflow: hidden; 
        text-overflow: ellipsis;
        white-space: nowrap;
        width: 100%; /* 占满父容器 */
    }

    /* 修复：针对部分安卓机型，如果 flex item 宽度计算为 0，强制给个最小宽度 */
    /* 或者使用 calc() */
    
    @media (max-width: 360px) {
        .wsn-time {
            font-size: 0.8em;
        }
        .wsn-sold-badge {
            font-size: 0.8em;
            padding: 3px 6px;
        }
    }
}
