/* 基础布局样式 */
html {
    scroll-behavior: smooth; /* 启用平滑滚动 */
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
}

.layout {
    display: flex;
    flex-direction: row;
    min-height: 100vh; /* 改为 min-height，而不是固定 height */
    margin: 0 auto;
    max-width: 1200px;
    padding: 20px;
    gap: 20px;
}

.left-nav {
    position: fixed;
    margin-top: 80px; /* 距离顶部导航栏的高度 */
    left: 0;
    width: 200px; /* 固定宽度 */
    height: calc(100vh - 50px); /* 高度为视口高度减去顶部导航栏的高度 */
    background-color: #f0f0f0; /* 背景颜色 */
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1); /* 添加阴影 */
    overflow-y: auto; /* 启用垂直滚动条 */
    padding: 20px;
    margin-left: 200px; /* 添加左侧留白 */
    margin-right: 20px; /* 与主内容区域的间距 */
    z-index: 1000; /* 确保在导航栏下面 */
}

/* 主内容区域 */
.main-content {
    width: 100%;
    margin-top: 100px;
    margin-left: 240px;
    width: calc(100% - 240px);
    margin-right: 50px;
    flex: 1; /* 改为 flex: 1，让主内容区域填充剩余空间 */
    min-height: auto; /* 移除固定的最小高度 */
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 50px; /* 确保内容与页脚之间有足够间距 */
}

.main-content::-webkit-scrollbar {
    height: 8px; /* 滚动条高度 */
}

.main-content::-webkit-scrollbar-thumb {
    background-color: #ccc; /* 滚动条颜色 */
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-track {
    background-color: #f0f0f0; /* 滚动条轨道颜色 */
}

/* 导航栏 */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    padding: 10px 20px;
    z-index: 1001;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #ffffff; /* 统一为白色背景 */
    box-sizing: border-box;
}

.top-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.top-nav .logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2c3e50; /* 统一文字颜色 */
    text-decoration: none;
}

.top-nav .logo a {
    color: #2c3e50;
    text-decoration: none;
}

.top-nav .logo a:hover {
    color: #3498db;
}

.top-nav .search-bar {
    display: flex;
    align-items: center;
}

.top-nav .search-bar input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
    outline: none;
    font-size: 1rem;
    background-color: #fff;
}

.top-nav .search-bar button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    background-color: #3498db;
    color: white;
    transition: background-color 0.3s ease;
}

.top-nav .search-bar button:hover {
    background-color: #2980b9;
}

/* 统一顶部广告栏样式 */
.top-ad {
    position: fixed;
    top: 70px; /* 调整位置，确保在导航栏下面 */
    left: 0;
    width: 100%;
    height: 30px; /* 调整高度 */
    background-color: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

/* Theme Switcher Button */
.theme-switcher {
    margin-top: 20px;
    padding: 10px 15px;
    background-color: #e63946; /* 默认红色背景 */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%; /* 按钮宽度与导航栏一致 */
    text-align: center;
    transition: background-color 0.3s ease;
}

.theme-switcher:hover {
    background-color: #d62828; /* 悬停时更深的红色 */
}

/* Game Cards */
.game-card {
    flex: 0 0 200px; /* 固定宽度为 200px */
    max-width: 200px; /* 确保宽度不超过 200px */
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    width: 460px; /* 限制卡片宽度 */
    height: 220px; /* 限制卡片高度 */
}

.game-card:hover {
    transform: scale(1.05); /* 鼠标悬停时放大卡片 */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* 添加阴影 */
}

.game-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.game-card h3 {
    font-size: 1.2rem;
    margin: 10px;
    color: #333;
    white-space: nowrap; /* 单行显示 */
    overflow: hidden; /* 超出部分隐藏 */
    text-overflow: ellipsis; /* 显示省略号 */
}

.game-card p {
    font-size: 0.9rem;
    color: #555;
    margin: 0 10px 10px;
    display: -webkit-box; /* 使用弹性盒子模型 */
    -webkit-line-clamp: 2; /* 限制为 2 行 */
    -webkit-box-orient: vertical; /* 垂直方向排列 */
    overflow: hidden; /* 超出部分隐藏 */
    text-overflow: ellipsis; /* 显示省略号 */
}

/* 图片预览样式 */
.game-preview img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease; /* 添加平滑动画 */
}

.game-card:hover .game-preview img {
    transform: scale(1.1); /* 鼠标悬停时放大图片 */
}

/* 标题和描述的初始状态 */
.game-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8); /* 更深的半透明背景 */
    color: #fff; /* 白色文字 */
    text-align: center;
    padding: 10px;
    opacity: 0; /* 初始隐藏 */
    visibility: hidden; /* 初始不可见 */
    transform: translateY(20px); /* 初始位置向下偏移 */
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

/* 鼠标悬停时显示标题和描述 */
.game-card:hover .game-info {
    opacity: 1; /* 显示 */
    visibility: visible; /* 可见 */
    transform: translateY(0); /* 恢复到原始位置 */
}

/* 标题样式 */
.game-info h3 {
    margin: 5px 0;
    font-size: 1rem; /* 标题字体大小 */
    color: #fff; /* 确保标题为白色 */
    white-space: normal; /* 允许换行 */
    overflow: hidden; /* 超出部分隐藏 */
    text-overflow: ellipsis; /* 显示省略号 */
    display: -webkit-box; /* 使用弹性盒子模型 */
    -webkit-line-clamp: 2; /* 限制为 2 行 */
    -webkit-box-orient: vertical; /* 垂直方向排列 */
}

/* 描述样式 */
.game-info p {
    margin: 0;
    font-size: 0.9rem; /* 描述字体大小 */
    line-height: 1.2; /* 紧凑的行高 */
    color: #ddd; /* 描述文字为浅灰色，避免过亮 */
    display: -webkit-box; /* 使用弹性盒子模型 */
    -webkit-line-clamp: 2; /* 限制为 2 行 */
    -webkit-box-orient: vertical; /* 垂直方向排列 */
    overflow: hidden; /* 超出部分隐藏 */
    text-overflow: ellipsis; /* 显示省略号 */
}

/* Right Sidebar */
.right-nav {
    width: 200px;
    background-color: #1a1a1a;
    padding: 20px;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 120px);
    overflow-y: auto;
}

.right-ad {
    text-align: center;
    background-color: #7f1d1d;
    padding: 15px;
    color: #fff;
    border: 1px solid #b91c1c;
}

section {
    display: flex; /* 使用弹性布局 */
    flex-wrap: wrap; /* 允许换行 */
    gap: 10px; /* 卡片之间的间距 */
    margin-bottom: 20px; /* 每个分类之间的间距 */
}

section h3 {
    flex: 0 0 100%;
    margin-bottom: 10px;
    font-size: 1.5rem;
    color: #333;
}

/* Category Buttons */
.category-buttons {
    display: flex;
    flex-direction: column; /* 垂直排列按钮 */
    gap: 10px; /* 按钮之间的间距 */
    margin-top: 20px;
}

.category-button {
    padding: 10px 15px;
    font-size: 1rem;
    font-weight: bold;
    color: #ffffff;
    background-color: #ea2a3a96; /* 默认按钮背景颜色 */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: left; /* 文本左对齐 */
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.category-button:hover {
    background-color: #0056b3; /* 悬停时的背景颜色 */
    transform: translateY(-2px); /* 悬停时的轻微上移效果 */
}

.category-button:active {
    background-color: #003f7f; /* 点击时的背景颜色 */
    transform: translateY(0); /* 点击时恢复位置 */
}

/* Back Button */
.back-button {
    display: block; /* 独占一行 */
    width: 100%; /* 按钮宽度占满父容器 */
    padding: 10px 15px; /* 内边距 */
    font-size: 1rem; /* 字体大小 */
    font-weight: bold; /* 字体加粗 */
    color: #ffffff; /* 按钮文字颜色 */
    background-color: #007bff; /* 默认按钮背景颜色 */
    border: none; /* 去掉边框 */
    border-radius: 4px; /* 圆角 */
    cursor: pointer; /* 鼠标悬停时显示手型 */
    text-align: center; /* 文本居中 */
    transition: background-color 0.3s ease, transform 0.2s ease; /* 添加过渡效果 */
    margin-bottom: 15px; /* 与其他元素的间距 */
}

.back-button:hover {
    background-color: #0056b3; /* 悬停时的背景颜色 */
    transform: translateY(-2px); /* 悬停时的轻微上移效果 */
}

.back-button:active {
    background-color: #003f7f; /* 点击时的背景颜色 */
    transform: translateY(0); /* 点击时恢复位置 */
}

/* Hot Games Section */
#hot-games {
    margin: 20px 0;
}

.hot-games-container {
    display: flex;
    overflow-x: auto; /* 启用横向滚动 */
    gap: 10px; /* 卡片之间的间距 */
    padding: 10px;
    scroll-behavior: smooth; /* 平滑滚动 */
    z-index: 1; /* 确保滚动条在其他元素之上 */
}

.hot-games-container::-webkit-scrollbar {
    height: 8px; /* 滚动条高度 */
}

.hot-games-container::-webkit-scrollbar-thumb {
    background-color: #ec7d7d; /* 滚动条颜色 */
    border-radius: 4px;
}

.hot-games-container::-webkit-scrollbar-track {
    background-color: #f5eaea; /* 滚动条轨道颜色 */
}

/* Other Categories */
section:not(#hot-games) {
    display: flex; /* 使用弹性布局 */
    flex-wrap: wrap; /* 允许换行 */
    gap: 10px; /* 卡片之间的间距 */
    margin-bottom: 20px; /* 每个分类之间的间距 */
}

section:not(#hot-games) .game-card {
    flex: 1 1 calc(25% - 20px); /* 每行显示 3 个卡片，间距为 20px */
    max-width: calc(25% - 20px); /* 确保卡片宽度一致 */
}

/* ===========================================
   FOOTER STYLES - 完整版本
   =========================================== */
.footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 40px 0 20px;
    margin-top: 50px;
    width: 100%;
    box-sizing: border-box;
    clear: both;
    position: relative;
    z-index: 1;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    margin-left: 240px; /* 为左侧导航栏留出空间 */
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 改为3列，因为只有3个section */
    gap: 30px;
}

.footer-section h3 {
    color: #3498db;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.footer-section p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #bdc3c7;
    font-size: 14px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 14px;
}

.footer-section ul li a:hover {
    color: #3498db;
}

.footer-bottom {
    border-top: 1px solid #34495e;
    margin-top: 30px;
    padding-top: 20px;
    text-align: center;
    color: #95a5a6;
    font-size: 14px;
    margin-left: 240px; /* 为左侧导航栏留出空间 */
}

/* Footer 响应式设计 */
@media (max-width: 768px) {
    .footer-container {
        margin-left: 0; /* 移动端移除左边距 */
        grid-template-columns: 1fr; /* 移动端单列显示 */
        gap: 25px;
        padding: 0 15px;
    }
    
    .footer-bottom {
        margin-left: 0; /* 移动端移除左边距 */
        font-size: 12px;
    }
    
    .footer {
        padding: 30px 0 15px;
    }
    
    .footer-section h3 {
        font-size: 16px;
    }
    
    .footer-section p,
    .footer-section ul li a {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 25px 0 15px;
    }
    
    .footer-container {
        gap: 20px;
        padding: 0 10px;
    }
}

/* 深色主题支持 */
body.dark-theme .footer {
    background-color: #1a252f;
}

body.dark-theme .footer-section h3 {
    color: #74b9ff;
}

body.dark-theme .footer-section p,
body.dark-theme .footer-section ul li a {
    color: #ddd;
}

body.dark-theme .footer-section ul li a:hover {
    color: #74b9ff;
}

body.dark-theme .footer-bottom {
    border-top-color: #2d3436;
    color: #b2bec3;
}

/* Footer Styles */
.footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 40px 0 20px;
    margin-top: 50px;
    width: 100%;
    box-sizing: border-box;
    clear: both;
    position: relative;
    z-index: 1;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    margin-left: 240px; /* 为左侧导航栏留出空间 */
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 改为3列，因为只有3个section */
    gap: 30px;
}

.footer-section h3 {
    color: #3498db;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.footer-section p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #bdc3c7;
    font-size: 14px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 14px;
}

.footer-section ul li a:hover {
    color: #3498db;
}

.footer-bottom {
    border-top: 1px solid #34495e;
    margin-top: 30px;
    padding-top: 20px;
    text-align: center;
    color: #95a5a6;
    font-size: 14px;
    margin-left: 240px; /* 为左侧导航栏留出空间 */
}

/* Footer 响应式设计 */
@media (max-width: 768px) {
    .footer-container {
        margin-left: 0; /* 移动端移除左边距 */
        grid-template-columns: 1fr; /* 移动端单列显示 */
        gap: 25px;
        padding: 0 15px;
    }
    
    .footer-bottom {
        margin-left: 0; /* 移动端移除左边距 */
        font-size: 12px;
    }
    
    .footer {
        padding: 30px 0 15px;
    }
    
    .footer-section h3 {
        font-size: 16px;
    }
    
    .footer-section p,
    .footer-section ul li a {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 25px 0 15px;
    }
    
    .footer-container {
        gap: 20px;
        padding: 0 10px;
    }
}

/* 深色主题支持 */
body.dark-theme .footer {
    background-color: #1a252f;
}

body.dark-theme .footer-section h3 {
    color: #74b9ff;
}

body.dark-theme .footer-section p,
body.dark-theme .footer-section ul li a {
    color: #ddd;
}

body.dark-theme .footer-section ul li a:hover {
    color: #74b9ff;
}

body.dark-theme .footer-bottom {
    border-top-color: #2d3436;
    color: #b2bec3;
}

/* Policy Pages Styles */
.policy-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.6;
    color: #333;
    margin-top: 20px; /* 为顶部导航栏和广告栏留出空间 */
}

.policy-container h1 {
    color: #2c3e50;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.policy-container h2 {
    color: #34495e;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 20px;
}

.policy-container .last-updated {
    color: #7f8c8d;
    font-style: italic;
    margin-bottom: 30px;
    padding: 10px;
    background-color: #f8f9fa;
    border-left: 4px solid #3498db;
}

.policy-container section {
    margin-bottom: 25px;
}

.policy-container ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.policy-container li {
    margin-bottom: 8px;
}

.policy-container a {
    color: #3498db;
    text-decoration: none;
}

.policy-container a:hover {
    text-decoration: underline;
}

.policy-container strong {
    color: #2c3e50;
}

/* Dark theme support for policy pages */
body.dark-theme .policy-container {
    color: #ecf0f1;
}

body.dark-theme .policy-container h1 {
    color: #ecf0f1;
}

body.dark-theme .policy-container h2 {
    color: #bdc3c7;
}

body.dark-theme .policy-container .last-updated {
    background-color: #34495e;
    color: #bdc3c7;
}

body.dark-theme .policy-container strong {
    color: #ecf0f1;
}
