/* ==================== 随机壁纸背景层（珍智账 · 暗色主题专用） ====================
   和考试项目（阅卷台）同一套机制，但记账要保可读，所以：
     · 只在暗色主题生效（亮色主题保持干净白底）
     · 壁纸铺满全屏，遮罩上淡下浓 + 3px 轻虚化，压掉图片细节、文字永远站得住
     · 图源是外网随机图接口（loliapi），连续 3 次拉不到就整体淡出，回到纯 CSS 渐变底
   结构（由 static/js/wallpaper.js 插入）：
       .bg-stage
         ├─ .bg-layer      壁纸（首屏图由服务端注入样式表，见 templates 的 --wall-img）
         └─ .bg-veil       遮罩：上淡下浓 + blur
   ============================================================ */

.bg-stage {
    position: fixed;
    inset: 0;
    z-index: -1;                 /* 垫在所有内容之下 */
    overflow: hidden;
    pointer-events: none;        /* 绝不挡操作 */
    background: transparent;
    transition: opacity 0.8s ease;
}

/* 连不上图源 → 整体淡出，回到原生渐变底 */
.bg-stage.is-off { opacity: 0; visibility: hidden; }

.bg-layer {
    position: absolute;
    inset: -3%;                  /* 留出 Ken Burns 缩放余量，避免露边 */
    background-size: cover;
    background-position: center 30%;
    background-image: var(--wall-img, none);
    opacity: 0;
    transition: opacity 1.1s ease;
}

.bg-layer.is-active {
    opacity: 1;
    animation: wallKenBurns 64s ease-in-out infinite alternate;
}

@keyframes wallKenBurns {
    from { transform: scale(1.04); }
    to   { transform: scale(1.10) translate3d(0.6%, 0.4%, 0); }
}

.bg-veil {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(14, 11, 22, var(--wall-dim-top, 0.6)) 0%,
        rgba(14, 11, 22, 0.7) 32%,
        rgba(14, 11, 22, 0.82) 60%,
        rgba(14, 11, 22, 0.9) 100%);
    backdrop-filter: blur(var(--wall-blur, 4px)) saturate(1.05);
    -webkit-backdrop-filter: blur(var(--wall-blur, 4px)) saturate(1.05);
}

/* 右下角换一张（可用 config 关掉） */
.bg-refresh {
    position: fixed;
    right: 16px;
    bottom: 108px;               /* 浮在底部导航之上 */
    z-index: 60;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    border: 1px solid rgba(167, 139, 250, 0.35);
    border-radius: 50%;
    background: rgba(20, 16, 32, 0.55);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.bg-refresh:hover { transform: translateY(-2px) rotate(-8deg); border-color: var(--accent-light); }
.bg-refresh:active { transform: scale(0.94); }
.bg-refresh.is-loading { animation: wallSpin 1s linear infinite; opacity: 0.7; }
.bg-refresh.is-gone { display: none; }

@keyframes wallSpin { to { transform: rotate(360deg); } }

/* 无障碍 / 省电：系统要求减少动效时关掉呼吸缩放 */
@media (prefers-reduced-motion: reduce) {
    .bg-layer.is-active { animation: none; transform: scale(1.04); }
    .bg-layer { transition-duration: 0.2s; }
    .bg-refresh.is-loading { animation: none; }
}

@media print {
    .bg-stage, .bg-refresh { display: none !important; }
}
