/**
 * Copyright (c) 2026 杨家栋. All rights reserved.
 * 本文件是「jxphotos 铁路与航空摄影图库平台软件」的组成部分。
 * 未经著作权人书面许可，不得复制、修改、传播、反向工程或用于商业用途。
 * 联系：ceo@jxphotos.cn
 */

/**
 * 圣诞主题附加层（可选，默认关闭）。
 *
 * 设计约束：
 * - 所有规则都限定在 html[data-xmas="on"] 下，未开启时对页面零影响；
 * - 只做「叠加」：装饰一律用绝对定位伪元素或独立覆盖层，不修改栅格、间距、字号与盒模型；
 * - 与明暗主题正交，浅色 / 深色各有一套亮度微调；
 * - 尊重 prefers-reduced-motion：关闭动效时只保留静态装饰。
 */

/* ───────────────────────── 雪花层 ───────────────────────── */

html[data-xmas="on"] .jx-xmas-snow {
    position: fixed;
    inset: 0;
    z-index: 90;
    overflow: hidden;
    pointer-events: none;
}

html[data-xmas="on"] .jx-xmas-snow__flake {
    position: absolute;
    top: -6vh;
    left: var(--jx-xmas-left, 0%);
    width: var(--jx-xmas-size, 6px);
    height: var(--jx-xmas-size, 6px);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 32%, #ffffff 0%, #ffffff 55%, rgba(255, 255, 255, 0.55) 100%);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.55);
    opacity: 0.9;
    animation: jx-xmas-fall var(--jx-xmas-duration, 12s) linear var(--jx-xmas-delay, 0s) infinite;
    will-change: transform;
}

html[data-xmas="on"] .jx-xmas-snow.is-paused .jx-xmas-snow__flake {
    animation-play-state: paused;
}

@keyframes jx-xmas-fall {
    0% {
        transform: translate3d(0, 0, 0);
        opacity: 0;
    }
    8% {
        opacity: 0.95;
    }
    88% {
        opacity: 0.85;
    }
    100% {
        transform: translate3d(var(--jx-xmas-drift, 28px), 112vh, 0);
        opacity: 0;
    }
}

/* ───────────────────────── 导航花环 ───────────────────────── */

html[data-xmas="on"] .jx-nav::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 7px;
    pointer-events: none;
    background:
        radial-gradient(circle at 12px 4px, #d92b3a 0 2.4px, transparent 2.9px) repeat-x 0 0 / 24px 7px,
        radial-gradient(circle at 24px 3px, #f0c75e 0 1.4px, transparent 1.9px) repeat-x 0 0 / 24px 7px,
        linear-gradient(180deg, #1f7a4d, #14532d) 0 4px / 100% 2px no-repeat;
    opacity: 0.95;
}

/* ───────────────────────── 标题雪花 ───────────────────────── */

html[data-xmas="on"] .jx-section-head__title {
    position: relative;
}

html[data-xmas="on"] .jx-section-head__title::after {
    content: "❄";
    position: absolute;
    top: -0.42em;
    right: 0;
    font-size: 0.55em;
    line-height: 1;
    color: #2f9e6f;
    opacity: 0.9;
    pointer-events: none;
}

html[data-theme="dark"][data-xmas="on"] .jx-section-head__title::after {
    color: #7fd4a8;
}

/* ───────────────────────── 照片卡片圣诞球 ───────────────────────── */

html[data-xmas="on"] .jx-photo-card::after {
    content: "";
    position: absolute;
    top: -5px;
    right: 12px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, #ff9d9d 0%, #d92b3a 58%, #8f1420 100%);
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.6),
        0 2px 6px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    z-index: 2;
}

html[data-xmas="on"] .jx-photo-card {
    border-color: rgba(201, 162, 39, 0.45);
}

html[data-theme="dark"][data-xmas="on"] .jx-photo-card {
    border-color: rgba(240, 199, 94, 0.38);
}

html[data-theme="dark"][data-xmas="on"] .jx-photo-card::after {
    box-shadow:
        0 0 0 2px rgba(18, 22, 20, 0.72),
        0 2px 8px rgba(0, 0, 0, 0.45);
}

/* ───────────────────────── 按钮金色微光 ───────────────────────── */

html[data-xmas="on"] .jx-btn--primary {
    box-shadow:
        0 0 0 1px rgba(201, 162, 39, 0.32),
        0 6px 18px rgba(200, 30, 43, 0.14);
}

html[data-xmas="on"] .jx-btn--primary:hover {
    box-shadow:
        0 0 0 1px rgba(201, 162, 39, 0.55),
        0 8px 22px rgba(200, 30, 43, 0.2);
}

/* ───────────────────────── 导航雪地 / 木屋 / 烤炉 ───────────────────────── */

/**
 * 导航装饰层由 christmas.js 在开启时插入 .jx-nav 内部（aria-hidden + 不接收指针事件）。
 * .jx-nav 自身 position:sticky + z-index:100 已构成层叠上下文，这里用 z-index:-1
 * 让装饰落在导航背景之上、导航文字与下拉菜单之下，既不挡点击也不改变导航高度。
 */

html[data-xmas="on"] .jx-xmas-nav {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

html[data-xmas="on"] .jx-xmas-nav__drift {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 14px;
    background:
        radial-gradient(46px 9px at 23px 9px, #ffffff 0 60%, rgba(255, 255, 255, 0) 61%) repeat-x 0 0 / 96px 14px,
        linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.7) 68%, rgba(255, 255, 255, 0.92) 100%);
    opacity: 0.85;
}

html[data-xmas="on"] .jx-xmas-nav__item {
    position: absolute;
    bottom: -1px;
    width: auto;
    height: 22px;
    opacity: 0.45;
    pointer-events: none;
}

html[data-xmas="on"] .jx-xmas-nav__item--pines {
    left: 2%;
    height: 17px;
    opacity: 0.38;
}

html[data-xmas="on"] .jx-xmas-nav__item--cabin {
    left: 7%;
}

html[data-xmas="on"] .jx-xmas-nav__item--stove {
    right: 7%;
}

html[data-theme="dark"][data-xmas="on"] .jx-xmas-nav__item {
    opacity: 0.58;
}

html[data-theme="dark"][data-xmas="on"] .jx-xmas-nav__drift {
    opacity: 0.62;
}

html[data-xmas="on"] .jx-xmas-nav__flame {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: jx-xmas-flame 1.5s ease-in-out infinite alternate;
}

html[data-xmas="on"] .jx-xmas-nav__smoke {
    animation: jx-xmas-smoke 3.2s ease-in-out infinite;
}

@keyframes jx-xmas-flame {
    from {
        transform: scale(1.02, 0.84);
        opacity: 0.8;
    }
    to {
        transform: scale(0.92, 1.1);
        opacity: 1;
    }
}

@keyframes jx-xmas-smoke {
    0%, 100% {
        opacity: 0.15;
        transform: translateY(1px);
    }
    50% {
        opacity: 0.6;
        transform: translateY(-2px);
    }
}

@media (max-width: 640px) {
    html[data-xmas="on"] .jx-xmas-nav__item {
        display: none;
    }
}

/* ───────────────────────── 角落角色（圣诞老人 / 雪橇） ───────────────────────── */

/**
 * 都是 position:fixed 的独立层，层级 55 低于音乐播放器（60）与各类弹窗，
 * 且 pointer-events:none、aria-hidden，不参与布局、不接收焦点、不遮挡交互。
 * 右下角特意左移，避开 .jx-bgm 圆形按钮的原始位置。
 */

html[data-xmas="on"] .jx-xmas-santa,
html[data-xmas="on"] .jx-xmas-sleigh {
    position: fixed;
    z-index: 55;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.16));
}

html[data-xmas="on"] .jx-xmas-santa {
    right: 4.5rem;
    bottom: 1rem;
    width: 4.5rem;
    animation: jx-xmas-santa-bob 3.6s ease-in-out infinite;
}

html[data-xmas="on"] .jx-xmas-sleigh {
    left: 1rem;
    bottom: 1rem;
    width: 7rem;
    animation: jx-xmas-sleigh-glide 4.6s ease-in-out infinite;
}

html[data-xmas="on"] .jx-xmas-santa__svg,
html[data-xmas="on"] .jx-xmas-sleigh__svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

html[data-xmas="on"] .jx-xmas-santa__arm {
    transform-box: view-box;
    transform-origin: 84px 92px;
    animation: jx-xmas-wave 3.4s ease-in-out infinite;
}

html[data-xmas="on"] .jx-xmas-sleigh__body {
    transform-box: view-box;
    transform-origin: 50% 90%;
    animation: jx-xmas-sleigh-sway 3.4s ease-in-out infinite;
}

html[data-xmas="on"] .jx-xmas-sleigh__puffs {
    animation: jx-xmas-puff 2.6s ease-in-out infinite;
}

html[data-theme="dark"][data-xmas="on"] .jx-xmas-santa,
html[data-theme="dark"][data-xmas="on"] .jx-xmas-sleigh {
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.42));
}

@keyframes jx-xmas-santa-bob {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -6px, 0);
    }
}

@keyframes jx-xmas-wave {
    0%, 62%, 100% {
        transform: rotate(0deg);
    }
    16% {
        transform: rotate(-14deg);
    }
    34% {
        transform: rotate(5deg);
    }
    48% {
        transform: rotate(-10deg);
    }
}

@keyframes jx-xmas-sleigh-glide {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(7px, -4px, 0);
    }
}

@keyframes jx-xmas-sleigh-sway {
    0%, 100% {
        transform: rotate(-0.8deg);
    }
    50% {
        transform: rotate(0.9deg);
    }
}

@keyframes jx-xmas-puff {
    0%, 100% {
        opacity: 0.35;
    }
    50% {
        opacity: 0.85;
    }
}

@media (max-width: 640px) {
    html[data-xmas="on"] .jx-xmas-santa {
        right: 4rem;
        bottom: 0.75rem;
        width: 3.5rem;
    }

    html[data-xmas="on"] .jx-xmas-sleigh {
        left: 0.75rem;
        bottom: 0.75rem;
        width: 5.5rem;
    }
}

/* ═══════════ 圣诞模式的雪地背景（第三种浏览风格，纯 CSS 绘制） ═══════════ */

/**
 * 只在 html[data-ui-mode="xmas"] 下显示；结构由 layouts/main.php 常驻输出
 * （aria-hidden、默认 display:none，其它模式下零影响）。
 * 全部由渐变与内联 SVG 绘制，不请求任何图片；层固定全屏、z-index:-1，
 * 与 .jx-site-bg 同位，xmas 模式下照片轮换层被隐藏（见 ui-mode.css）。
 * 浅色主题是晨曦雪原，深色主题是雪夜极光，变量随 data-theme 切换。
 */

.jx-xmas-bg {
    display: none;
}

html[data-ui-mode="xmas"] .jx-xmas-bg {
    --jx-xmas-sky-top: #c9e5fa;
    --jx-xmas-sky-mid: #e4f2fe;
    --jx-xmas-sky-deep: #fbfdff;
    --jx-xmas-hill-far: #dfeefb;
    --jx-xmas-hill-mid: #c9dff4;
    --jx-xmas-hill-near: #ffffff;
    --jx-xmas-veil: rgba(255, 255, 255, 0.14);
    --jx-xmas-window: #ffcf8b;
    --jx-xmas-pine: #1b6f47;

    display: block;
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: linear-gradient(180deg, var(--jx-xmas-sky-top) 0%, var(--jx-xmas-sky-mid) 52%, var(--jx-xmas-sky-deep) 78%);
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-xmas-bg {
    --jx-xmas-sky-top: #050d1f;
    --jx-xmas-sky-mid: #10233f;
    --jx-xmas-sky-deep: #1d3c5e;
    --jx-xmas-hill-far: #21405f;
    --jx-xmas-hill-mid: #2b5279;
    --jx-xmas-hill-near: #d9e6f5;
    --jx-xmas-veil: rgba(5, 13, 31, 0.26);
    --jx-xmas-pine: #1d4a5f;
}

html[data-ui-mode="xmas"] .jx-xmas-bg > * {
    position: absolute;
    pointer-events: none;
}

/* 天际暖光 / 冷光 */
html[data-ui-mode="xmas"] .jx-xmas-bg__sky {
    inset: 0;
    background:
        radial-gradient(120% 62% at 50% 100%, rgba(255, 240, 212, 0.5) 0%, rgba(255, 240, 212, 0) 58%),
        radial-gradient(90% 55% at 16% 6%, rgba(163, 214, 255, 0.32) 0%, rgba(163, 214, 255, 0) 62%);
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-xmas-bg__sky {
    background:
        radial-gradient(120% 58% at 50% 100%, rgba(120, 178, 236, 0.34) 0%, rgba(120, 178, 236, 0) 62%),
        radial-gradient(80% 50% at 14% 4%, rgba(80, 190, 176, 0.22) 0%, rgba(80, 190, 176, 0) 62%);
}

/* 星点（深色主题可见，浅色主题保持零不透明度） */
html[data-ui-mode="xmas"] .jx-xmas-bg__stars {
    inset: 0;
    opacity: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 22px 34px, #ffffff 0 99%, rgba(255, 255, 255, 0) 100%),
        radial-gradient(1.2px 1.2px at 96px 122px, #ffffff 0 99%, rgba(255, 255, 255, 0) 100%),
        radial-gradient(1.7px 1.7px at 168px 58px, #ffffff 0 99%, rgba(255, 255, 255, 0) 100%),
        radial-gradient(1.1px 1.1px at 248px 176px, #ffffff 0 99%, rgba(255, 255, 255, 0) 100%),
        radial-gradient(1.3px 1.3px at 306px 96px, #ffffff 0 99%, rgba(255, 255, 255, 0) 100%);
    background-size: 340px 220px;
    background-repeat: repeat;
    animation: jx-xmas-twinkle 7s ease-in-out infinite;
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-xmas-bg__stars {
    opacity: 0.8;
}

/* 极光（仅深色主题） */
html[data-ui-mode="xmas"] .jx-xmas-bg__aurora {
    left: -10%;
    right: -10%;
    top: 2%;
    height: 44%;
    opacity: 0;
    background:
        radial-gradient(58% 76% at 32% 34%, rgba(72, 226, 190, 0.5) 0%, rgba(72, 226, 190, 0) 72%),
        radial-gradient(52% 68% at 68% 46%, rgba(126, 200, 255, 0.46) 0%, rgba(126, 200, 255, 0) 74%);
    filter: blur(26px);
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-xmas-bg__aurora {
    opacity: 0.72;
    animation: jx-xmas-aurora 16s ease-in-out infinite alternate;
}

/* 月亮 */
html[data-ui-mode="xmas"] .jx-xmas-bg__moon {
    right: 9%;
    top: 9%;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 32%, #fffefa 0%, #f1f6fb 60%, #dbe7f5 100%);
    box-shadow: 0 0 46px 14px rgba(255, 252, 235, 0.5);
    opacity: 0.92;
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-xmas-bg__moon {
    background: radial-gradient(circle at 36% 32%, #ffffff 0%, #eef4ff 62%, #c8d8ee 100%);
    box-shadow: 0 0 62px 18px rgba(198, 220, 255, 0.38);
    opacity: 1;
}

/* 三层雪丘：宽椭圆穹顶，靠 padding 之外的左右溢出把边缘推出画布 */
html[data-ui-mode="xmas"] .jx-xmas-bg__hills {
    left: -12%;
    right: -12%;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

html[data-ui-mode="xmas"] .jx-xmas-bg__hills--far {
    bottom: 30%;
    height: 20%;
    background: var(--jx-xmas-hill-far);
}

html[data-ui-mode="xmas"] .jx-xmas-bg__hills--mid {
    bottom: 18%;
    height: 22%;
    background: var(--jx-xmas-hill-mid);
}

html[data-ui-mode="xmas"] .jx-xmas-bg__hills--near {
    bottom: 0;
    height: 18%;
    background: var(--jx-xmas-hill-near);
    box-shadow: 0 -10px 30px rgba(160, 196, 230, 0.45);
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-xmas-bg__hills--near {
    box-shadow: 0 -10px 30px rgba(8, 20, 38, 0.55);
}

/* 松林剪影：内联 SVG 平铺，站在远处山脊上 */
html[data-ui-mode="xmas"] .jx-xmas-bg__pines {
    left: 0;
    right: 0;
    bottom: 33%;
    height: 78px;
    opacity: 0.55;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='80' viewBox='0 0 180 80'%3E%3Cg fill='%231b6f47'%3E%3Cpath d='M30 80 44 38 58 80Z'/%3E%3Cpath d='M44 80 60 22 76 80Z' fill='%23155c3a'/%3E%3Cpath d='M120 80 132 46 144 80Z'/%3E%3Cpath d='M132 80 146 28 160 80Z' fill='%23155c3a'/%3E%3C/g%3E%3C/svg%3E") repeat-x left bottom / 180px 80px;
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-xmas-bg__pines {
    opacity: 0.62;
}

/* 木屋：屋顶积雪 + 暖光窗 + 烟囱炊烟 */
html[data-ui-mode="xmas"] .jx-xmas-bg__cabin {
    left: 10%;
    bottom: 20%;
    width: 92px;
    height: 72px;
    border-radius: 4px;
    background: linear-gradient(180deg, #8a5330 0%, #6b3f22 100%);
    box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.1);
}

html[data-ui-mode="xmas"] .jx-xmas-bg__cabin-roof {
    position: absolute;
    left: -16px;
    right: -16px;
    top: -28px;
    height: 32px;
    background: #ffffff;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    filter: drop-shadow(0 3px 5px rgba(120, 152, 186, 0.4));
}

html[data-ui-mode="xmas"] .jx-xmas-bg__cabin-glow {
    position: absolute;
    left: 16px;
    top: 22px;
    width: 20px;
    height: 18px;
    border-radius: 2px;
    background: var(--jx-xmas-window);
    box-shadow:
        40px 0 0 var(--jx-xmas-window),
        0 0 22px 7px rgba(255, 199, 120, 0.55);
}

html[data-ui-mode="xmas"] .jx-xmas-bg__cabin-smoke {
    position: absolute;
    right: 6px;
    top: -34px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    box-shadow:
        0 -13px 0 -2px rgba(255, 255, 255, 0.5),
        7px -26px 0 -3px rgba(255, 255, 255, 0.34);
    animation: jx-xmas-cabin-smoke 5.5s ease-in-out infinite;
}

/* 雪人：三层雪球 + 胡萝卜鼻 + 红围巾 */
html[data-ui-mode="xmas"] .jx-xmas-bg__snowman {
    right: 14%;
    bottom: 13%;
    width: 64px;
    height: 58px;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 28%, #ffffff 0%, #eef5ff 62%, #dbe7f5 100%);
    box-shadow: 0 0 0 1px rgba(178, 202, 226, 0.45);
}

html[data-ui-mode="xmas"] .jx-xmas-bg__snowman::before {
    content: "";
    position: absolute;
    left: 7px;
    bottom: 44px;
    width: 50px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 26%, #ffffff 0%, #f3f8ff 70%, #e1ecf8 100%);
    box-shadow: 0 0 0 1px rgba(178, 202, 226, 0.35);
}

html[data-ui-mode="xmas"] .jx-xmas-bg__snowman::after {
    content: "";
    position: absolute;
    left: 15px;
    bottom: 82px;
    width: 34px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 26%, #ffffff 0%, #f5f9ff 72%, #e4eef9 100%);
    box-shadow: 0 0 0 1px rgba(178, 202, 226, 0.3);
}

html[data-ui-mode="xmas"] .jx-xmas-bg__snowman-nose {
    position: absolute;
    left: 30px;
    bottom: 94px;
    width: 0;
    height: 0;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    border-left: 12px solid #f08c33;
    transform: rotate(8deg);
}

html[data-ui-mode="xmas"] .jx-xmas-bg__snowman-scarf {
    position: absolute;
    left: 17px;
    bottom: 76px;
    width: 30px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #c8202f 0%, #e0455a 100%);
    box-shadow: 8px 8px 0 -2px rgba(200, 32, 47, 0.85);
}

/* 雪地脚印：从画面左侧斜向雪人方向 */
html[data-ui-mode="xmas"] .jx-xmas-bg__trail {
    left: 0;
    right: 0;
    bottom: 6%;
    height: 14%;
    opacity: 0.5;
    background-image:
        radial-gradient(5px 3.4px at 12px 12px, rgba(150, 178, 208, 0.75) 0 92%, rgba(150, 178, 208, 0) 93%),
        radial-gradient(5px 3.4px at 34px 30px, rgba(150, 178, 208, 0.6) 0 92%, rgba(150, 178, 208, 0) 93%);
    background-size: 44px 38px;
    background-repeat: repeat;
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-xmas-bg__trail {
    opacity: 0.32;
}

/* 底部雪堆 */
html[data-ui-mode="xmas"] .jx-xmas-bg__drift {
    left: 0;
    right: 0;
    bottom: 0;
    height: 10%;
    background:
        radial-gradient(62px 20px at 31px 20px, #ffffff 0 70%, rgba(255, 255, 255, 0) 71%) repeat-x 0 0 / 124px 32px,
        linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffffff 55%, #f2f8ff 100%);
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-xmas-bg__drift {
    background:
        radial-gradient(62px 20px at 31px 20px, #e8f1fb 0 70%, rgba(232, 241, 251, 0) 71%) repeat-x 0 0 / 124px 32px,
        linear-gradient(180deg, rgba(217, 230, 245, 0) 0%, #d9e6f5 55%, #c7d8ec 100%);
}

/* 可读性遮罩：雪地偏亮，压一点对比度保证正文与卡片可读 */
html[data-ui-mode="xmas"] .jx-xmas-bg__veil {
    inset: 0;
    background: var(--jx-xmas-veil);
}

@keyframes jx-xmas-twinkle {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 0.92; }
}

@keyframes jx-xmas-aurora {
    from { transform: translate3d(-3%, 0, 0) skewY(-5deg) scaleY(0.94); }
    to { transform: translate3d(3%, 2%, 0) skewY(-7deg) scaleY(1.06); }
}

@keyframes jx-xmas-cabin-smoke {
    0%, 100% { opacity: 0.3; transform: translateY(2px); }
    50% { opacity: 0.8; transform: translateY(-3px); }
}

/* 窄屏：缩小月亮与屋舍，避免占满可视区 */
@media (max-width: 640px) {
    html[data-ui-mode="xmas"] .jx-xmas-bg__moon {
        right: 7%;
        top: 7%;
        width: 56px;
        height: 56px;
    }

    html[data-ui-mode="xmas"] .jx-xmas-bg__cabin {
        left: 7%;
        bottom: 21%;
        transform: scale(0.72);
        transform-origin: left bottom;
    }

    html[data-ui-mode="xmas"] .jx-xmas-bg__snowman {
        right: 8%;
        bottom: 12%;
        transform: scale(0.78);
        transform-origin: right bottom;
    }

    html[data-ui-mode="xmas"] .jx-xmas-bg__pines {
        height: 54px;
        background-size: 124px 54px;
    }
}

/* ═══════════ 圣诞模式：每个卡片上的积雪檐与雪花角标 ═══════════ */

/**
 * 只做叠加：伪元素绝对定位、pointer-events:none、z-index 低于交互层，
 * 不修改卡片的内边距、栅格与盒模型。.jx-photo-card / .jx-cat-card 本身已是
 * position:relative；.jx-card / .jx-panel 在此补上定位上下文（ios-theme 里
 * .jx-panel 本来就是 relative，因此侧滑与动画不受影响）。
 */

html[data-ui-mode="xmas"] .jx-card,
html[data-ui-mode="xmas"] .jx-panel,
html[data-ui-mode="xmas"] .jx-cat-card {
    position: relative;
}

html[data-ui-mode="xmas"] .jx-card::before,
html[data-ui-mode="xmas"] .jx-panel::before,
html[data-ui-mode="xmas"] .jx-cat-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 9px;
    border-radius: inherit;
    pointer-events: none;
    z-index: 3;
    opacity: 0.96;
    background:
        radial-gradient(11px 8px at 11px 0, #ffffff 0 72%, rgba(255, 255, 255, 0) 73%) repeat-x 0 0 / 22px 9px,
        linear-gradient(180deg, #ffffff 0 4px, rgba(255, 255, 255, 0) 4px);
    filter: drop-shadow(0 2px 3px rgba(160, 190, 220, 0.35));
}

html[data-ui-mode="xmas"] .jx-card::after,
html[data-ui-mode="xmas"] .jx-panel::after,
html[data-ui-mode="xmas"] .jx-cat-card::after {
    content: "❄";
    position: absolute;
    top: 2px;
    right: 12px;
    font-size: 0.75rem;
    line-height: 1;
    color: #4f9bd6;
    opacity: 0.85;
    pointer-events: none;
    z-index: 3;
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-card::before,
html[data-theme="dark"][data-ui-mode="xmas"] .jx-panel::before,
html[data-theme="dark"][data-ui-mode="xmas"] .jx-cat-card::before {
    background:
        radial-gradient(11px 8px at 11px 0, #eef5ff 0 72%, rgba(238, 245, 255, 0) 73%) repeat-x 0 0 / 22px 9px,
        linear-gradient(180deg, #eef5ff 0 4px, rgba(238, 245, 255, 0) 4px);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

html[data-theme="dark"][data-ui-mode="xmas"] .jx-card::after,
html[data-theme="dark"][data-ui-mode="xmas"] .jx-panel::after,
html[data-theme="dark"][data-ui-mode="xmas"] .jx-cat-card::after {
    color: #8fc7f0;
}

/* 照片卡片：积雪压在缩略图顶边，雪花角标落在左上角 */
html[data-ui-mode="xmas"] .jx-photo-card__thumb::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 10px;
    pointer-events: none;
    z-index: 2;
    background:
        radial-gradient(12px 9px at 12px 0, #ffffff 0 72%, rgba(255, 255, 255, 0) 73%) repeat-x 0 0 / 24px 10px,
        linear-gradient(180deg, #ffffff 0 4px, rgba(255, 255, 255, 0) 4px);
}

html[data-ui-mode="xmas"] .jx-photo-card__thumb::after {
    content: "❄";
    position: absolute;
    top: 9px;
    left: 12px;
    font-size: 0.875rem;
    line-height: 1;
    color: #ffffff;
    text-shadow: 0 1px 5px rgba(23, 70, 120, 0.6);
    pointer-events: none;
    z-index: 2;
}

/* ═════════════════════════════ 减少动效 ═════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    html[data-xmas="on"] .jx-xmas-snow {
        display: none;
    }

    html[data-xmas="on"] .jx-xmas-snow__flake {
        animation: none;
    }

    /* 角色与导航场景保留静态造型，去掉所有位移与闪烁动画 */
    html[data-xmas="on"] .jx-xmas-santa,
    html[data-xmas="on"] .jx-xmas-sleigh,
    html[data-xmas="on"] .jx-xmas-santa__arm,
    html[data-xmas="on"] .jx-xmas-sleigh__body,
    html[data-xmas="on"] .jx-xmas-sleigh__puffs,
    html[data-xmas="on"] .jx-xmas-nav__flame,
    html[data-xmas="on"] .jx-xmas-nav__smoke {
        animation: none !important;
    }
}

/* 圣诞模式的静态雪景：关掉星点闪烁、极光漂移与炊烟，保留全部静态雪地元素 */
@media (prefers-reduced-motion: reduce) {
    html[data-ui-mode="xmas"] .jx-xmas-bg__stars,
    html[data-ui-mode="xmas"] .jx-xmas-bg__aurora,
    html[data-ui-mode="xmas"] .jx-xmas-bg__cabin-smoke {
        animation: none !important;
    }

    html[data-ui-mode="xmas"] .jx-xmas-bg__stars {
        opacity: 0.6;
    }
}

/* 圣诞模式背景音乐开关：结构、尺寸、定位、层级全部沿用 app.css 的 .jx-bgm，这里只覆盖配色与状态 */
.jx-bgm__fab .jx-bgm__fab-icon--on {
    display: none;
}

.jx-bgm.is-playing .jx-bgm__fab-icon--on {
    display: block;
}

.jx-bgm.is-playing .jx-bgm__fab-icon--off {
    display: none;
}

#jx-xmas-music .jx-bgm__fab {
    border-color: rgba(200, 32, 47, 0.32);
    background: #f6f7fb;
    color: #c8202f;
}

#jx-xmas-music.is-playing .jx-bgm__fab,
#jx-xmas-music .jx-bgm__fab:hover {
    border-color: #a8182a;
    background: #c8202f;
    color: #ffffff;
}

#jx-xmas-music .jx-bgm__fab:focus-visible {
    outline: 2px solid #c8202f;
    outline-offset: 2px;
}

/* 音频自动播放被浏览器拦截时脉动提示，等用户点一下页面 */
#jx-xmas-music.is-pending .jx-bgm__fab {
    animation: jx-xmas-music-hint 2.2s ease-in-out infinite;
}

@keyframes jx-xmas-music-hint {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
    }

    50% {
        transform: scale(1.07);
        box-shadow: 0 6px 22px rgba(200, 32, 47, 0.38);
    }
}

@media (prefers-reduced-motion: reduce) {
    #jx-xmas-music.is-pending .jx-bgm__fab {
        animation: none;
    }
}
