/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow: auto; /* 允许页面滚动 */
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5px 10px; /* 减少容器内边距 */
}

/* 标题样式 */
h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* section元素样式重置 */
section {
    margin: 0;
    padding: 0;
}

.free-games, .paid-games {
    margin: 0 0 10px 0; /* 减少游戏列表之间的间距 */
    padding: 0;
}

/* 游戏分类标题 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 5px 0; /* 减少标题区域的上下边距 */
    position: relative;
}

.section-title {
    font-size: 1.8rem;
    color: #3498db;
    display: flex;
    align-items: center;
}

.section-title::before {
    content: "🎮";
    margin-right: 10px;
    font-size: 1.5rem;
}

.paid-games .section-title {
    color: #e74c3c;
}

.paid-games .section-title::before {
    content: "🔑";
}

/* 更多按钮样式 */
.more-btn {
    color: #666;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.more-btn:hover {
    color: #3498db;
}

/* 分类标题下划线 */
.section-header::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background-color: #3498db;
    position: absolute;
    left: 0;
    bottom: -5px;
}

.paid-games .section-header::after {
    background-color: #e74c3c;
}

/* 游戏列表样式 */
.game-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px; /* 减少游戏项之间的间距 */
    max-width: 100%;
    margin: 15px 0 0 0;
    padding: 0;
}

/* 游戏卡片链接样式 */
.game-item-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease;
}

.game-item-link:hover {
    transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .game-list {
        grid-template-columns: repeat(4, 1fr);
    }
    /* 中等屏幕隐藏多余的游戏卡片（只显示前10个） */
    .game-item:nth-child(n+11) {
        display: none;
    }
}

@media (max-width: 992px) {
    .game-list {
        grid-template-columns: repeat(3, 1fr);
    }
    /* 中等屏幕隐藏多余的游戏卡片（只显示前9个） */
    .game-item:nth-child(n+10) {
        display: none;
    }
}

@media (max-width: 768px) {
    .game-list {
        grid-template-columns: repeat(3, 1fr); /* 在中等屏幕和移动端改为3列布局 */
        gap: 10px; /* 减小间距以适应3列布局 */
    }
    /* 移动端隐藏多余的游戏卡片（只显示前8个） */
    .game-item:nth-child(n+9) {
        display: none;
    }
}

@media (max-width: 480px) {
    .game-list {
        grid-template-columns: repeat(3, 1fr); /* 在小屏移动端改为3列布局 */
        gap: 8px; /* 进一步减小间距以适应3列布局 */
    }
    /* 小屏移动端隐藏多余的游戏卡片（只显示前8个） */
    .game-item:nth-child(n+9) {
        display: none;
    }
}

/* 游戏项样式 */
.game-item {
    position: relative;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    padding: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 200px;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

@media (max-width: 768px) {
    .game-item {
        width: 100%;
        height: 120px; /* 恢复移动端游戏项高度 */
    }
}

@media (max-width: 480px) {
    .game-item {
        width: 100%;
        height: 110px; /* 恢复小屏手机游戏项高度 */
    }
}

/* 价格标签样式 */
.price-tag {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: #ff4757;
    color: white;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    z-index: 10;
    white-space: nowrap;
}

/* 置顶标签样式 */
.top-tag {
    position: absolute;
    top: 4px;
    left: 4px;
    background-color: #ff4d4f;
    color: white;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    z-index: 10;
    white-space: nowrap;
}

/* 白嫖标签样式 */
.free-tag {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: #27ae60;
    color: white;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    z-index: 10;
    white-space: nowrap;
}

.game-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* 游戏图标样式 */
.game-icon {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
    margin: 0;
}

.game-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
    border: none;
    border-radius: 0;
}

.game-item:hover .game-icon img {
    transform: scale(1.03);
}

/* 游戏信息样式 */
.game-info {
    padding: 2px 4px; /* 减少游戏卡片信息区域的内边距 */
    display: flex;
    flex-direction: column;
    text-align: left;
    justify-content: flex-end;
    min-height: 50px;
}

.game-name {
    font-size: 13px;
    font-weight: normal;
    color: #333;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    padding: 0;
}

.game-price {
    margin-bottom: 10px;
}

.free {
    color: #27ae60;
    font-weight: bold;
    font-size: 1.1rem;
}

.price {
    color: #e74c3c;
    font-weight: bold;
    font-size: 1.1rem;
}

/* 游戏标签样式 */
.game-tags {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 2px;
    margin-top: 2px;
    padding-top: 2px;
    border-top: 1px solid #f0f0f0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* 隐藏滚动条但保留滚动功能 */
    -ms-overflow-style: none;
    scrollbar-width: none;
    margin-bottom: 0;
}

/* Webkit浏览器隐藏滚动条 */
.game-tags::-webkit-scrollbar {
    display: none;
}

.tag {
    display: inline-block;
    background: #f8f9fa;
    color: #666;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* 移动端游戏卡片优化 */
@media (max-width: 768px) {
    .game-list {
        gap: 15px;
    }
    
    .game-item {
        padding: 0;
        border-radius: 4px;
        width: 100%;
        min-width: 0;
    }
    
    .game-icon {
        margin-bottom: 0;
        height: 100px;
    }
    
    .game-icon img {
        width: 100%;
        height: 100%;
        border-radius: 0;
        border-width: 0;
    }
    
    .game-name {
        font-size: 12px;
        margin-bottom: 0;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
        -webkit-box-orient: horizontal;
    }
    
    .game-tags {
        gap: 2px;
        margin-bottom: 0;
        padding-top: 3px;
    }
    
    .tag {
        padding: 1px 3px;
        font-size: 9px;
    }
    
    .price-tag {
        padding: 2px 4px;
        font-size: 10px;
        border-radius: 3px;
    }
    
    .top-tag {
        padding: 2px 4px;
        font-size: 10px;
        border-radius: 3px;
    }
    
    .free-tag {
        padding: 2px 4px;
        font-size: 10px;
        border-radius: 3px;
    }
    
    .game-item {
        box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    }
    
    .game-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.12);
    }
}

/* 游戏描述样式 */
.game-desc {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
}

/* 游戏信息文本样式 */
.game-info-text {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 15px;
    line-height: 1.5;
}

/* 按钮样式 */
.game-action {
    margin-top: 15px;
}

.get-cdkey-btn {
    background-color: #e74c3c;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.get-cdkey-btn:hover {
    background-color: #c0392b;
}

/* 响应式设计 */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
}