/* ============================================================
   desktop.css — 桌面环境：壁纸、图标、窗口、任务栏、开机、通知
   视觉方向：「深夜程序员」深蓝黑渐变 + 城市天际线剪影
   ============================================================ */

:root {
    --desk-bg-top: #050a14;
    --desk-bg-mid: #0d1b2a;
    --desk-bg-bot: #1b263b;
    --taskbar-bg: rgba(18, 22, 30, 0.88);
    --window-bg: #f5f5f5;
    --window-titlebar: #1c2333;
    --accent: #4da6ff;
    --text-white: #e8edf5;
    --font-ui: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    --font-mono: "Cascadia Code", "Consolas", "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    font-family: var(--font-ui);
    background: #000;
    user-select: none;
}

.hidden { display: none !important; }

/* ==================== 全屏覆盖层 ==================== */
.fullscreen-overlay {
    position: fixed; inset: 0;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ==================== 开机画面 ==================== */
#boot-screen {
    background: #000;
    transition: opacity 0.6s ease;
}
#boot-screen.boot-fade-out { opacity: 0; }

#boot-logo {
    font-size: 56px;
    font-weight: 200;
    letter-spacing: 12px;
    color: var(--text-white);
    animation: bootPulse 2s ease-in-out infinite;
}
#boot-logo .boot-brand { font-weight: 300; }
#boot-logo .boot-sub {
    font-size: 24px;
    color: var(--accent);
    vertical-align: super;
    letter-spacing: 4px;
    margin-left: 4px;
}

#boot-loading {
    margin-top: 40px;
    width: 200px; height: 2px;
    background: rgba(255,255,255,0.1);
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}
#boot-loading::after {
    content: '';
    position: absolute;
    left: -40%;
    width: 40%; height: 100%;
    background: var(--accent);
    animation: bootLoad 1.2s ease-in-out infinite;
}

@keyframes bootPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
@keyframes bootLoad {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* ==================== 登录界面 ==================== */
#login-screen {
    background:
        linear-gradient(180deg, rgba(10, 16, 28, 0.72) 0%, rgba(12, 18, 32, 0.55) 50%, rgba(8, 12, 22, 0.8) 100%),
        url('../assets/backgrounds/stage1.png') center / cover no-repeat,
        linear-gradient(180deg, var(--desk-bg-top) 0%, var(--desk-bg-mid) 50%, var(--desk-bg-bot) 100%);
    transition: opacity 0.5s ease;
}
#login-screen.boot-fade-out { opacity: 0; }

#login-clock {
    position: absolute;
    top: 60px;
    text-align: center;
    color: var(--text-white);
}
#login-time {
    font-size: 72px;
    font-weight: 200;
    letter-spacing: 4px;
    text-shadow: 0 2px 20px rgba(77, 166, 255, 0.3);
}
#login-date {
    font-size: 18px;
    opacity: 0.7;
    margin-top: 8px;
}

#login-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
#login-avatar {
    width: 96px; height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a4a7f, #1b263b);
    border: 3px solid rgba(77, 166, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--text-white);
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
    overflow: hidden;
}
#login-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
#login-name {
    color: var(--text-white);
    font-size: 20px;
    font-weight: 400;
}
#login-btn {
    margin-top: 8px;
    padding: 10px 48px;
    border: 1px solid rgba(77, 166, 255, 0.5);
    border-radius: 6px;
    background: rgba(77, 166, 255, 0.12);
    color: var(--text-white);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 8px;
}
#login-btn:hover {
    background: rgba(77, 166, 255, 0.25);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(77, 166, 255, 0.2);
}

/* 登录界面边缘干扰暗示 */
#login-glitch-hint {
    position: absolute;
    inset: 0;
    pointer-events: none;
    animation: loginGlitch 8s linear infinite;
    box-shadow: inset 0 0 80px rgba(0, 229, 255, 0.03);
}
@keyframes loginGlitch {
    0%, 94%, 100% { opacity: 0; }
    95% { opacity: 1; box-shadow: inset 0 0 120px rgba(0, 229, 255, 0.08); }
    96% { opacity: 0; }
    97% { opacity: 1; box-shadow: inset 3px 0 60px rgba(255, 0, 80, 0.05); }
    98% { opacity: 0; }
}

/* ==================== 桌面 ==================== */
#desktop {
    position: fixed; inset: 0;
    overflow: hidden;
}

/* 壁纸 */
#wallpaper {
    position: absolute; inset: 0;
    background: linear-gradient(180deg,
        var(--desk-bg-top) 0%,
        var(--desk-bg-mid) 45%,
        var(--desk-bg-bot) 85%,
        #243447 100%
    );
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: filter 2s ease, background-image 1.2s ease;
}
/* 自定义阶段贴图存在时：图铺满，隐藏 SVG 天际线兜底 */
#wallpaper.has-bg-image #skyline { display: none; }
#wallpaper.has-bg-image::before { opacity: 0.5; }
#wallpaper::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 70% 20%, rgba(77, 166, 255, 0.06) 0%, transparent 50%);
}
/* 噪点纹理 */
#wallpaper::after {
    content: '';
    position: absolute; inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 天际线 */
#skyline {
    position: absolute;
    bottom: 48px; left: 0;
    width: 100%; height: 400px;
    opacity: 0.9;
}
.skyline-far rect {
    fill: #0a1220;
    stroke: rgba(77, 166, 255, 0.08);
    stroke-width: 1;
}
.lit-window {
    fill: #e8a838;
    opacity: 0.8;
    animation: windowFlicker 6s ease-in-out infinite;
}
.lit-window:nth-child(odd) { animation-delay: -3s; fill: #7ec8e3; }
@keyframes windowFlicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.5; }
}

/* 氛围递进：壁纸随恐怖等级变化 */
#wallpaper[data-horror="1"] { filter: brightness(0.85) saturate(0.8); }
#wallpaper[data-horror="2"] { filter: brightness(0.7) saturate(0.5) hue-rotate(-10deg); }
#wallpaper[data-horror="3"] { filter: brightness(0.55) saturate(0.3) hue-rotate(-20deg); }
#wallpaper[data-horror="2"] .lit-window,
#wallpaper[data-horror="3"] .lit-window { animation: windowDie 4s ease-in-out infinite; }
@keyframes windowDie {
    0%, 100% { opacity: 0.6; }
    30% { opacity: 0.1; }
    35% { opacity: 0.7; fill: #ff2244; }
    40% { opacity: 0.2; }
}

/* 屏幕闪烁（关机无效时） */
.screen-flicker {
    animation: screenFlick 0.8s steps(2) forwards;
}
@keyframes screenFlick {
    0% { filter: none; }
    20% { filter: brightness(0.2); }
    40% { filter: brightness(1.2); }
    60% { filter: brightness(0.4); }
    80% { filter: brightness(1); }
    100% { filter: none; }
}

/* ==================== 桌面图标 ==================== */
#desktop-icons {
    position: absolute;
    top: 24px; left: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.desktop-icon {
    width: 84px;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}
.desktop-icon:active {
    background: rgba(255, 255, 255, 0.12);
}

.icon-img {
    width: 48px; height: 48px;
    position: relative;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5));
}
.icon-img svg { width: 100%; height: 100%; }

.icon-badge {
    position: absolute;
    top: -3px; right: -3px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #ff3b30;
    box-shadow: 0 0 6px rgba(255, 59, 48, 0.8);
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.icon-label {
    font-size: 12px;
    color: var(--text-white);
    text-align: center;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    line-height: 1.3;
    word-break: keep-all;
}

/* 新图标弹入动画 */
.icon-pop-in {
    animation: iconPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes iconPop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==================== 时钟组件 ==================== */
#clock-widget {
    position: absolute;
    top: 32px; right: 40px;
    text-align: right;
    z-index: 5;
    pointer-events: none;
}
#clock-time {
    font-size: 52px;
    font-weight: 200;
    color: var(--text-white);
    letter-spacing: 3px;
    text-shadow: 0 2px 16px rgba(0,0,0,0.6), 0 0 40px rgba(77, 166, 255, 0.15);
}
#clock-date {
    font-size: 14px;
    color: rgba(232, 237, 245, 0.7);
    margin-top: 4px;
}

/* ==================== 窗口系统 ==================== */
#windows-container {
    position: absolute; inset: 0;
    z-index: 50;
    pointer-events: none;
}

.app-window {
    position: absolute;
    display: flex;
    flex-direction: column;
    background: var(--window-bg);
    border-radius: 10px;
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.08);
    overflow: hidden;
    pointer-events: auto;
    transition: box-shadow 0.2s;
}
.app-window.window-opening {
    animation: windowOpen 0.22s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}
@keyframes windowOpen {
    0% { transform: scale(0.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.app-window.window-closing {
    animation: windowClose 0.18s ease forwards;
}
@keyframes windowClose {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0; }
}
.app-window.window-minimized {
    display: none;
}
.app-window:not(.window-focused) .window-titlebar { opacity: 0.7; }
.app-window.window-focused {
    box-shadow: 0 16px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(77,166,255,0.15);
}

.window-titlebar {
    height: 38px;
    background: var(--window-titlebar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 14px;
    cursor: default;
    flex-shrink: 0;
}
.window-title-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.window-title-icon { width: 18px; height: 18px; display: flex; }
.window-title-icon svg { width: 100%; height: 100%; }
.window-title-text {
    color: rgba(232, 237, 245, 0.9);
    font-size: 13px;
}

.window-controls { display: flex; gap: 2px; }
.win-btn {
    width: 34px; height: 28px;
    border: none;
    background: transparent;
    color: rgba(232, 237, 245, 0.7);
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.win-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.win-close:hover { background: #e81123; color: #fff; }

.window-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* 内嵌独立页面（论坛/研究所）铺满窗口内容区 */
.window-content > .app-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: #f0f2f5;
}

/* ==================== 任务栏 ==================== */
#taskbar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 48px;
    background: var(--taskbar-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    padding: 0 8px;
    z-index: 200;
}

#start-btn {
    width: 42px; height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
#start-btn:hover { background: rgba(255,255,255,0.08); }
#start-btn svg { fill: var(--accent); }

#taskbar-apps {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    overflow: hidden;
}

.taskbar-app {
    height: 40px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: background 0.15s;
    max-width: 180px;
}
.taskbar-app:hover { background: rgba(255,255,255,0.06); }
.taskbar-app.focused {
    background: rgba(255,255,255,0.1);
    border-bottom-color: var(--accent);
}
.taskbar-app-minimized { opacity: 0.6; }
.taskbar-app-icon { width: 20px; height: 20px; flex-shrink: 0; }
.taskbar-app-icon svg { width: 100%; height: 100%; }
.taskbar-app-name {
    font-size: 12px;
    color: rgba(232, 237, 245, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#system-tray {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    color: rgba(232, 237, 245, 0.8);
}
.tray-icon { display: flex; align-items: center; cursor: pointer; }
.tray-icon svg { fill: currentColor; }
.tray-glitch {
    animation: trayGlitch 0.6s steps(3) forwards;
    color: #ff2244 !important;
}
@keyframes trayGlitch {
    0% { opacity: 1; transform: none; }
    33% { opacity: 0.2; transform: translateX(1px); }
    66% { opacity: 1; transform: translateX(-1px); }
    100% { opacity: 0.8; transform: none; }
}

#tray-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 12px;
    line-height: 1.4;
}
#tray-date { font-size: 11px; opacity: 0.7; }

/* ==================== 开始菜单 ==================== */
#start-menu {
    position: absolute;
    bottom: 56px; left: 8px;
    width: 220px;
    background: rgba(24, 30, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 12px;
    z-index: 300;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.start-menu-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    color: var(--text-white);
    font-size: 14px;
}
.start-menu-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a4a7f, #1b263b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    overflow: hidden;
}
.start-menu-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.start-menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 8px 0;
}
.start-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 6px;
    color: rgba(232, 237, 245, 0.85);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.start-menu-item:hover { background: rgba(255,255,255,0.08); }
.start-menu-item svg { stroke: currentColor; }

/* ==================== 关机确认对话框 ==================== */
#shutdown-dialog {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9500;
}
.dialog-box {
    background: #1e2636;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 28px 32px;
    min-width: 320px;
    box-shadow: 0 16px 60px rgba(0,0,0,0.7);
}
.dialog-title {
    color: var(--text-white);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}
.dialog-text {
    color: rgba(232, 237, 245, 0.7);
    font-size: 14px;
    margin-bottom: 24px;
}
.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.dialog-buttons button {
    padding: 8px 24px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: var(--text-white);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.dialog-buttons button:hover { background: rgba(255,255,255,0.12); }
#shutdown-confirm {
    background: rgba(232, 17, 35, 0.8);
    border-color: rgba(232, 17, 35, 0.9);
}
#shutdown-confirm:hover { background: #e81123; }

/* 删除存档确认对话框（复用关机对话框样式） */
#wipe-save-dialog {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9500;
}
#wipe-save-confirm {
    background: rgba(232, 17, 35, 0.8);
    border-color: rgba(232, 17, 35, 0.9);
}
#wipe-save-confirm:hover { background: #e81123; }

/* ==================== 系统通知 ==================== */
#notification-area {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 9800;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.system-notification {
    width: 320px;
    background: rgba(24, 30, 42, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 14px 18px;
    transform: translateX(120%);
    transition: transform 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.system-notification.notif-visible { transform: translateX(0); }
.notif-title {
    color: var(--text-white);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.notif-body {
    color: rgba(232, 237, 245, 0.7);
    font-size: 12px;
    line-height: 1.5;
}

/* ============================================================
   移动端适配（html.mobile，由 js/mobile.js 检测触屏后注入）
   策略：保留桌面隐喻，但窗口全屏铺满、图标/任务栏/字体放大为触控尺寸
   作用域全部限定在 html.mobile，桌面端零回归
   ============================================================ */
html.mobile {
    --mobile-taskbar-h: 52px;
}

/* —— 窗口全屏化：铺满视口，减去任务栏高度 —— */
html.mobile .app-window.window-mobile-full {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: calc(var(--app-vh, 1vh) * 100 - var(--mobile-taskbar-h)) !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    box-shadow: none;
}
/* 标题栏放大易点 */
html.mobile .window-titlebar {
    height: 46px;
    padding: 0 6px 0 16px;
}
html.mobile .window-title-text { font-size: 15px; }
html.mobile .window-title-icon { width: 22px; height: 22px; }
html.mobile .win-btn {
    width: 46px; height: 38px;
    font-size: 16px;
}

/* —— 任务栏放大触控 —— */
html.mobile #taskbar {
    height: var(--mobile-taskbar-h);
    padding: 0 6px;
}
html.mobile #start-btn { width: 46px; height: 46px; }
html.mobile #taskbar-apps {
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
html.mobile #taskbar-apps::-webkit-scrollbar { display: none; }
html.mobile .taskbar-app {
    height: 44px;
    padding: 0 14px;
    max-width: 160px;
    flex-shrink: 0;
}
html.mobile .taskbar-app-icon { width: 24px; height: 24px; }
html.mobile .taskbar-app-name { font-size: 13px; }
html.mobile #system-tray { padding: 0 10px; gap: 8px; }

/* —— 桌面图标放大 + 允许换行不溢出 —— */
html.mobile #desktop-icons {
    top: 16px; left: 16px;
    max-height: calc(var(--app-vh, 1vh) * 100 - var(--mobile-taskbar-h) - 32px);
    flex-wrap: wrap;
    gap: 10px 6px;
}
html.mobile .desktop-icon {
    width: 96px;
    padding: 12px 6px;
}
html.mobile .icon-img { width: 56px; height: 56px; }
html.mobile .icon-label { font-size: 13px; }

/* —— 时钟缩放，避免小屏与图标重叠 —— */
html.mobile #clock-widget { top: 18px; right: 20px; }
html.mobile #clock-time { font-size: 34px; }
html.mobile #clock-date { font-size: 12px; }

/* —— 登录/开机缩放 —— */
html.mobile #login-clock { top: 32px; }
html.mobile #login-time { font-size: 44px; }
html.mobile #login-date { font-size: 15px; }
html.mobile #login-avatar { width: 72px; height: 72px; font-size: 30px; }
html.mobile #login-name { font-size: 18px; }
html.mobile #login-btn { padding: 12px 44px; font-size: 15px; }
html.mobile #boot-logo { font-size: 40px; letter-spacing: 8px; }
html.mobile #boot-logo .boot-sub { font-size: 18px; }

/* —— 开始菜单：贴合放大的任务栏 —— */
html.mobile #start-menu {
    bottom: calc(var(--mobile-taskbar-h) + 8px);
    width: 240px;
}
html.mobile .start-menu-item { padding: 12px 10px; font-size: 14px; }

/* —— iOS 安全区域：横屏刘海 / Home Indicator —— */
html.mobile #taskbar {
    padding-left: calc(6px + env(safe-area-inset-left));
    padding-right: calc(6px + env(safe-area-inset-right));
    padding-bottom: env(safe-area-inset-bottom);
}
html.mobile .app-window.window-mobile-full {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}
html.mobile #desktop-icons {
    left: calc(16px + env(safe-area-inset-left));
}
html.mobile #clock-widget {
    right: calc(20px + env(safe-area-inset-right));
}
html.mobile #notification-area {
    right: calc(16px + env(safe-area-inset-right));
    top: calc(16px + env(safe-area-inset-top));
}
html.mobile #start-menu {
    left: calc(8px + env(safe-area-inset-left));
    bottom: calc(var(--mobile-taskbar-h) + 8px + env(safe-area-inset-bottom));
}

/* —— 禁止双击缩放（保留 pinch-zoom 由 viewport 控制） —— */
html.mobile * {
    touch-action: manipulation;
}

/* —— 通知区域移动端缩放 —— */
html.mobile .system-notification {
    width: auto;
    max-width: 280px;
    min-width: 200px;
}

/* —— 关机对话框移动端适配 —— */
html.mobile .dialog-box {
    min-width: 0;
    width: calc(100vw - 48px);
    max-width: 360px;
    padding: 24px 22px;
}
html.mobile .dialog-buttons button {
    padding: 12px 28px;
    font-size: 15px;
}

/* —— 触摸设备中和 hover 位移/残留态 —— */
@media (hover: none) {
    .desktop-icon:hover {
        background: transparent;
        border-color: transparent;
    }
    .desktop-icon:active { background: rgba(255, 255, 255, 0.12); }
    #login-btn:hover {
        background: rgba(77, 166, 255, 0.12);
        border-color: rgba(77, 166, 255, 0.5);
        box-shadow: none;
    }
    .taskbar-app:hover { background: transparent; }
    .start-menu-item:hover { background: transparent; }
    #start-btn:hover { background: transparent; }
    .win-btn:hover { background: transparent; color: rgba(232, 237, 245, 0.7); }
}

/* ==================== F6: iframe 加载态 ==================== */
.iframe-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #141a26;
    z-index: 5;
    transition: opacity 0.35s ease;
}
.iframe-loader.iframe-loaded {
    opacity: 0;
    pointer-events: none;
}
.iframe-loader-pulse {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(77, 166, 255, 0.25);
    animation: loaderPulse 1.2s ease-in-out infinite;
}
@keyframes loaderPulse {
    0%, 100% { transform: scale(0.7); opacity: 0.4; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* ==================== 模块G: prefers-reduced-motion ==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== 减少动态手动开关（开局引导设置，class 版） ==================== */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}
