* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    color: #e0e0e0;
}

/* ---- Header ---- */
.header {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    max-width: 1400px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; padding: 16px 24px 0;
}
.header h1 {
    font-size: 20px; font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #f472b6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; margin: 0;
}
.search-box input {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 14px; border-radius: 10px; color: #fff;
    font-size: 14px; outline: none; width: 200px; transition: all 0.2s;
}
.search-box input:focus { border-color: #a78bfa; background: rgba(167,139,250,0.1); }
.search-box input::placeholder { color: rgba(255,255,255,0.4); }

.notice-bar {
    max-width: 1400px; margin: 12px auto 0; padding: 8px 24px 14px;
    font-size: 13px; color: #a78bfa; line-height: 1.6;
}

/* ---- Tabs ---- */
.category-tabs {
    display: flex; gap: 10px; flex-wrap: wrap;
    max-width: 1400px; margin: 20px auto 0; padding: 0 24px;
}
.cat-tab {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #cbd5e1; padding: 8px 18px; border-radius: 999px;
    font-size: 14px; cursor: pointer; transition: all 0.2s;
}
.cat-tab:hover { background: rgba(255,255,255,0.12); }
.cat-tab.active {
    background: linear-gradient(135deg, #a78bfa, #f472b6);
    color: #fff; border-color: transparent; font-weight: 600;
}

/* ---- Container / Grid ---- */
.container { max-width: 1400px; margin: 0 auto; padding: 20px 24px 60px; }
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px; margin-top: 16px;
}
.loading, .empty-state {
    grid-column: 1 / -1; text-align: center; padding: 60px 0;
    color: rgba(255,255,255,0.5); font-size: 15px;
}

/* ---- Game Card ---- */
.game-card {
    position: relative;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px; overflow: hidden; cursor: pointer;
    display: flex; flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.game-card:hover {
    transform: translateY(-4px);
    border-color: rgba(167,139,250,0.5);
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}
.game-img-wrap { position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: #1a1a2e; }
.game-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-img.placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: rgba(255,255,255,0.35); font-weight: 600;
    background: linear-gradient(135deg, #241f47, #3a2f63);
}
.game-cat-badge {
    position: absolute; top: 10px; left: 10px; z-index: 2;
    font-size: 11px; padding: 3px 10px; border-radius: 999px;
    font-weight: 600; background: rgba(167,139,250,0.85); color: #fff;
    backdrop-filter: blur(6px);
}
.game-info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.game-title { font-size: 15px; font-weight: 600; color: #e8e8f0; line-height: 1.4; }
.game-desc {
    font-size: 12.5px; color: rgba(255,255,255,0.55); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.game-price { font-size: 12.5px; color: #f472b6; font-weight: 600; margin-top: auto; }
.game-more { font-size: 12px; color: #a78bfa; }

/* ---- Pagination ---- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 32px; flex-wrap: wrap; }
.pagination button {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #cbd5e1; padding: 6px 12px; border-radius: 8px;
    font-size: 13px; cursor: pointer; transition: all 0.2s; min-width: 36px;
}
.pagination button:hover:not(:disabled) { background: rgba(255,255,255,0.14); }
.pagination button.active {
    background: linear-gradient(135deg, #a78bfa, #f472b6);
    color: #fff; border-color: transparent; font-weight: 600;
}
.pagination button:disabled { opacity: 0.35; cursor: default; }

/* ---- Detail Overlay ---- */
.detail-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(6,4,20,0.85); backdrop-filter: blur(6px);
    display: none; align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow-y: auto;
}
.detail-overlay.show { display: flex; }
.detail-box {
    position: relative; width: 100%; max-width: 1000px;
    background: linear-gradient(160deg, #1b1734, #221c40);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px; padding: 26px 26px 34px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.detail-close {
    position: absolute; top: 14px; right: 16px;
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255,255,255,0.08); border: none;
    color: #fff; font-size: 20px; cursor: pointer; line-height: 1;
}
.detail-close:hover { background: rgba(255,255,255,0.2); }
.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; padding-right: 44px; }
.detail-head h2 {
    font-size: 22px; font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #f472b6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.detail-cat {
    font-size: 12px; padding: 3px 12px; border-radius: 999px;
    background: rgba(167,139,250,0.2); color: #c4b5fd; border: 1px solid rgba(167,139,250,0.3);
}
.detail-body { display: grid; grid-template-columns: 1fr; gap: 20px; }
.detail-section { font-size: 14px; color: rgba(255,255,255,0.8); line-height: 1.9; }
.detail-section p { margin-bottom: 4px; }
.detail-pkgs { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.detail-pkg {
    font-size: 14px; color: #fbcfe8; font-weight: 600;
    background: rgba(244,114,182,0.1);
    border: 1px solid rgba(244,114,182,0.25);
    border-radius: 10px; padding: 9px 14px;
}
.detail-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.detail-imgs img {
    width: 100%; border-radius: 10px; cursor: zoom-in;
    border: 1px solid rgba(255,255,255,0.08); background: #1a1a2e;
    transition: transform 0.15s;
}
.detail-imgs img:hover { transform: scale(1.02); }
.detail-empty { color: rgba(255,255,255,0.4); font-size: 13px; }

/* ---- Zoom ---- */
.zoom-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.92); display: none; overflow: auto;
}
.zoom-overlay.show { display: block; }
.zoom-scroll-wrap { min-height: 100%; display: flex; align-items: flex-start; justify-content: center; padding: 20px; }
.zoom-overlay img { max-width: 100%; height: auto; border-radius: 8px; }

@media (min-width: 900px) {
    .detail-body { grid-template-columns: 340px 1fr; }
}

/* ================= 手机端适配 (<=640px) ================= */
@media (max-width: 640px) {
    .header-inner { padding: 10px 12px 0; gap: 8px; }
    .header h1 { font-size: 17px; }
    .search-box { flex: 1 1 100%; }
    .search-box input { width: 100%; font-size: 13px; padding: 7px 12px; }
    .notice-bar { padding: 8px 12px 10px; font-size: 11.5px; line-height: 1.55; }
    .container { padding: 12px 12px 40px; }

    /* 分类：单行横向滑动，不再参差换行 */
    .category-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 8px;
        margin-top: 12px;
        padding: 0 12px 6px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
        mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
    }
    .category-tabs::-webkit-scrollbar { display: none; }
    .cat-tab {
        flex: 0 0 auto;
        padding: 7px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* 列表：固定两列，宽窄机型一致 */
    .game-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-top: 12px;
    }
    .game-cat-badge {
        top: 6px; left: 6px;
        font-size: 9.5px; padding: 2px 7px;
        max-width: calc(100% - 12px);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .game-info { padding: 8px 9px 10px; gap: 4px; }
    .game-title {
        font-size: 13px; line-height: 1.35;
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    .game-desc { font-size: 11.5px; line-height: 1.5; -webkit-line-clamp: 2; }
    .game-price { font-size: 11.5px; }
    .game-more { font-size: 11px; }

    .pagination { margin-top: 20px; gap: 6px; }
    .pagination button { padding: 6px 10px; font-size: 12px; min-width: 32px; }

    /* 详情弹层：手机全屏 */
    .detail-overlay { padding: 0; }
    .detail-box {
        border-radius: 0; min-height: 100%;
        padding: 18px 14px 28px;
    }
    .detail-head { padding-right: 40px; margin-bottom: 12px; }
    .detail-head h2 { font-size: 18px; }
    .detail-section { font-size: 13px; line-height: 1.8; }
    .detail-pkg { font-size: 13px; padding: 8px 12px; }
    .detail-imgs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

/* ---- 分类横滑提示 ---- */
.tabs-wrap { position: relative; }
.tabs-strip { position: relative; }
.cat-arrow {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 50%; border: none; padding: 0;
    background: linear-gradient(135deg, #a78bfa, #f472b6);
    color: #fff; font-size: 17px; line-height: 1;
    display: none; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.5); z-index: 5; cursor: pointer;
}
.cat-arrow:active { transform: translateY(-50%) scale(.94); }
.cat-hint {
    display: none; margin: 0 12px; padding-top: 6px;
    font-size: 11.5px; color: rgba(255,255,255,.42);
}
.category-tabs.has-more { padding-right: 40px; }
.category-tabs.at-end { -webkit-mask-image: none; mask-image: none; }

/* ---- 大图查看（缩放） ---- */
.zoom-overlay { touch-action: pan-y; overscroll-behavior: contain; }
.zoom-overlay img {
    margin: auto;
    transition: transform .18s ease;
    transform-origin: 50% 50%;
    will-change: transform;
    -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
.zoom-overlay.dragging img { transition: none; }
.zoom-close {
    position: fixed; top: 14px; right: 14px; z-index: 5;
    width: 36px; height: 36px; border-radius: 50%; border: none; padding: 0;
    background: rgba(255,255,255,.14); color: #fff; font-size: 20px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.zoom-tip {
    position: fixed; left: 0; right: 0; bottom: 22px; z-index: 5; text-align: center;
    font-size: 12px; color: rgba(255,255,255,.62); pointer-events: none;
    opacity: 0; transition: opacity .4s;
}
.zoom-tip.show { opacity: 1; }
