/* ============================================
   蛋薯机 DanShu Pro v2 — grid.css
   ============================================ */

/* ★ 关键修复：pages-viewport 不能用 flex:1 无限撑开 */
.pages-viewport {
    height: calc(var(--app-height, 100vh) - var(--status-bar-height) - var(--dock-height) - var(--page-dots-height) - var(--home-indicator-height));
    min-height: 0;
    max-height: calc(var(--app-height, 100vh) - var(--status-bar-height) - var(--dock-height) - var(--page-dots-height) - var(--home-indicator-height));
    overflow: hidden;
    position: relative;
    z-index: 5;
    touch-action: pan-x;
    flex-shrink: 0;
}

.pages-track {
    display: flex;
    width: 300%;
    height: 100%;
    min-height: 0;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.pages-track.dragging {
    transition: none;
}

.page {
    width: 33.333%;
    /* ★★★ 这里！原来50%，必须改成33.333% ★★★ */
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 20px 0;
    -webkit-overflow-scrolling: touch;
}

/* ===== 第1页主网格：4列 ===== */
.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px 12px;
    padding-bottom: 10px;
}

/* 双人组件 4列（替代原大卡片） */
.p2-duo-widget {
    grid-column: span 4;
}

/* 倒数日 左侧2列，跨2行 */
.widget-countdown {
    grid-column: span 2;
    grid-row: span 2;
}

/* 右侧2×2应用容器，占右2列、跨2行 */
.apps-grid-2x2 {
    grid-column: span 2;
    grid-row: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px 6px;
    align-content: center;
}

/* 气泡 4列 */
.widget-chat-bubble {
    grid-column: span 4;
}

/* ===== 第2页：独立网格，不继承主页的跨列规则 ===== */
.grid-apps-page {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 12px;
    padding-top: 30px;
    padding-bottom: 10px;
}

/* ★ 关键修复：第2页的app-cell不跨列，每个占1列 */
.grid-apps-page>.app-cell {
    grid-column: span 1;
    grid-row: span 1;
}

/* 应用单元格 */
.app-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 2px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.app-name {
    font-size: 11px;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.3px;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* 页面指示器 */
.page-dots {
    height: var(--page-dots-height);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transition: all 0.35s ease;
    cursor: pointer;
}

.dot.active {
    width: 20px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}

/* 第二页减少顶部留白，让内容整体上移 */
.page-2 {
    padding-top: 0;
}

/* 第三页减少顶部留白 */
.page-3 {
    padding-top: 0;
}
