        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --theme-color: #663399;
            --primary-color: #f5f5f5;
            /* 主要颜色 */

        }

        html,
        body {
            font-family: Arial;
            background: #f5f5f5;
            color: #666;
            scroll-behavior: auto;
             max-width: 480px;
             margin: 0 auto;
        }

        h1 {
            font-family: "KaiTi", "STKaiti", serif;
            font-style: italic;
        }

        .header {
            /* position: sticky;
            top: 0;
            z-index: 200; */

            /* background: #ffffff; */

            padding:
                calc(env(safe-area-inset-top) + 14px) 16px 14px;

            display: flex;
            align-items: center;
            gap: 14px;

            /* border-bottom: 1px solid #f1f1f1; */

            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
            color: var(--theme-color);
        }

        /* Logo */

        .logo {
            width: 56px;
            height: 56px;

            border-radius: 18px;

            /* background:
                linear-gradient(135deg,
                    #111,
                    #444); */

            display: flex;
            align-items: center;
            justify-content: center;

            font-size: 30px;
            color: #fff;

            flex-shrink: 0;

            box-shadow:
                0 6px 18px rgba(0, 0, 0, 0.12);
        }

        /* 文字区域 */

        .header-text {
            flex: 1;
            min-width: 0;
        }

        /* 标题 */

        .header-title {
            font-size: 24px;
            font-weight: 800;

            color: #111;

            line-height: 1.1;

            margin-bottom: 6px;

            letter-spacing: -0.5px;
        }

        /* 副标题 */

        .header-desc {
            font-size: 13px;

            color: #777;

            line-height: 1.5;

            display: -webkit-box;

            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;

            overflow: hidden;
        }

        /* 右侧按钮 */

        .header-btn {
            width: 42px;
            height: 42px;

            border-radius: 14px;

            background: #f5f5f5;

            display: flex;
            align-items: center;
            justify-content: center;

            font-size: 20px;

            cursor: pointer;

            transition: 0.2s;
        }

        .header-btn:active {
            transform: scale(0.94);
            background: #eee;
        }

        /* 深色模式 */

        @media (prefers-color-scheme:dark) {

            .header {
                /* background: #181818;
                border-color: #2a2a2a; */
            }

            .header-title {
                color: #fff;
            }

            .header-desc {
                color: #aaa;
            }

            .header-btn {
                background: #2b2b2b;
                color: #fff;
            }
        }

        /* 顶部分类 */

        .top-cates {
            position: sticky;
            top: 0;
            z-index: 999;
            background: var(--primary-color);
            padding: 12px 12px;
            display: flex;
            align-items: center;
            /* border-bottom: 1px solid #eee; */
            /* 防止滚动时抖动 */
            will-change: transform;

        }

        .cate-scroll {
            flex: 1;
            overflow-x: auto;
            display: flex;
            gap: 10px;
            scrollbar-width: none;
        }

        .cate-scroll::-webkit-scrollbar {
            display: none;
        }

        .cate-item {
            flex-shrink: 0;
            padding: 8px 20px;
            /* background: #f2f2f2; */
            border-radius: 999px;
            font-size: 16px;
            cursor: pointer;
            white-space: nowrap;
            overflow: hidden;
            /* 🔥 防止子层/阴影露出直角 */
            -webkit-tap-highlight-color: transparent;
            /* 🔥 去掉手机点击闪白块 */
            user-select: none;
        }

        .cate-item.active {
            font-size: 18px;
            background: #fff;
            color: var(--theme-color);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
        }

        .all-btn {
            width: 20px;
            height: 42px;
            margin-left: 10px;
            border-radius: 12px;
            /* background: #111; */
            /* color: #999; */
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 20px;
        }

        /* 游戏区域 */

        .games {
            padding: 14px;
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 14px;
        }

        .game-card {
            background: #fff;
            border-radius: 6px;
            overflow: hidden;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
        }

        .game-thumb {
            position: relative;
            aspect-ratio: 1/1;
            overflow: hidden;
        }

        .game-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        /* 底部分类弹窗 */

        .mask {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.45);
            display: none;
            z-index: 999;
        }

        .mask.show {
            display: block;
        }

        .cate-popup {
            position: absolute;
            left: 0;
            bottom: 0;

            width: 100%;
            height: 60vh;

            background: #fff;
            border-radius: 24px 24px 0 0;

            padding: 20px;

            overflow-y: auto;

            animation: slideUp 0.25s ease;
            position: relative;
            /* ⭐ 关键：让关闭按钮定位 */
        }

        @keyframes slideUp {
            from {
                transform: translateY(100%);
            }

            to {
                transform: translateY(0);
            }
        }

        /* ⭐ 关闭按钮 */
        .popup-close {
            position: absolute;
            top: -4px;
            right: 0px;

            width: 36px;
            height: 36px;

            border-radius: 50%;

            /* background: #f2f2f2; */

            display: flex;
            align-items: center;
            justify-content: center;

            font-size: 16px;
            font-weight: bold;

            cursor: pointer;

            transition: 0.2s;
        }

        .popup-close:hover {
            background: #e5e5e5;
            transform: scale(1.05);
        }

        .popup-close:active {
            transform: scale(0.95);
        }

        .cate-popup {
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            height: 60vh;
            background: #fff;
            border-radius: 12px 12px 0 0;
            padding: 30px 20px;
            overflow-y: auto;
            animation: up .25s ease;
        }

        @keyframes up {
            from {
                transform: translateY(100%);
            }

            to {
                transform: translateY(0);
            }
        }

        .popup-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 14px;
        }

        .popup-item {
            position: relative;
            border-radius: 16px;
            overflow: hidden;
            aspect-ratio: 1/1;
            cursor: pointer;
        }

        .popup-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .popup-name {
            position: absolute;
            left: 50%;
            bottom: 5px;
            transform: translateX(-50%);

            color: #fff;
            border-radius: 999px;

            font-size: 13px;
            font-weight: 600;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        }