/* ============================================================
   desktop.css —— 折叠屏桌面样式
   ============================================================ */

/* ===== 桌面全局背景 ===== */
body {
    padding-top: 0; 
    background: #e2e8f0; 
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   ★ 电脑端：折叠屏（平板）硬核外框
   ============================================================ */
.desktop-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-width: 1280px; 
    height: 800px; 
    margin: 40px auto;
    background: #f8fafc;
    border-radius: 40px; 
    box-shadow: 
        0 40px 80px rgba(0, 0, 0, 0.15), 
        0 0 0 12px #ffffff, 
        0 0 0 14px #e2e8f0; 
    position: relative;
    overflow: hidden; 
}

/* ============================================================
   ★ 内部左右分屏容器
   ============================================================ */
.desktop-screens-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
}

/* ===== 左右分屏 ===== */
.desktop-screen {
    padding: 30px 40px 40px; 
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
    position: relative;
    z-index: 2;
}

.desktop-screen:first-child {
    border-right: 1px solid rgba(0, 0, 0, 0.05); 
}

/* ============================================================
   ★ 状态栏
   ============================================================ */
.top-status-bar {
    position: relative; 
    flex-shrink: 0;     
    width: 100%;
    height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    background: rgba(255, 255, 255, 0.6); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    z-index: 10;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

.status-left { display: flex; align-items: center; letter-spacing: 0.5px; }
.status-right { display: flex; align-items: center; gap: 8px; opacity: 0.8; }
.status-icon { display: block; }

/* ============================================================
   小组件 & 图标网格
   ============================================================ */
.desktop-widgets {
    display: grid;
    grid-auto-rows: 160px; 
    gap: 16px;
}

.desktop-widgets .desktop-widget {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    height: 100%; 
}

.desktop-apps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 24px 16px;
    margin-top: 8px;
    justify-content: center;
    width: 100%;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
    color: inherit;
}

.app-item:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: translateY(-4px);
}

.app-item:active {
    transform: translateY(0) scale(0.96);
}

.app-icon-box {
    width: 100%;
    max-width: 80px;
    aspect-ratio: 1 / 1;
    border-radius: 20px; 
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    color: #3b82f6;
    transition: all 0.2s ease;
}

.app-icon-box svg { width: 50%; height: 50%; }
.app-icon-box .app-icon-emoji { font-size: 70%; line-height: 1; }

.app-item:hover .app-icon-box {
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
    background: #eff6ff;
    transform: scale(1.05);
}

.app-name {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.4;
}

/* ============================================================
   小组件样式
   ============================================================ */
.desktop-widget {
    background: #ffffff;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border: 1px solid #f1f5f9;
    min-width: 0;
}

.dt-widget { text-align: center; }
.dt-gregorian { font-size: 15px; font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.dt-lunar { font-size: 12px; color: #94a3b8; margin-bottom: 10px; }
.dt-solar { color: #64748b; }
.dt-clock { font-size: 36px; font-weight: 700; color: #1e293b; letter-spacing: 2px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.dt-sec { font-size: 20px; color: #94a3b8; font-weight: 500; }

.profile-widget { text-align: center; }
.profile-widget-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px; display: block; background: #e2e8f0; border: 3px solid #eef2ff; }
.profile-widget-name { font-size: 18px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.profile-widget-mbti { display: inline-block; font-size: 12px; color: #64748b; background: #f1f5f9; padding: 3px 14px; border-radius: 16px; margin-bottom: 8px; }
.profile-widget-tagline { font-size: 13px; color: #475569; line-height: 1.5; }

.weather-widget { text-align: center; padding: 8px 0; }
.weather-loading { font-size: 14px; color: #94a3b8; }
.weather-main { display: flex; align-items: center; justify-content: center; gap: 12px; }
.weather-icon { font-size: 36px; }
.weather-temp { font-size: 32px; font-weight: 700; color: #1e293b; }
.weather-desc { font-size: 14px; color: #64748b; margin-top: 4px; }
.weather-extra { font-size: 12px; color: #94a3b8; margin-top: 6px; display: flex; justify-content: center; gap: 12px; }

.holiday-widget { text-align: center; padding: 10px 0; }
.holiday-widget-title { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 8px; }
.holiday-timer { font-size: 14px; color: #3b82f6; font-weight: 500; }
.holiday-timer strong { font-size: 20px; margin: 0 3px; }

/* ============================================================
   移动端切换按钮
   ============================================================ */
.mobile-screen-switcher {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 6px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}
.mobile-screen-switcher button {
    padding: 8px 24px;
    border: none;
    background: transparent;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s;
    white-space: nowrap;
}
.mobile-screen-switcher button.active {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* ============================================================
   ★ 电脑端中/小屏幕（不显示外框，保留左右并排）
   ============================================================ */
@media (max-width: 1320px) {
    body {
        background: #f5f7fb; /* 背景变白，去掉网格 */
        display: block;
        padding-top: 0;
    }

    /* ★ 剥离厚重外框，变成纯平背景 */
    .desktop-layout {
        height: auto;
        min-height: calc(100vh - 32px);
        margin: 0;
        max-width: 100%;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }

    /* 状态栏全宽贴顶 */
    .top-status-bar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 44px;
        padding: 0 20px;
        border-radius: 0;
        background: rgba(255, 255, 255, 0.85);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        z-index: 9999;
    }

    .desktop-screens-container {
        padding-top: 50px;
        flex: none;
        display: grid;
        grid-template-columns: 1fr 1fr; /* 依然保持双屏并排 */
    }

    .desktop-screen {
        padding: 20px 16px;
        gap: 16px;
    }

    /* 缩小卡片和图标，适配小屏 */
    .desktop-widgets {
        grid-auto-rows: 130px; 
        gap: 12px;
    }
    .dt-clock { font-size: 28px; }
    .dt-sec { font-size: 16px; }
    .dt-gregorian { font-size: 13px; }
    .weather-temp { font-size: 28px; }
    .weather-icon { font-size: 28px; }

    .desktop-apps {
        gap: 16px 10px;
    }
    .app-icon-box {
        max-width: 68px;
        border-radius: 16px;
    }
    .app-name {
        font-size: 11px;
    }
}

/* ============================================================
   ★ 真正的手机端适配（单屏切换）
   ============================================================ */
@media (max-width: 991px) {
    .desktop-layout {
        padding-bottom: 80px; /* 给底部切换按钮留位置 */
    }

    .desktop-screens-container {
        grid-template-columns: 1fr; /* 变成单列 */
        padding-top: 46px;
    }

    .desktop-screen {
        padding: 10px 20px;
        display: none; /* 隐藏两屏 */
        border-right: none !important;
    }
    .desktop-screen.is-active { display: flex; } /* 显示当前屏 */

    .mobile-screen-switcher { display: flex; }

    .desktop-widgets {
        grid-auto-rows: 160px; 
        gap: 16px;
    }

    .desktop-apps { 
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 24px 16px;
    }
    .app-icon-box { 
        border-radius: 20px; 
        max-width: 90px; 
    }
    .app-name { font-size: 12px; }

    .dt-clock { font-size: 34px; }
    .dt-sec { font-size: 18px; }
    .profile-widget-avatar { width: 64px; height: 64px; }
}

@media (max-width: 480px) {
    .desktop-screen { padding: 0 14px; }
    
    .desktop-apps { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 24px 12px;
    }
    
    .app-icon-box { 
        border-radius: 22px; 
        max-width: 100%; 
    }
    
    .app-icon-box .app-icon-emoji {
        font-size: 75%; 
    }
    
    .app-name {
        font-size: 13px;
        font-weight: 500;
    }
    
    .desktop-widget { padding: 16px; border-radius: 16px; }
}

/* ============================================================
   ★ 修复点击 App 的蓝色高亮框
   ============================================================ */
.app-item,
.app-item:focus,
.app-item:active,
button,
a {
    -webkit-tap-highlight-color: transparent !important; /* 去掉移动端点击蓝框 */
    outline: none !important; /* 去掉浏览器默认的虚线/蓝边框 */
    -webkit-touch-callout: none;
    user-select: none;
}

/* 确保点击时不会有奇怪的焦点样式 */
.app-item:focus-visible {
    outline: none !important;
}

/* ============================================================
   ★ 移动端性能极致优化（减少卡顿）
   ============================================================ */
@media (max-width: 991px) {
    /* 强制关闭手机端所有耗性能的动画和模糊效果 */
    * {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    
    /* 图标悬浮动效在手机上其实是没用的，直接取消掉，减少重绘 */
    .app-item:hover {
        transform: none !important;
        background: transparent !important;
    }
    .app-item:hover .app-icon-box {
        transform: none !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
        background: #ffffff !important;
    }
}

/* ============================================================
   ★ 顶部状态栏 - 灵动岛
   ============================================================ */
.dynamic-island-wrapper {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    display: flex;
    justify-content: center;
    pointer-events: none; /* 让包裹层不挡点击，只有内部链接可点 */
}

.dynamic-island {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 16px;
    background: #000000;
    color: #ffffff;
    border-radius: 20px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    max-width: 400px;
    overflow: hidden;
    white-space: nowrap;
}

/* 悬浮展开效果 */
.dynamic-island:hover {
    background: #1e293b;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    max-width: 500px;
}

/* 呼吸绿点 */
.island-pulse {
    position: relative;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    flex-shrink: 0;
}

.island-pulse::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #22c55e;
    border-radius: 50%;
    animation: islandPulse 2s infinite;
}

@keyframes islandPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* 文字限制 */
.island-text {
    display: inline-block;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
    vertical-align: middle;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .dynamic-island {
        max-width: 180px;
        height: 26px;
        font-size: 11px;
        padding: 0 12px;
    }
    .island-text {
        max-width: 120px;
    }
    .island-pulse {
        width: 6px;
        height: 6px;
    }
}

/* ============================================================
   ★ 新增：平板底部的联系方式（绝对定位）
   ============================================================ */
.footer-contact-wrapper {
    position: absolute;
    bottom: 24px; /* 稍微抬高一点点，不贴着黑边 */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 10;
    pointer-events: none; /* 防止挡住其他元素的点击 */
}

.footer-contact {
    pointer-events: auto;
    text-align: center;
}

.footer-contact-inner {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 16px; /* 元素间距拉开一点 */
    padding: 12px 28px; /* 内边距加大，看起来更丰满 */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 40px; /* 更圆润 */
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06); /* 阴影加重，产生悬浮感 */
}

.footer-contact-label {
    font-size: 13px; /* 字号增大 */
    color: #475569;
    font-weight: 600;
}

.footer-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px; /* 字号增大 */
    color: #475569;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    background: #f1f5f9;
    transition: all 0.2s ease;
}

.footer-contact-link svg {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.footer-contact-link:hover {
    background: #3b82f6;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.footer-contact-link:hover svg {
    opacity: 1;
}

/* 小屏幕（如 iPad 竖屏或手机）直接隐藏，避免挤爆 */
@media (max-width: 991px) {
    .footer-contact-wrapper {
        display: none !important;
    }
}