/* --- 基础与字体 --- */
body {
    font-family: 'Quicksand', sans-serif;
    line-height: 1.8;
    color: #333333;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

p { margin-bottom: 1.5rem; }

/* --- 顶部导航 (仅保留核心游戏分类) --- */
header {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 70px;
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: #3498db;
    text-decoration: none;
}

.logo span { color: #2c3e50; }

.nav-menu {
    display: flex !important;
    flex-direction: row !important;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item { margin-left: 10px; }

/* 胶囊式悬停效果 */
.nav-link {
    text-decoration: none;
    color: #555555;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    white-space: nowrap;
}

.nav-link:hover {
    background-color: #ebf5ff;
    color: #3498db;
}

/* --- 页面布局 --- */
#app-wrapper { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* 游戏网格容器：强制桌面端 5 列 */
.game-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5列布局 */
    gap: 20px;                             /* 卡片间距 */
    margin: 30px 0;
}

/* 游戏卡片样式优化 */
.game-card {
    background: #ffffff;
    border-radius: 12px;                   /* 圆角 */
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 15px;                         /* 卡片内边距 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); /* 图片中那种极淡的阴影 */
    border: 1px solid #f0f0f0;             /* 极其微弱的边框线 */
}

/* 悬停效果：阴影加深一点点 */
.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

/* 图片容器：确保图片在卡片中心且不留死角 */
.game-card .img-wrapper {
    width: 100%;
    height: 150px;                         /* 固定图片区域高度 */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.game-card img {
    max-width: 90%;                        /* 防止图片贴边 */
    max-height: 100%;
    object-fit: contain;                   /* 保持比例 */
}

/* 标题样式：加粗、居中、深灰色 */
.game-card .info {
    width: 100%;
    text-align: center;
}

.game-card h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;                      /* 字体加粗 */
    color: #444;                           /* 深灰色文字 */
    font-family: 'Quicksand', sans-serif;
}

/* --- 移动端适配 --- */
@media (max-width: 1024px) {
    .game-grid {
        grid-template-columns: repeat(3, 1fr); /* 平板 3 列 */
    }
}

@media (max-width: 600px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr); /* 手机 2 列 */
        gap: 12px;
    }
    .game-card .img-wrapper {
        height: 120px;
    }
}
/* --- 页脚整体样式 --- */
footer {
    margin-top: 60px;
    padding: 40px 20px;
    background-color: #ffffff;
    border-top: 1px solid #eee;
    text-align: center;
    color: #666;
}

/* 底部 About/Contact 链接 */
.footer-links {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    text-decoration: none;
    color: #666;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.footer-links a:hover { color: #3498db; }

/* 语言选择器样式优化 */
.language-wrapper {
    margin: 20px 0;
    font-size: 0.9rem;
}

.cs-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-family: 'Quicksand', sans-serif;
    color: #444;
    outline: none;
    cursor: pointer;
    background-color: #f9f9f9;
}

.copyright {
    font-size: 0.85rem;
    margin-bottom: 15px;
    color: #999;
}
/* 移动端汉堡菜单按钮容器 */
.mobile-toggle {
    display: none; /* 桌面端由 JS 或 媒体查询控制显示 */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001;
}

/* 三条横线的通用样式 */
.mobile-toggle span {
    display: block;
    width: 100%;
    height: 4px;             /* 线条加厚，更有质感 */
    background-color: #3498db; /* 使用品牌蓝色 */
    border-radius: 10px;     /* 极大的圆角，看起来亲切 */
    transition: all 0.3s ease-in-out; /* 增加平滑的变形动画 */
}

/* --- 交互特效：点击后变成 X --- */

/* 第一条线旋转 */
.mobile-toggle.active span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

/* 第二条线隐藏 */
.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

/* 第三条线旋转 */
.mobile-toggle.active span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

/* 适配显示逻辑 */
@media (max-width: 768px) {
    .mobile-toggle {
        display: flex; /* 在手机端显示 */
    }
}
/* --- 移动端适配 --- */
@media (max-width: 768px) {
    .nav-menu {
        display: none !important;
        flex-direction: column !important;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: #fff;
        padding: 15px 0 !important;
        box-shadow: 0 5px 10px rgba(0,0,0,0.05);
    }
    .nav-menu.active { display: flex !important; }
    .nav-item { margin: 8px 0; width: 100%; text-align: center; }
    .game-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* 1. 桌面端（宽屏幕）强制隐藏 */
@media screen and (min-width: 769px) {
    #mobile-btn {
        display: none !important;
    }
}

/* 2. 移动端（窄屏幕）强制显示并美化 */
@media screen and (max-width: 768px) {
    #mobile-btn {
        display: flex !important; /* 强制显示 */
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        cursor: pointer;
        z-index: 9999;
        /* 这里的 margin 根据你的 Logo 位置调整，确保它在右侧居中 */
        margin-top: 5px; 
    }

    #mobile-btn span {
        display: block !important;
        width: 100%;
        height: 4px;             /* 线条厚度 */
        background-color: #3498db !important; /* 蓝色 */
        border-radius: 10px;     /* 圆角 */
        transition: 0.3s;
    }
}

/* 点击后的 X 变形动画 */
#mobile-btn.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
#mobile-btn.active span:nth-child(2) {
    opacity: 0;
}
#mobile-btn.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 确保游戏容器内的元素层级正确 */
#game {
    position: relative !important;
    overflow: hidden;
}

#canvasStage {
    z-index: 1 !important;
    pointer-events: auto !important;
}

#stage {
    z-index: 2 !important;
    /* 重点：SVG本身不能阻挡Canvas，但里面的内容要能被点到 */
    pointer-events: none !important;
}

#stage * {
    /* 重新开启SVG内部元素的点击 */
    pointer-events: inherit;
}

#stage g[pointer-events="all"], 
#stage [cursor="pointer"] {
    pointer-events: all !important;
}