/* 首页：简洁布局，参考 jitheme 区块标题风格 */

.home-page {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* 移动端搜索（桌面端隐藏，顶栏搜索不可见时使用） */
.home-mobile-search {
    display: none;
}

.home-block {
    margin-bottom: 28px;
}

.home-block--featured {
    margin-bottom: 32px;
}

/* 顶部推荐：桌面端 N 列网格 */
.home-featured-grid {
    display: grid;
    grid-template-columns: repeat(var(--featured-cols, 7), minmax(0, 1fr));
    gap: 14px 12px;
    width: 100%;
}

.home-featured-card {
    min-width: 0;
}

.home-featured-link {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-featured-link:hover {
    border-color: #fc5214;
}

.home-featured-media {
    position: absolute;
    inset: 0;
}

.home-featured-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.home-featured-link:hover .home-featured-img {
    transform: scale(1.05);
}

.home-featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.82));
    pointer-events: none;
}

.home-featured-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.35) 70%, transparent 100%);
    box-sizing: border-box;
}

.home-featured-thumb {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.home-featured-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.home-featured-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
}

.home-featured-desc {
    display: none;
    font-size: 11px;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 2px;
}

.home-featured-play {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    min-height: 28px;
    background-color: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.home-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    line-height: 1;
    gap: 12px;
}

.home-block-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #222;
    position: relative;
    padding-left: 12px;
    flex: 1;
    min-width: 0;
}

.home-block-head h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, #fc5214 0%, #ff8e30 100%);
    border-radius: 2px;
}

.home-block-more {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    padding: 6px 14px;
    background: #f3f4f6;
    border-radius: 999px;
    transition: color 0.2s, background 0.2s;
}

.home-block-more:hover {
    color: #fff;
    background: var(--theme-color);
}

/* 推荐区网格：与列表页一致 7 列铺满 */
.home-recommend-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 14px 12px;
    width: 100%;
}

.home-page .home-recommend-grid .game-kuai {
    width: auto !important;
    min-width: 0;
    display: block !important;
    margin-bottom: 0;
    justify-content: initial;
}

.home-page .home-recommend-grid .game-kuai a {
    display: block;
    text-decoration: none;
}

.home-page .home-recommend-grid .game-card {
    width: 100%;
    margin: 0 !important;
    border-radius: 8px;
    box-shadow: none;
    outline: 1px solid rgba(0, 0, 0, 0.06);
    transition: outline-color 0.2s;
}

.home-page .home-recommend-grid .game-card:hover {
    outline-color: var(--theme-color);
    transform: none;
    box-shadow: none;
}

.home-page .home-recommend-grid .game-image--150 {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
}

.home-page .game-kuai-title {
    margin-top: 8px;
    padding: 0 2px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    color: #333;
}

.home-page .game-kuai:hover .game-kuai-title {
    color: var(--theme-color);
}

/* 卡片微调 */
.home-page .game-card2,
.home-page .game-card {
    border-radius: 8px;
}

.home-page .game-card2:hover,
.home-page .game-card:hover {
    transform: none;
}

.home-page .game-card2-title {
    font-size: 14px;
    font-weight: 500;
}

.home-page .game-card2-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.home-page .game-card2-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px 6px;
    font-size: 11px;
    color: #999;
    line-height: 1.3;
}

.home-page .game-card2-stat .fa {
    color: #ff8e30;
    font-size: 10px;
}

.home-page .new-badge {
    font-size: 12px;
    font-weight: 500;
}

.home-page .new-badge--hot {
    background: linear-gradient(135deg, #fc5214 0%, #ff6b35 100%);
    box-shadow: 0 2px 8px rgba(252, 82, 20, 0.25);
}

.home-page .random-games-bar {
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8f9fb 0%, #f0f2f5 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.home-page .random-games-bar .game-card--mini {
    transition: transform 0.2s ease;
}

.home-page .random-games-bar .game-card--mini:hover {
    transform: scale(1.06);
}

.home-page .scroll-arrow {
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.home-page .scroll-arrow img {
    width: 18px;
    height: 18px;
}

/* Trending 区块 */
.home-block--trending {
    margin-bottom: 26px;
}

.home-page .game-card--trending {
    position: relative;
    scroll-snap-align: start;
    flex-shrink: 0;
}

.home-page .game-card2--trending,
.home-page .game-card2--hot {
    position: relative;
    scroll-snap-align: start;
    flex-shrink: 0;
}

.home-page .trending-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fc5214 0%, #ff8e30 100%);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(252, 82, 20, 0.35);
}

.home-page #trending-game,
.home-page #new-game,
.home-page #hot-game {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* 横向滚动区：移动端边缘渐隐提示 */
.home-page .horizontal-scroll-container {
    position: relative;
}

@media (max-width: 1200px) {
    .home-featured-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .home-recommend-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .home-featured-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px 10px;
    }

    .home-recommend-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px 10px;
    }

    /* 覆盖 styles.css 对 #con-game 的 flex 两列布局 */
    .home-page #con-game.home-recommend-grid {
        display: grid !important;
    }

    .home-page #con-game.home-recommend-grid .game-kuai {
        width: auto !important;
        display: block !important;
        margin-bottom: 0 !important;
    }
}

@media (max-width: 768px) {
    .home-mobile-search {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 18px;
        padding: 10px 14px;
        background: #fff;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 14px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    }

    .home-mobile-search i {
        color: #ff8e30;
        font-size: 16px;
        flex-shrink: 0;
    }

    .home-mobile-search input {
        flex: 1;
        min-width: 0;
        border: none;
        background: transparent;
        font-size: 15px;
        color: #333;
        outline: none;
        -webkit-appearance: none;
    }

    .home-mobile-search input::placeholder {
        color: #aaa;
    }

    .home-mobile-search button {
        flex-shrink: 0;
        border: none;
        background: linear-gradient(135deg, #fc5214 0%, #ff8e30 100%);
        color: #fff;
        font-size: 13px;
        font-weight: 600;
        padding: 8px 16px;
        border-radius: 999px;
        cursor: pointer;
    }

    .home-block {
        margin-bottom: 24px;
    }

    .home-block--featured {
        margin-bottom: 26px;
        margin-left: -1rem;
        margin-right: -1rem;
    }

    /* 推荐区改为横向滑动大卡 */
    .home-featured-grid {
        display: flex !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 14px;
        padding: 4px 1rem 10px;
        scrollbar-width: none;
    }

    .home-featured-grid::-webkit-scrollbar {
        display: none;
    }

    .home-featured-card {
        flex: 0 0 76vw;
        max-width: 300px;
        scroll-snap-align: center;
    }

    .home-featured-link {
        aspect-ratio: 16 / 10;
        border-radius: 14px;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
    }

    .home-featured-link:active {
        transform: scale(0.98);
    }

    .home-featured-thumb {
        width: 36px;
        height: 36px;
        border-radius: 6px;
    }

    .home-featured-title {
        font-size: 14px;
        font-weight: 600;
    }

    .home-featured-play {
        background: linear-gradient(135deg, #fc5214 0%, #ff8e30 100%);
        border-color: transparent;
        color: #fff;
        font-weight: 600;
        padding: 6px 14px;
    }

    .home-block-head {
        margin-bottom: 12px;
    }

    .home-block-head h2 {
        font-size: 17px;
    }

    .home-block-head h2::before {
        height: 16px;
    }

    /* 横向游戏列表：全宽滑动 + snap */
    .home-page .games-scroll {
        scroll-snap-type: x mandatory;
        gap: 12px;
        padding-bottom: 6px;
        padding-right: 4px;
        scrollbar-width: none;
    }

    .home-page .games-scroll::-webkit-scrollbar {
        display: none;
    }

    .home-page .game-card2,
    .home-page .game-card2--trending,
    .home-page .game-card2--hot {
        scroll-snap-align: start;
        flex-shrink: 0;
        width: 158px;
        margin: 0;
        border-radius: 12px;
        box-shadow: 0 3px 14px rgba(0, 0, 0, 0.08);
        outline: 1px solid rgba(0, 0, 0, 0.04);
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .home-page .game-card2:active {
        transform: scale(0.98);
    }

    .home-page .game-card2 .game-image2 {
        height: 102px;
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
    }

    .home-page .game-card2-meta {
        align-items: flex-end;
        gap: 4px;
        padding-bottom: 2px;
    }

    .home-page .game-card2-info {
        width: 58%;
        min-width: 0;
    }

    .home-page .game-card2-title {
        font-size: 13px;
        font-weight: 600;
        padding: 6px 8px 2px;
        color: #222;
    }

    .home-page .game-card2-desc,
    .home-page .game-card2-stat {
        font-size: 10px;
        padding: 0 8px 5px;
    }

    .home-page .game-card2-play-wrap {
        width: 38%;
        padding-right: 6px;
        box-sizing: border-box;
    }

    .home-page .game-card2-play {
        width: 100%;
        padding: 5px 6px;
        font-size: 11px;
        font-weight: 600;
        text-align: center;
        color: #fff;
        background: linear-gradient(135deg, #fc5214 0%, #ff8e30 100%);
        border: none;
        border-radius: 999px;
        box-shadow: 0 2px 8px rgba(252, 82, 20, 0.2);
    }

    .home-page .trending-badge {
        top: 6px;
        left: 6px;
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .home-page .new-badge {
        font-size: 10px;
        padding: 2px 8px;
        border-top-left-radius: 10px;
        border-bottom-right-radius: 10px;
    }

    .home-block-more {
        font-size: 12px;
        padding: 5px 12px;
        color: #fc5214;
        background: rgba(252, 82, 20, 0.08);
    }

    .home-block-more:hover {
        background: var(--theme-color);
        color: #fff;
    }

    .home-recommend-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px 8px;
    }

    .home-page .home-recommend-grid .game-card {
        border-radius: 10px;
    }

    .home-page .game-kuai-title {
        font-size: 13px;
        margin-top: 6px;
    }

    .home-page .random-games-bar {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 12px 1rem;
    }

    .home-page .random-games-bar .game-card--mini {
        width: 48px;
        height: 48px;
        border-radius: 10px;
    }
}

@media (max-width: 600px) {
    .home-recommend-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px 8px;
    }
}

@media (max-width: 480px) {
    .home-block-head h2 {
        font-size: 16px;
    }

    .home-featured-card {
        flex: 0 0 82vw;
    }

    .home-page .game-card2,
    .home-page .game-card2--trending,
    .home-page .game-card2--hot {
        width: 148px;
    }

    .home-page .game-card2 .game-image2 {
        height: 96px;
    }

    .home-recommend-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 10px;
    }

    .home-page .game-kuai-title {
        font-size: 12px;
    }
}

/* 安全区域（刘海屏） */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .home-page {
            padding-bottom: max(12px, env(safe-area-inset-bottom));
        }
    }
}
