/* Responsive Styles */

/* 大屏幕设备 (桌面电脑, 1200px 及以上) */
@media (min-width: 1200px) {
    .game-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 中等屏幕设备 (平板电脑, 992px 及以上) */
@media (max-width: 1199px) and (min-width: 992px) {
    .game-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sidebar {
        width: 100px;
    }
}

/* 小屏幕设备 (平板电脑, 768px 及以上) */
@media (max-width: 991px) and (min-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar {
        width: 80px;
    }

    .menu-item {
        height: 70px;
    }

    .menu-item .text {
        font-size: 11px;
    }

    .menu-item.active a::before {
        width: 50px;
        height: 40px;
    }
}

/* 超小屏幕设备 (手机, 767px 及以下) */
@media (max-width: 767px) {

    /* 隐藏搜索框 */
    .search-filter {
        display: none !important;
    }

    /* 强制设置游戏网格为3列布局 */
    .game-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
    }

    /* 确保游戏卡片适应空间 */
    .game-card {
        width: 100% !important;
        margin: 0 !important;
    }

    /* 调整游戏缩略图尺寸 */
    .game-thumb {
        height: 0 !important;
        padding-bottom: 100% !important;
        /* 正方形比例 */
        position: relative !important;
    }

    .game-thumb img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* 调整banner高度 */
    .banner-wrapper {
        height: 100px;
    }

    .content {
        padding: 10px;
    }

    .sidebar {
        width: 60px;
    }

    .menu-item {
        height: 60px;
    }

    .menu-item .text {
        font-size: 10px;
    }

    .menu-item.active a::before {
        width: 40px;
        height: 35px;
    }

    .tab {
        display: flex;
        flex-direction: row;
        /* 在手机上改为水平排列更节省空间 */
        align-items: center;
        padding: 8px 12px;
        gap: 5px;
        height: auto;
        /* 自适应高度 */
        width: auto;
        /* 自适应宽度 */
    }

    .tab .icon {
        width: 20px;
        /* 减小图标尺寸以适应手机屏幕 */
        height: 20px;
        display: inline-block;
        /* 确保图标显示 */
        margin-bottom: 0;
        /* 移除底部间距 */
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }

    .tab-text {
        font-size: 11px;
    }

    /* 调整提供商过滤器 */
    .provider-item {
        padding: 4px 8px;
        height: 30px;
        min-width: 50px;
    }

    .provider-item img {
        height: 18px;
    }

    /* 调整游戏信息样式 */
    .game-info {
        padding: 5px 2px !important;
    }

    .game-info h3 {
        font-size: 11px;
        margin-bottom: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .game-info p {
        font-size: 9px;
        margin-top: 0;
    }

    /* 游戏标题区域 */
    .section-header {
        margin-bottom: 8px;
    }

    .section-header h2 {
        font-size: 16px;
    }

    .game-count {
        font-size: 12px;
    }

    /* 提供商过滤器居中 */
    .search-provider-container {
        justify-content: center;
    }

    .provider-filters {
        width: 100%;
        overflow-x: auto;
        padding: 5px 0;
        display: flex;
        -webkit-overflow-scrolling: touch;
    }
}

/* 极小屏幕设备 (小型手机, 576px 及以下) */
@media (max-width: 576px) {

    /* 保持3列布局 */
    .game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .menu-item .icon {
        width: 18px;
        height: 18px;
    }

    .menu-item .text {
        display: none;
    }

    .menu-item {
        height: 50px;
    }

    /* 进一步缩小文字 */
    .game-info h3 {
        font-size: 10px;
    }

    .game-info p {
        font-size: 8px;
    }

    /* 调整游戏缩略图 */
    .game-thumb {
        height: 0;
        padding-bottom: 100%;
        /* 正方形比例 */
        border-radius: 8px;
    }
}


/* 特别针对超小屏幕，确保图标仍然显示 */
@media (max-width: 375px) {
    .tab {
        padding: 6px 8px;
    }

    .tab .icon {
        width: 16px;
        height: 16px;
        margin-right: 3px;
    }

    .tab-text {
        font-size: 10px;
    }
}

/* 响应式调整 */
@media (max-width: 991px) {
    .sidebar {
        display: none;
        /* 在小屏幕上隐藏左侧边栏 */
    }

    .content {
        padding: 10px;
    }

    /* 顶部横向滚动导航栏 */
    .top-nav {
        display: flex;
        overflow-x: auto;
        padding: 10px 0;
        margin-bottom: 15px;
        position: relative;
    }

    .top-nav:after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 3px;
        background-color: #1a1a1a;
    }

    .top-nav-track {
        position: absolute;
        bottom: 0;
        left: 0;
        height: 3px;
        width: 50px;
        background-color: #3fd142;
        z-index: 1;
        transition: transform 0.3s ease;
    }

    .top-nav-item {
        padding: 8px 15px;
        white-space: nowrap;
        color: #999;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .top-nav-item.active {
        color: #3fd142;
    }
}


/* PC端显示全部三个横幅 */
@media (min-width: 992px) {
    .banner-container {
        display: flex;
        justify-content: space-between;
        gap: 10px;
    }

    .banner-slide {
        flex: 0 0 calc(33.33% - 10px);
        height: 110px;
        position: relative;
    }

    .banner-slide img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* 隐藏轮播指示器，因为所有广告都显示 */
    .banner-dots {
        display: none;
    }
}

/* 手机端只显示一个并轮播 */
@media (max-width: 991px) {
    .banner-container {
        position: relative;
    }

    .banner-slide {
        flex: 0 0 100%;
        transition: opacity 0.5s ease;
        display: none;
    }

    .banner-slide.active {
        display: block;
    }

    .banner-dots {
        display: flex;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 横向滚动优化 */
.category-tabs,
.provider-filters {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    margin-right: -10px;
    margin-left: -10px;
    padding-left: 10px;
    padding-right: 10px;
}

/* 游戏卡片悬停效果适配 */
@media (max-width: 767px) {
    .play-button {
        width: 32px;
        height: 32px;
    }

    .play-icon {
        width: 14px;
        height: 14px;
    }
}