html.ymd-grayscale body > *:not(.ymd-stack):not(.ymd-detail-mask):not(.ge-svga-overlay):not(#ls-gift-banner-container) {
    filter: grayscale(100%) !important;
    -webkit-filter: grayscale(100%) !important;
}

.ymd-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 10020;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    align-items: flex-end;
    pointer-events: none;
}

.ymd-card {
    width: min(360px, calc(100vw - 36px));
    border-radius: var(--ls-radius-lg, var(--ls-border-radius, 16px));
    box-shadow: var(--ls-shadow-lg, 0 24px 80px rgba(0, 0, 0, .18));
    overflow: hidden;
    pointer-events: auto;
    cursor: pointer;
    will-change: transform, opacity;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(51, 51, 51, .85);
    color: #fff;
}

.ymd-card.is-sliding {
    pointer-events: none;
    animation: ymd-slide-out .48s cubic-bezier(.22, .61, .36, 1) forwards;
}

.ymd-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex: none;
}

.ymd-text {
    font-size: 14px;
    line-height: 1.5;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ymd-close {
    flex: none;
    width: 24px;
    height: 24px;
    margin-right: -4px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    opacity: .7;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity .2s, background .2s;
}

.ymd-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, .18);
}

.ymd-detail-mask {
    position: fixed;
    inset: 0;
    z-index: 10030;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.ymd-detail {
    width: min(480px, 100%);
    background: var(--ls-card-bg, #fff);
    border-radius: var(--ls-radius-lg, var(--ls-border-radius, 16px));
    box-shadow: var(--ls-shadow-lg, 0 24px 80px rgba(0, 0, 0, .18));
    animation: ymd-detail-in .2s ease both;
    overflow: hidden;
}

.ymd-detail-art {
    position: relative;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    color: #fff;
    padding: 0 24px;
    background: linear-gradient(135deg, rgba(51, 51, 51, .9), rgba(100, 100, 100, .62));
}

.ymd-detail-art::before {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    right: -38px;
    top: -72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
}

.ymd-detail-art::after {
    content: "";
    position: absolute;
    width: 72px;
    height: 72px;
    left: 44%;
    bottom: -52px;
    border-radius: 24px;
    background: rgba(255, 255, 255, .12);
    transform: rotate(18deg);
}

.ymd-detail-art-icon {
    position: relative;
    z-index: 1;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

.ymd-detail-art-type {
    position: relative;
    z-index: 1;
    font-size: 14px;
    font-weight: 600;
    opacity: .96;
}

.ymd-detail-title {
    padding: 20px 24px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ls-text-primary, #334155);
}

.ymd-detail-content {
    padding: 14px 24px 18px;
    color: var(--ls-text-secondary, #64748b);
    font-size: 15px;
    line-height: 1.85;
    word-break: break-word;
    white-space: pre-wrap;
}

.ymd-reward {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 20px 16px;
    padding: 10px 12px;
    background: rgba(47, 107, 255, .06);
    border: 1px solid rgba(47, 107, 255, .14);
    border-radius: 10px;
}

.ymd-reward-icon {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    color: #fff;
    font-size: 15px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ymd-reward-text {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--ls-text-primary, #1b1f2a);
    word-break: break-word;
}

.ymd-reward-tip {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--ls-text-secondary, #9aa1ad);
}

.ymd-reward-btn {
    flex: 0 0 auto;
    padding: 7px 16px;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    background: #2f6bff;
    border: 0;
    border-radius: 999px;
}

.ymd-reward-btn[disabled] {
    color: #9aa1ad;
    cursor: default;
    background: rgba(15, 18, 26, .06);
}

.ymd-detail-foot {
    display: flex;
    padding: 15px;
    background: var(--ls-card-bg, #fff);
    justify-content: center;
}

.ymd-ok {
    border: 0;
    border-radius: var(--ls-radius-md, var(--ls-border-radius-sm, 10px));
    padding: 9px 20px;
    background: var(--ls-primary, #4f46e5);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    box-shadow: var(--ls-shadow-sm, 0 6px 16px rgba(79, 70, 229, .18));
}

.ymd-ok:hover { filter: brightness(1.04); }

html.ymd-grayscale .ymd-reward {
    background: rgba(51, 51, 51, .06);
    border-color: rgba(51, 51, 51, .14);
}

html.ymd-grayscale .ymd-reward-icon {
    background: linear-gradient(135deg, #555, #888);
}

html.ymd-grayscale .ymd-reward-btn {
    background: #555;
}

html.ymd-grayscale .ymd-reward-btn[disabled] {
    color: #9aa1ad;
    background: rgba(15, 18, 26, .06);
}

html.ymd-grayscale .ymd-ok {
    background: #555;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}

@media (max-width: 640px) {
    .ymd-stack {
        right: 12px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        left: 12px;
    }

    .ymd-card {
        width: min(300px, calc(100vw - 24px));
        height: 55px;
        box-sizing: border-box;
        padding: 10px 12px;
    }

    .ymd-icon {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        font-size: 16px;
    }

    .ymd-text {
        font-size: 13px;
    }

    .ymd-close {
        width: 22px;
        height: 22px;
        font-size: 15px;
    }

    .ymd-detail-art { height: 50px; padding: 0 20px; }
    .ymd-detail-art-icon { width: 32px; height: 32px; border-radius: 11px; font-size: 17px; }
}

@keyframes ymd-slide-out {
    0% { opacity: 1; transform: translateX(0) scale(1); }
    70% { opacity: .35; }
    100% { opacity: 0; transform: translateX(120%) scale(.98); }
}

@keyframes ymd-detail-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: none; }
}

/* --- Gift Section --- */
.ymd-gift-section {
    padding: 0 20px 14px;
}

.ymd-gift-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ls-text-secondary, #64748b);
    margin-bottom: 10px;
}

.ymd-gift-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.ymd-gift-list::-webkit-scrollbar { display: none; }

.ymd-gift-item {
    flex: 0 0 auto;
    width: 72px;
    text-align: center;
    cursor: pointer;
    border-radius: 10px;
    padding: 8px 4px;
    border: 2px solid transparent;
    transition: border-color .2s, background .2s;
}

.ymd-gift-item:hover,
.ymd-gift-item.is-selected {
    border-color: var(--ls-primary, #4f46e5);
    background: rgba(79, 70, 229, .06);
}

.ymd-gift-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    margin: 0 auto 4px;
}

.ymd-gift-name {
    font-size: 12px;
    color: var(--ls-text-primary, #334155);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ymd-gift-price {
    font-size: 11px;
    color: var(--ls-text-secondary, #9aa1ad);
    margin-top: 2px;
}

.ymd-gift-action {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.ymd-gift-qty {
    width: 60px;
    height: 32px;
    border: 1px solid var(--ls-border, #e2e8f0);
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    color: var(--ls-text-primary, #334155);
    background: var(--ls-card-bg, #fff);
}

.ymd-gift-send {
    flex: 1;
    height: 32px;
    border: 0;
    border-radius: 999px;
    background: var(--ls-primary, #4f46e5);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: filter .2s;
}

.ymd-gift-send:hover { filter: brightness(1.06); }
.ymd-gift-send[disabled] {
    opacity: .5;
    cursor: default;
}

html.ymd-grayscale .ymd-gift-item.is-selected {
    border-color: #555;
    background: rgba(51, 51, 51, .06);
}

html.ymd-grayscale .ymd-gift-send {
    background: #555;
}

/* --- Barrage (飘屏) --- */
.ymd-barrage {
    position: fixed;
    inset: 0;
    z-index: 10010;
    pointer-events: none;
    overflow: hidden;
}

.ymd-barrage-item {
    position: absolute;
    right: -420px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    animation: ymd-barrage-fly 6s linear forwards;
    pointer-events: none;
}

.ymd-barrage-sender {
    font-weight: 600;
    color: #fbbf24;
}

.ymd-barrage-gift {
    color: #fca5a5;
}

.ymd-barrage-gift-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
}

@keyframes ymd-barrage-fly {
    0%   { transform: translateX(0); }
    100% { transform: translateX(calc(-100vw - 420px)); }
}
