/* 移动端专用样式 - 适用于移动设备 */

/* 主要布局优化 */
.main-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
}

/* 游戏头部移动端样式 */
.game-header { 
    flex-direction: column; 
    align-items: center; 
    text-align: center; 
    margin: 0 15px 20px 15px;
    padding: 25px 20px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-light);
    width: calc(100% - 30px);
    box-sizing: border-box;
    max-width: 100%;
}

.game-icon-large { 
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    border-radius: 20px;
}

.game-details h1 {
    font-size: 1.6rem;
    margin-bottom: 12px;
    color: var(--text-color);
    font-weight: 700;
    line-height: 1.3;
}

.game-details p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
    color: #666;
    padding: 0 10px;
}

.play-btn { 
    width: 100%;
    max-width: 280px;
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 15px;
    background: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-btn:hover {
    background: #ff6a3c;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 123, 84, 0.3);
}

/* 游戏框架容器移动端样式：所有设备统一使用 iframe 嵌入，此处必须显示。
   根据容器内是 iframe 还是卡片自适应高度：
   - iframe 模式需要固定高度才能渲染游戏；
   - 卡片模式（renderMobileGameCard 把 iframe 替换成介绍卡片）若仍固定 75vh，
     会在卡片下方撑出大片空白，故改为按内容自适应。 */
.game-frame-container {
    display: block !important;
    width: 100%;
    margin-bottom: 24px;
    border-radius: 12px;
}

/* iframe 模式：需要固定高度才能渲染游戏 */
.game-frame-container:has(iframe) {
    height: 75vh;
    min-height: 420px;
    overflow: hidden;
}

/* 卡片模式：高度自适应内容 */
.game-frame-container:has(.mobile-game-card) {
    height: auto;
    min-height: auto;
    overflow: visible;
    background: transparent;
}

.game-frame-container .game-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* 移动端游戏介绍卡片：/embed/ 在手机上无法启动，改为展示卡片 + 用户主动点击的外链 */
.mobile-game-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

.mobile-game-notice {
    color: #4a6fa5;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.mobile-game-notice i {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.mobile-play-btn {
    display: inline-block;
    padding: 16px 36px;
    background: #4a6fa5;
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    min-height: 48px;
    line-height: 1.4;
}

.mobile-play-btn:active {
    background: #3d5a85;
}

.mobile-game-footnote {
    margin-top: 14px;
    font-size: 0.8rem;
    color: #718096;
    line-height: 1.5;
}

/* 游戏信息区域移动端样式：不再隐藏。
   About / How to Play 是游戏页仅有的正文；Google 用移动优先索引，
   移动端 display:none 会让移动版页面"没有内容"（SEO 反优化）。改为单列堆叠展示。 */
.game-info-section {
    display: block !important;
    width: 100%;
    margin: 20px 0;
    padding: 18px;
}

.info-grid {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 14px;
}

.info-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
}

.info-card h3 {
    font-size: 1rem;
    color: #4a6fa5;
    margin-bottom: 8px;
}

.info-card p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #4a5568;
}

/* 注入正文移动端字体适配 */
.game-content h2,
.faq-section h2 {
    font-size: 1.3rem;
}

.game-content h3,
.faq-section h3 {
    font-size: 1.05rem;
}

.game-content p,
.faq-section p,
.game-features li,
.related-games li {
    font-size: 0.95rem;
}

/* 广告容器移动端样式 */
.ad-section {
    margin: 20px 0;
    padding: 20px;
    min-height: 120px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

.ad-label {
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* 推荐游戏移动端样式 - 强制双排布局 */
.recommended-games-section {
    padding: 20px 15px;
    margin: 20px 15px 10px 15px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-light);
    width: calc(100% - 30px);
    box-sizing: border-box;
    max-width: 100%;
}

.section-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-weight: 700;
    text-align: center;
}

/* 强制双排布局，覆盖所有内联CSS */
.recommended-games-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 针对媒体查询的额外保护 */
@media (max-width: 768px) {
    .recommended-games-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }
}

.recommended-game-card {
    padding: 15px 10px;
    background: var(--light-bg);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 160px; /* 增加卡片高度，为游戏介绍留出空间 */
    height: auto;
    box-sizing: border-box;
    width: 100%;
    justify-content: flex-start; /* 改为flex-start确保内容都能显示 */
}

.recommended-game-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.recommended-game-icon {
    font-size: 1.8rem;
    width: 45px;
    height: 45px;
    margin-bottom: 8px;
    color: var(--primary-color);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 1px 4px var(--shadow-medium);
    flex-shrink: 0;
}

.recommended-game-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px; /* 游戏名字和按钮之间的间距 */
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    display: block;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 游戏介绍样式 - 在游戏名字和按钮之间 */
.recommended-game-description,
.recommended-game-desc {
    font-size: 0.7rem;
    color: #666;
    line-height: 1.3;
    margin-bottom: 10px;
    display: -webkit-box !important;
    display: block !important;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 32px;
}

/* 隐藏分类 */
.recommended-game-category {
    display: none !important;
}

/* 确保游戏介绍显示在所有情况下 */
.recommended-game-card .recommended-game-description,
.recommended-game-card .recommended-game-desc {
    display: -webkit-box !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
}

/* 页脚移动端样式 - 布局优化：
   1) 内容改左对齐：长段落居中不易读；
   2) 链接置顶并排成一行（flex-wrap:nowrap + 间距收窄），极窄屏横向滚动而非裁切；
   3) 左右间距大幅收窄（约为原来的 1/3），让内容铺满屏宽；
   4) 字号回调到可读区间（原 0.6rem ≈ 9.6px 过小）。 */
footer {
    padding: 12px 4px 14px;
    margin: 12px 3px 8px 3px;
    background: var(--white);
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -2px 10px var(--shadow-light);
    width: calc(100% - 6px);
    box-sizing: border-box;
    max-width: 100%;
    min-height: auto;
    text-align: left;
}

/* 版权行（年份）：移动端居中，其余内容保持左对齐 */
.footer-copyright {
    margin: 0 0 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2d3748;
    text-align: center;
}

/* 链接置顶并排成一行：间距收窄、不换行（极窄屏横向滚动而非裁切） */
.footer-links {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.footer-links a {
    font-size: 0.7rem;
    padding: 2px 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.footer-disclaimer {
    margin-top: 10px;
    font-size: 0.7rem;
    line-height: 1.5;
    color: #666;
    text-align: left;
}

/* 小屏幕设备进一步优化 */
@media (max-width: 480px) {
    .main-content {
        padding: 8px;
    }
    
    .game-header {
        padding: 15px 12px;
        margin-bottom: 12px;
        width: calc(100% - 30px);
        margin: 0 15px 12px 15px;
    }
    
    .game-icon-large {
        font-size: 3rem;
        width: 60px;
        height: 60px;
        margin-bottom: 12px;
    }
    
    .game-details h1 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .game-details p {
        font-size: 0.85rem;
        margin-bottom: 12px;
        padding: 0 3px;
    }
    
    .play-btn {
        max-width: 220px;
        padding: 10px 20px;
        font-size: 0.95rem;
        margin-top: 12px;
    }
    
    .recommended-games-section {
        padding: 15px 12px;
        margin: 15px 0 8px 0;
    }
    
    .section-title {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .recommended-games-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .recommended-game-card {
        padding: 10px 6px;
        min-height: 90px;
    }
    
    .recommended-game-icon {
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
        margin-bottom: 5px;
    }
    
    .recommended-game-title {
        font-size: 0.7rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        line-height: 1.1;
    }
    
    footer {
        padding: 12px 4px 14px;
        margin: 12px 3px 8px 3px;
        width: calc(100% - 6px);
    }
}

/* 超小屏幕设备优化（320px以下） */
@media (max-width: 320px) {
    .recommended-games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .recommended-game-card {
        padding: 8px 4px;
        min-height: 80px;
    }
    
    .recommended-game-icon {
        font-size: 1.3rem;
        width: 30px;
        height: 30px;
        margin-bottom: 4px;
    }
    
    .recommended-game-title {
        font-size: 0.65rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
}