/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    padding-top: 70px; /* header 的高度 */
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    background: linear-gradient(to top, #7fffd4, #98ffda);
    min-height: 100vh; /* 确保背景填充整个视窗高度 */
    margin: 0; /* 移除默认边距 */
}

/* 变量定义 */
:root {
    --header-gradient: linear-gradient(to right, #1e3c72, #2a5298);
    --header-text: #ffffff;
    --dropdown-hover: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --social-hover: rgba(255, 255, 255, 0.15);
}

.logo img {
    height: 40px;
    width: auto;
}
/* 分类选择器样式 */
.category-selector {
    position: relative;
    margin-right: 20px;
}

.category-dropdown-toggle {
    background: var(--header-gradient);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 16px;
    min-width: 150px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-dropdown-toggle:hover {
    background: var(--dropdown-hover);
    border-color: rgba(255, 255, 255, 0.3);
}

.category-dropdown-toggle i {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.category-dropdown-toggle.active i {
    transform: rotate(180deg);
}

/* 下拉菜单层级需要调整 */
.category-dropdown,
.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--header-gradient);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: none;
    z-index: 1001; /* 比 header 高一层 */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px; /* 限制最大高度 */
    overflow-y: auto; /* 添加垂直滚动条 */
}

.category-option {
    color: var(--text-primary);
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.category-option:hover {
    background: var(--dropdown-hover);
}

.category-option.active {
    background: var(--dropdown-hover);
}

/* 语言选择器样式 */
.language-selector {
    position: relative;
    min-width: 160px;
}

.language-display {
    background: var(--header-gradient);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.language-display:hover {
    background: var(--dropdown-hover);
    border-color: rgba(255, 255, 255, 0.3);
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--header-gradient);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: none;
    z-index: 1000;
    min-width: 160px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.language-option {
    color: var(--text-primary);
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.language-option:hover {
    background: var(--dropdown-hover);
}

.language-option.active {
    background: var(--dropdown-hover);
}

/* 动画效果 */
@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-dropdown.show,
.language-dropdown.show {
    display: block;
    animation: dropdownFade 0.2s ease;
}

/* 滚动条美化 */
.category-dropdown::-webkit-scrollbar {
    width: 6px;
}

.category-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.category-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.category-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 加载中提示 */
.loading {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    color: #666;
    display: none; /* 默认隐藏 */
}

.loading.active {
    display: block; /* 显示加载状态 */
}

.loading i {
    margin-right: 8px;
    animation: spin 1s infinite linear;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    width: 100%;
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 16px;
    display: block;
}

.empty-state-text {
    font-size: 18px;
    color: #666;
    margin: 0;
}


/* 修改游戏列表容器样式 */
.games-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    /* 修改这里：使用auto-fit而不是auto-fill，确保卡片能够铺满容器 */
    grid-template-columns: repeat(auto-fit, 150px);
    gap: 20px;
    justify-content: center;
    padding-bottom: 40px; /* 添加底部间距 */
}

/* 游戏卡片样式 */
.game-card {
    width: 150px;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 游戏图片容器 */
.media-container {
    width: 150px;
    height: 270px; /* 9:16 比例 */
    position: relative;
}

.game-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.demo-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 游戏信息区域 */
.game-info {
    padding: 8px;
    background: #fff;
}

/* 游戏标题 */
.game-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;  /* 限制为一行 */
    -webkit-box-orient: vertical;
    text-align: center;
}

/* 热门等级样式 */
.hot-level-1 {
    border: none;
}

.hot-level-2 {
    border: 2px solid #ffd700;
}

.hot-level-3 {
    border: 2px solid #ff4d4f;
}

/* 修改 Header 样式 */
.site-header {
    background: var(--header-gradient);
    color: var(--header-text);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* Logo 样式 */
.logo {
    flex-shrink: 0; /* 防止 logo 被压缩 */
}

.logo img {
    height: 40px;
    width: auto;
}

/* Header工具区域样式调整 */
.header-tools {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    padding-right: 10px; /* 添加右边距 */
}

/* 调整各个选择器的基础样式 */
.social-selector,
.category-selector,
.language-selector {
    position: relative;
}

.social-dropdown-toggle,
.category-dropdown-toggle,
.language-display {
    background: var(--header-gradient);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 16px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    body {  
        min-height: auto; /* 移除最小高度限制 */  
        display: block; /* 改回普通布局 */  
        padding-top: 70px;  
    } 

    .site-header {
        padding: 5px 5px !important; /* 强制覆盖其他样式 */
    }

    .logo img {
        height: 32px !important;
    }

    .header-tools {
        gap: 8px !important;
        flex: 1 !important;
        margin-left: 0px !important;
        padding-right: 5px !important;
        display: flex !important;
        justify-content: flex-end !important;
        max-width: calc(100% - 40px) !important; /* 确保不会与logo重叠 */
    }

    .social-dropdown-toggle,
    .category-dropdown-toggle,
    .language-display {
        padding: 8px !important;
        height: 34px !important;
        width: 100% !important;
        min-width: unset !important;
        font-size: 14px !important;
    }

    .social-selector {
        flex: 2 !important; /* 改为 1:1:1 比例 */
        min-width: 0 !important;
    }

    .category-selector {
        flex: 1 !important; /* 改为 1:1:1 比例 */
        min-width: 0 !important;
    }

    .language-selector {
        flex: 2 !important; /* 改为 1:1:1 比例 */
        min-width: 0 !important;
    }

    /* 隐藏分享按钮文字 */
    /*.social-dropdown-toggle span {*/
    /*    display: none !important;*/
    /*}*/

    /* 调整文字溢出 */
    #currentCategory,
    #currentLang {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        max-width: calc(100% - 20px) !important;
        font-size: 14px !important;
    }

    /* 调整图标间距 */
    .social-dropdown-toggle i:last-child,
    .category-dropdown-toggle i,
    .language-display i {
        margin-left: 4px !important;
    }

    /* 确保下拉菜单正确显示 */
    .social-dropdown,
    .category-dropdown,
    .language-dropdown {
        width: auto !important;
        min-width: 120px !important;
        right: 0 !important;
    }
    .games-container {
        padding: 10px;
        padding-bottom: 20px; /* 移动端稍微减小底部间距 */
        gap: 10px;
    }
    .site-footer {
        position: relative ; /* 改回相对定位 */  
        padding: 10px;  /* 更小的内边距 */
    }

    .footer-links {
        display: flex;
        justify-content: center;  /* 水平居中 */
        gap: 20px;  /* 链接之间的间距 */
        margin-bottom: 8px;
    }

    .footer-links a {
        margin: 0;  /* 移除默认边距 */
    }
}

/* 超小屏幕额外适配 */
@media screen and (max-width: 360px) {
    .site-header {
        padding: 8px 12px; /* 调整超小屏幕的左右内边距 */
    }

    .logo img {
        height: 28px;
    }

    .header-tools {
        margin-left: 12px; /* 调整与logo的间距 */
        padding-right: 3px; /* 调整右边距 */
    }
}

/* 分类选择器和语言选择器样式保持不变 */
.game-type {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

/* 如果类型太长需要换行 */
.game-type {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 可选：让类型标签更美观 */
.game-type {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* 超小屏幕适配 */
@media screen and (max-width: 360px) {
    .games-container {
        grid-template-columns: repeat(2, 140px); /* 更小的卡片宽度 */
        gap: 10px;
        max-width: 280px;
    }

    .game-card {
        width: 140px;
    }

    .media-container {
        height: 187px; /* 保持宽高比 */
    }
}

/* 社交媒体下拉按钮样式 */
.social-selector {
    position: relative;
    margin-right: 20px;
}

.social-dropdown-toggle {
    background: var(--header-gradient);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 16px;
    min-width: 120px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.social-dropdown-toggle:hover {
    background: var(--dropdown-hover);
    border-color: rgba(255, 255, 255, 0.3);
}

.social-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--header-gradient);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: none;
    z-index: 1001;
    min-width: 120px; /* 减小最小宽度 */
    width: auto; /* 自适应内容宽度 */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.social-option {
    color: var(--text-primary);
    padding: 8px 12px; /* 减小内边距 */
    display: flex;
    align-items: center;
    gap: 8px; /* 减小图标和文字的间距 */
    text-decoration: none;
    transition: background 0.2s ease;
    white-space: nowrap; /* 防止文字换行 */
}

.social-option:hover {
    background: var(--social-hover);
    color: var(--text-primary);
}

.social-option i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.social-dropdown.show {
    display: block;
    animation: dropdownFade 0.2s ease;
}

/* 社交媒体下拉框基础样式 */
.social-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--header-gradient);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: none;
    z-index: 1001;
    min-width: 120px; /* 减小最小宽度 */
    width: auto; /* 自适应内容宽度 */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.social-option {
    color: var(--text-primary);
    padding: 8px 12px; /* 减小内边距 */
    display: flex;
    align-items: center;
    gap: 8px; /* 减小图标和文字的间距 */
    text-decoration: none;
    transition: background 0.2s ease;
    white-space: nowrap; /* 防止文字换行 */
}

/* 显示下拉框的样式 */
.social-dropdown.show {
    display: block !important; /* 确保显示 */
}

/* 动画效果 */
@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.social-dropdown.show {
    display: block;
    animation: dropdownFade 0.2s ease;
}

/* 非移动端显示社区文字 */
#communityText {
    margin: 0 4px;
}

/* 页脚样式 */
.site-footer {
    background-color: #333;  
    padding: 15px ;  
    text-align: center ;
    width: 100%;  
    z-index: 1000 ;  
    box-sizing: border-box ; /* 确保padding不会增加总宽度 */  
    margin-top: auto; /* 使footer保持在底部 */
}

.footer-links {
    margin-bottom: 10px;  /* 减小底部间距 */
}

.footer-links a {
    color: #fff;
    text-decoration: none;
    margin: 0 10px;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-links a:hover {
    opacity: 1;
}

.copyright {
    color: #fff;
    font-size: 12px;  /* 稍微减小字体 */
    opacity: 0.8;
    margin-bottom: 0;  /* 移除底部间距 */
}

.powered-by {
    color: #fff;
    font-size: 14px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.famobi-logo {
    height: 30px;
    width: auto;
    opacity: 0.8;
}

/* 修改body样式以确保footer始终在底部 */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 70px;
    margin: 0;
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    background: linear-gradient(to top, #7fffd4, #98ffda);
}
