/* 个人中心圣诞彩蛋（12/25 当天）：纯装饰层，不接收点击、不改页面布局。
   落雪和暴风雪画在 canvas 上，这里只管结霜、提示条和圣诞帽。
   风声跟随站内「交互音效」开关，没有单独的按钮。 */

#holiday-effects-layer > .holiday-blizzard {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 个人中心改用暴风雪引擎后，旧的雪花画布让位，避免两层雪叠在一起 */
#holiday-effects-layer.is-blizzard > .holiday-snow {
    display: none;
}

/* 个人中心当天把动效层抬到卡片之上（卡片 z-index: 20），
   否则点击雪雾会被白色卡片盖住；弹窗仍是 9990 以上，不受影响。 */
#holiday-effects-layer.is-blizzard {
    z-index: 25;
}

#holiday-effects-layer .holiday-blizzard-frost {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .9s ease;
    background: radial-gradient(ellipse 76% 66% at 50% 46%, transparent 34%, rgba(198, 228, 255, .46) 70%, rgba(140, 190, 242, .72) 100%);
    box-shadow: inset 0 0 120px rgba(150, 200, 246, .55), inset 0 0 30px rgba(255, 255, 255, .7);
}

[data-color-mode="dark"] #holiday-effects-layer .holiday-blizzard-frost {
    background: radial-gradient(ellipse 76% 66% at 50% 46%, transparent 38%, rgba(84, 132, 196, .28) 72%, rgba(48, 84, 140, .52) 100%);
    box-shadow: inset 0 0 90px rgba(86, 138, 210, .34), inset 0 0 22px rgba(210, 233, 255, .16);
}

#holiday-effects-layer.is-storming .holiday-blizzard-frost {
    opacity: 1;
}

#holiday-effects-layer .holiday-blizzard-toast {
    position: absolute;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
    max-width: calc(100vw - 32px);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .86);
    color: #2f5f8f;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 8px 24px rgba(88, 145, 214, .22);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 10px);
    transition: opacity .35s ease, transform .35s ease, visibility .35s;
    pointer-events: none;
}

[data-color-mode="dark"] #holiday-effects-layer .holiday-blizzard-toast {
    background: rgba(28, 40, 58, .84);
    color: #dfe9f6;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

#holiday-effects-layer .holiday-blizzard-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* 卡顶积雪：只在圣诞当天的个人中心出现，压一条白色雪脊在卡片上沿 */
#page-profile.holiday-blizzard-profile .profile-user-card {
    overflow: visible;
}

#page-profile.holiday-blizzard-profile .profile-user-card::before {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    top: -6px;
    height: 12px;
    pointer-events: none;
    border-radius: 999px;
    background:
        radial-gradient(60% 140% at 16% 100%, rgba(255, 255, 255, .98) 0 58%, transparent 60%),
        radial-gradient(52% 130% at 50% 100%, rgba(255, 255, 255, .92) 0 60%, transparent 62%),
        radial-gradient(60% 140% at 86% 100%, rgba(255, 255, 255, .98) 0 58%, transparent 60%);
    filter: drop-shadow(0 2px 3px rgba(140, 190, 240, .5));
}

/* 圣诞帽：坐在头像头顶正中，点一下抖雪。
   位置和旋转由 holiday-blizzard.js 按头像实测尺寸写入，这里只管外观。 */
.holiday-santa-hat {
    position: absolute;
    z-index: 21;
    padding: 0;
    line-height: 0;
    border: 0;
    background: none;
    cursor: pointer;
    pointer-events: auto;
    /* 旋转轴心放在帽檐中心（SVG 44.6% / 88.6%），这样歪一点帽子也不会跑离头顶 */
    transform-origin: 44.6% 88.6%;
    filter: drop-shadow(0 3px 6px rgba(120, 60, 60, .28));
    -webkit-tap-highlight-color: transparent;
}

.holiday-santa-hat[hidden] {
    display: none;
}

.holiday-santa-hat svg {
    display: block;
    width: 100%;
    height: 100%;
}

.holiday-santa-hat.is-shaking svg {
    animation: holiday-hat-shake .7s ease-in-out;
    transform-origin: 44.6% 88.6%;
}

@keyframes holiday-hat-shake {
    0%, 100% { transform: rotate(0deg); }
    18% { transform: rotate(15deg) translateY(-2px); }
    38% { transform: rotate(-8deg); }
    58% { transform: rotate(10deg) translateY(-1px); }
    78% { transform: rotate(-4deg); }
}

/* 暴风雪期间卡片由 JS 逐帧写 transform，提前声明避免掉帧 */
#page-profile .holiday-blizzard-flyer {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* 被风吹散的文字：每个字一个 span，和模板里的 .glyph-token 一致 */
#page-profile .holiday-blizzard-text {
    overflow: visible;
}

#page-profile .glyph-token {
    display: inline-block;
    white-space: pre;
    transform-origin: center center;
    backface-visibility: hidden;
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    #holiday-effects-layer .holiday-blizzard-frost,
    #holiday-effects-layer .holiday-blizzard-toast {
        transition: none;
    }

    .holiday-santa-hat.is-shaking svg {
        animation: none;
    }
}
