/* @🍮 */
#home-screen {
    justify-content: flex-start;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
    padding: 0; /* @🍮 移除内边距，让滑动容器占满全屏 */
}

/* @🍮 桌面多页滑动引擎专属结界 */
.desktop-swiper {
    width: 100vw;
    height: 100%;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding-top: 20px; /* 极致压缩全局顶部间距 */
}
.desktop-swiper::-webkit-scrollbar { display: none; }
.desktop-page {
    min-width: 100vw;
    width: 100vw;
    height: 100%;
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center; 
}
.desktop-page[data-page="0"] .app-grid {
    width: 100%;
    padding: 20px 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 75px; /* @🍮 固定行高，完美对齐网格 */
    gap: 8px 8px; /* 极限压缩网格间距 */
    justify-content: center;
    align-content: start;
    margin-top: 5px; /* 缩短时间与网格的距离 */
    flex-grow: 1;
    grid-auto-flow: dense; /* @🍮 神级魔法：见缝插针密集排列！ */
}
.desktop-page .app-grid {
    width: 100%;
    padding: 20px 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 75px; /* @🍮 固定行高，完美对齐网格 */
    gap: 8px 8px; /* 极限压缩网格间距 */
    justify-content: center;
    align-content: start;
    margin-top: 5px; /* 缩短时间与网格的距离 */
    flex-grow: 1;
    grid-auto-flow: dense; /* @🍮 神级魔法：见缝插针密集排列！ */
}

.time-widget {
    text-align: center;
    padding: 0 10px;
    color: var(--text-color);
}

.time-widget .time {
    font-size: 64px;
    font-weight: 600;
    margin-bottom: -10px;
}

.time-widget .date {
    font-size: 18px;
    color: #666;
}

#home-screen.day-mode .time-widget,
#home-screen.day-mode .time-widget .date,
#home-screen.day-mode .app-icon .app-name {
    color: var(--white-color);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.app-grid {
    width: 100%;
    padding: 20px 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 75px; /* @🍮 固定行高，完美对齐网格 */
    gap: 8px 8px; /* 极限压缩网格间距 */
    justify-content: center;
    align-content: start;
    margin-top: 5px; /* 缩短时间与网格的距离 */
    flex-grow: 1;
    grid-auto-flow: dense; /* @🍮 神级魔法：见缝插针密集排列！ */
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    /* @🍮 撕掉定身符，让App上也能左右滑！ */
    touch-action: pan-x pan-y !important; 
    -webkit-user-drag: none; /* @🍮 禁止手机把图标当图片拖走 */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.icon-img {
    width: 55px;
    height: 55px;
    border-radius: 15px;
    margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    object-fit: cover;
}

.app-icon:hover .icon-img {
    transform: translateY(-5px);
}

.app-icon .app-name {
    font-size: 12px;
    color: var(--text-color);
    font-weight: 500;
}

/* @🍮 桌面 App 拖拽魔法外衣 */
.app-icon.dragging-placeholder {
    opacity: 0.3;
    transform: scale(0.9);
}
.app-icon-clone {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: scale(1.15);
    transition: none;
    opacity: 0.9;
}


/* @🍮 小组件列表与交互样式 */

/* @🍮 小组件商店网格排版 */
#widget-list-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 0;
    list-style: none;
}
.widget-item {
    display: flex;
    flex-direction: column;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.2s;
}
.widget-item:active {
    transform: scale(0.95);
}
body.global-dark-mode .widget-item { background: #2a2a2a; border-bottom: none; }

.widget-item-preview-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
body.global-dark-mode .widget-item-preview-box { background: #1a1a1a; }

.widget-item-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.widget-item-title { font-size: 16px; font-weight: bold; color: var(--text-color); margin-bottom: 5px; text-align: center; }
.widget-item-desc { font-size: 12px; color: #888; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
body.global-dark-mode .widget-item-title { color: #e0e0e0; }

/* @🍮 桌面上的小组件外壳与把手 */
.home-widget-grid-item {
    position: relative;
    pointer-events: auto;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.widget-controls {
    position: absolute;
    top: -12px;
    right: -12px;
    display: none;
    gap: 5px;
    z-index: 20;
    animation: fadeIn 0.2s;
}
.widget-controls.active {
    display: flex;
}
.w-move-btn, .w-drag-btn, .w-del-btn {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: #555;
    font-weight: bold;
}
.w-drag-btn svg { width: 14px; height: 14px; fill: currentColor; }
.w-del-btn { color: #ef5350; font-size: 16px; cursor: pointer; }
.w-move-btn { cursor: pointer; color: var(--primary-color); font-weight: bold; font-size: 14px; background: rgba(255,255,255,0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.w-drag-btn:active, .w-move-btn:active { cursor: grabbing; background: #f0f0f0; }

/* @🍮 小组件齿轮按钮与变量弹窗 */
.w-set-btn {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
}
.w-set-btn svg { width: 14px; height: 14px; fill: currentColor; }
.w-set-btn:active { background: #f0f0f0; }

.widget-var-img-preview {
    width: 100%;
    height: 120px;
    border-radius: 8px;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    margin-bottom: 8px;
    color: #aaa;
    font-size: 12px;
}
body.global-dark-mode .widget-var-img-preview { border-color: #555; }
