.weekly-red-packet {
    position: relative;
    z-index: 5;
    width: 232px;
    max-width: 100%;
    margin: 28px auto 0;
    color: #fff;
    animation: red-packet-enter .58s cubic-bezier(.16, 1, .3, 1) both;
}

.weekly-red-packet[hidden] { display: none; }

.red-packet-trigger {
    position: relative;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 72px;
    padding: 10px 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 224, 190, .68);
    border-radius: 8px;
    background: linear-gradient(135deg, #b91c1c, #dc2626 48%, #991b1b);
    box-shadow: 0 14px 32px rgba(127, 29, 29, .4), inset 0 1px rgba(255, 255, 255, .32);
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform .18s ease, filter .18s ease;
}

.red-packet-trigger::before {
    position: absolute;
    inset: 0;
    content: '';
    background: linear-gradient(112deg, transparent 32%, rgba(255, 255, 255, .22) 47%, transparent 63%);
    transform: translateX(-120%);
    animation: red-packet-shine 2.5s ease-in-out infinite;
    pointer-events: none;
}

.red-packet-trigger:hover {
    transform: translateY(-3px) rotate(-1deg);
    filter: brightness(1.08);
}

.red-packet-trigger:active {
    transform: scale(.96);
}

.red-packet-trigger:focus-visible {
    outline: 3px solid #fef08a;
    outline-offset: 3px;
}

.red-packet-trigger:disabled {
    cursor: wait;
    filter: saturate(.55);
}

.red-packet-icon {
    position: relative;
    z-index: 1;
    display: block;
    width: 42px;
    height: 45px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .32));
    transform-origin: center bottom;
    animation: red-packet-icon-float 1.8s ease-in-out infinite;
}

.red-packet-copy {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 3px;
    min-width: 0;
    text-align: left;
}

.red-packet-copy b {
    overflow-wrap: anywhere;
    font-size: 15px;
    letter-spacing: 0;
}

.red-packet-copy small {
    overflow-wrap: anywhere;
    color: #fee2e2;
    font-size: 11px;
    line-height: 1.35;
}

.red-packet-seal {
    position: relative;
    z-index: 1;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    filter: drop-shadow(0 3px 5px rgba(80, 42, 0, .42));
}

.red-packet-seal img {
    display: block;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.red-packet-status {
    margin: 7px 5px 0;
    color: rgba(255, 255, 255, .76);
    font-size: 11px;
    line-height: 1.4;
    text-align: right;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

.red-packet-spark {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fef08a;
    box-shadow: 0 0 14px #facc15;
    animation: red-packet-spark 1.45s ease-in-out infinite;
    pointer-events: none;
}

.red-packet-spark-one {
    top: -6px;
    left: 42px;
}

.red-packet-spark-two {
    right: 24px;
    bottom: 14px;
    animation-delay: .6s;
}

.weekly-red-packet.is-claimed .red-packet-trigger {
    border-color: rgba(255, 255, 255, .18);
    background: #374151;
}

.weekly-red-packet.is-claimed .red-packet-icon {
    opacity: .7;
    animation: none;
}

.weekly-red-packet.is-success .red-packet-trigger {
    animation: red-packet-win .75s ease both;
}

.weekly-red-packet.is-success .red-packet-icon {
    animation: red-packet-icon-win .75s ease both;
}

.weekly-red-packet.is-opening .red-packet-icon {
    animation: red-packet-opening .42s ease-in-out infinite alternate;
}

.red-packet-reward-burst {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.red-packet-reward-burst strong {
    position: absolute;
    left: 50%;
    top: 24px;
    padding: 7px 12px;
    border: 2px solid #fff4b5;
    border-radius: 7px;
    background: #facc15;
    box-shadow: 0 8px 24px rgba(80, 42, 0, .42);
    color: #7c2d12;
    font-size: 18px;
    font-weight: 950;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    animation: red-packet-reward-label 1.45s cubic-bezier(.16, 1, .3, 1) both;
}

.red-packet-coin {
    --coin-x: 0px;
    --coin-y: -60px;
    --coin-delay: 0ms;
    position: absolute;
    left: calc(50% - 10px);
    top: 30px;
    display: block;
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 3px 5px rgba(80, 42, 0, .42));
    animation: red-packet-coin-fly 1.05s cubic-bezier(.2, .8, .2, 1) var(--coin-delay) both;
}

@keyframes red-packet-enter {
    from { opacity: 0; transform: translateY(22px) scale(.86); }
    to { opacity: 1; transform: none; }
}

@keyframes red-packet-shine {
    0%, 45% { transform: translateX(-120%); }
    72%, 100% { transform: translateX(140%); }
}

@keyframes red-packet-icon-float {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-3px) rotate(2deg); }
}

@keyframes red-packet-icon-win {
    25% { transform: translateY(-7px) scale(1.12) rotate(-7deg); }
    60% { transform: translateY(1px) scale(.96) rotate(4deg); }
}

@keyframes red-packet-opening {
    from { transform: translateX(-2px) rotate(-8deg) scale(.98); }
    to { transform: translateX(2px) rotate(8deg) scale(1.07); }
}

@keyframes red-packet-reward-label {
    0% { opacity: 0; transform: translate(-50%, 8px) scale(.35); }
    24%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -86px) scale(.9); }
}

@keyframes red-packet-coin-fly {
    0% { opacity: 0; transform: translate(0, 0) scale(.35) rotate(0); }
    16% { opacity: 1; }
    76% { opacity: 1; transform: translate(var(--coin-x), var(--coin-y)) scale(1) rotate(300deg); }
    100% { opacity: 0; transform: translate(var(--coin-x), calc(var(--coin-y) + 24px)) scale(.65) rotate(420deg); }
}

@keyframes red-packet-spark {
    50% { opacity: .35; transform: translateY(-7px) scale(1.45); }
}

@keyframes red-packet-win {
    30% { transform: scale(1.07) rotate(2deg); }
    64% { transform: scale(.95) rotate(-1deg); }
}

@media (max-width: 650px) {
    .weekly-red-packet {
        width: min(218px, calc(100vw - 20px));
        margin-top: 22px;
    }

    .red-packet-trigger {
        grid-template-columns: 42px minmax(0, 1fr) 30px;
        gap: 8px;
        min-height: 68px;
        padding: 9px 10px;
    }

    .red-packet-icon {
        width: 38px;
        height: 41px;
    }

    .red-packet-copy b {
        font-size: 14px;
    }

    .red-packet-seal {
        width: 30px;
        height: 30px;
    }

    .red-packet-seal img {
        width: 26px;
        height: 26px;
    }
}

@media (max-width: 360px) {
    .weekly-red-packet {
        width: min(218px, calc(100vw - 20px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .weekly-red-packet,
    .red-packet-trigger::before,
    .red-packet-icon,
    .red-packet-spark,
    .red-packet-reward-burst strong,
    .red-packet-coin {
        animation: none;
    }
}
