/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 根变量定义 */
:root {
    --primary-color: #4A90E2;
    --accent-orange: #FF9500;
    --success-green: #4CD964;
    --error-red: #FF3B30;
    --bg-white: #FFFFFF;
    --bg-light: #F5F5F5;
    --text-secondary: #8E8E93;
    --text-primary: #3A3A3C;
    --border-color: #E5E5E5;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 100%;
    min-height: 100vh;
    background-color: var(--bg-light);
}

/* 顶部导航栏 */
.header {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.site-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 0;
    text-align: center;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 8px 10px;
    background-color: var(--bg-light);
    border-radius: 14px;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

.nav-link:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

/* 桌面设备响应式导航 */
@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .site-title {
        text-align: left;
    }
    
    .main-nav {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        grid-template-columns: none;
    }
    
    .nav-link {
        font-size: 13px;
        padding: 10px 14px;
        border-radius: 20px;
    }
}

/* 主内容区 */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* 分类导航 */
.categories-section {
    padding: 20px 0;
}

.categories-scroll {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 4px 0;
}

.category-chip {
    flex-shrink: 0;
    padding: 10px 12px;
    background-color: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
}

.category-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-chip.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-white);
}

/* 游戏区域 */
.games-section {
    padding: 24px 0;
}

.section-header {
    margin-bottom: 16px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* 游戏网格 */
.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 游戏卡片 */
.game-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.game-card:hover {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.game-card:active {
    transform: scale(0.96);
}

.game-thumbnail-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.game-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-hot-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--error-red);
    color: var(--bg-white);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.game-category-label {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--bg-white);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.game-info {
    padding: 12px;
}

.game-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 页脚 */
.footer {
    background-color: var(--bg-white);
    padding: 32px 16px;
    margin-top: 40px;
    text-align: center;
}

.copyright {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.footer-link {
    font-size: 14px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover {
    text-decoration: underline;
}

/* 性能优化 */
img {
    will-change: transform;
}

.btn-play {
    flex: 1;
    min-width: 140px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-color), #357ABD);
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-white);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
    display: inline-block;
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.4);
}

.btn-play:active {
    transform: translateY(0);
}

.btn-source {
    padding: 16px 24px;
    background-color: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-block;
    text-align: center;
}

.btn-source:hover {
    background-color: var(--border-color);
}

/* 平板设备响应式 */
@media (min-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* 桌面设备响应式 */
@media (min-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .header-content {
        padding: 20px 16px;
    }
    
    .main {
        padding: 0 24px;
    }
}

@media (min-width: 1280px) {
    .games-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* 返回链接 */
.back-link {
    text-decoration: none;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-right: 12px;
}

.back-link:hover {
    color: #357ABD;
}

/* 网站标题 */
.site-title {
    display: flex;
    align-items: center;
}

/* 游戏详情页面 */
.game-detail {
    padding: 24px 0;
}

.back-to-previous-btn {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    background-color: var(--bg-light);
    border-radius: 20px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.back-to-previous-btn:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.game-detail-loading {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: var(--text-secondary);
}

.game-detail-header {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.game-detail-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.game-detail-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.game-detail-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.game-detail-meta-item {
    display: flex;
    flex-direction: column;
}

.game-detail-meta-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.game-detail-meta-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.game-detail-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.rating-stars {
    font-size: 18px;
}

.rating-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.game-detail-desc {
    font-size: 16px;
    color: var(--text-primary);
    line-height: 1.8;
}

.game-detail-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

/* 游戏详情区块 */
.game-detail-section {
    background-color: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.game-detail-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 游戏玩法说明 */
.game-detail-howto {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.howto-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: var(--bg-light);
    border-radius: var(--radius-sm);
}

.howto-icon {
    font-size: 20px;
}

.howto-text {
    font-size: 14px;
    color: var(--text-primary);
}

/* 相关游戏网格 */
.related-games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.related-game-card {
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.related-game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.related-game-thumbnail {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
}

.related-game-info {
    padding: 12px;
}

.related-game-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-game-category {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 相关游戏响应式 */
@media (min-width: 768px) {
    .related-games-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 榜单页面样式 */
.rank-tabs-section {
    padding: 20px 0;
}

.rank-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 4px 0;
}

.rank-tab {
    flex-shrink: 0;
    padding: 10px 8px;
    background-color: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

.rank-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.rank-tab.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-white);
}

/* 榜单标签响应式 */
@media (min-width: 768px) {
    .rank-tabs {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        grid-template-columns: none;
    }
    
    .rank-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .rank-tab {
        padding: 12px 24px;
        border-radius: 24px;
        font-size: 14px;
    }
}

.rank-games-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.rank-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.rank-badge {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    flex-shrink: 0;
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
}

.rank-badge.rank-2 {
    background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
    color: white;
}

.rank-badge.rank-3 {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    color: white;
}

.rank-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.rank-info {
    flex: 1;
    min-width: 0;
}

.rank-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rank-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.rank-meta {
    display: flex;
    gap: 12px;
}

.rank-category {
    font-size: 11px;
    color: var(--primary-color);
    font-weight: 600;
}

.rank-plays {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 榜单响应式 */
@media (min-width: 768px) {
    .rank-thumbnail {
        width: 100px;
        height: 75px;
    }
    
    .rank-item {
        padding: 16px;
        gap: 16px;
    }
    
    .rank-title {
        font-size: 16px;
    }
    
    .rank-desc {
        font-size: 13px;
    }
}

/* 内容页面通用样式 */
.content-page {
    padding: 24px 0;
}

.content-card {
    background-color: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.content-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.content-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.content-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.content-list {
    padding-left: 20px;
    margin-bottom: 16px;
}

.content-list li {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 8px;
}

/* FAQ 样式 */
.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-answer {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    padding-top: 8px;
}

.faq-toggle {
    font-size: 20px;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

/* 搜索页面样式 */
.search-page-section {
    padding: 20px 0;
}

.search-page-box {
    display: flex;
    align-items: center;
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.search-page-icon {
    font-size: 20px;
    color: var(--text-secondary);
}

.search-page-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
}

.search-page-input::placeholder {
    color: var(--text-secondary);
}

/* 分类选择区块样式 */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
}

.category-game-count {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 分类标签增强样式 */
.category-chip-icon {
    font-size: 24px;
    line-height: 1;
}

.category-chip-name {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

/* 平板设备分类响应式 */
@media (min-width: 768px) {
    .categories-scroll {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .category-chip-icon {
        font-size: 28px;
    }
    
    .category-chip-name {
        font-size: 12px;
    }
    
    .category-chip {
        padding: 14px 12px;
    }
}

/* 桌面设备分类响应式 */
@media (min-width: 1024px) {
    .categories-scroll {
        display: flex;
        overflow-x: auto;
        grid-template-columns: none;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .categories-scroll::-webkit-scrollbar {
        display: none;
    }
    
    .category-chip {
        flex-direction: row;
        padding: 10px 20px;
        border-radius: 24px;
        gap: 8px;
        flex-shrink: 0;
    }
    
    .category-chip-icon {
        font-size: 16px;
    }
    
    .category-chip-name {
        font-size: 14px;
    }
}

.btn-play-large {
    flex: 1;
    min-width: 160px;
    padding: 18px 32px;
    font-size: 18px;
}

.btn-source-large {
    padding: 18px 32px;
    font-size: 16px;
}

.game-detail-iframe-container {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 32px;
    background-color: var(--bg-white);
    box-shadow: var(--shadow-md);
}

.game-detail-iframe {
    width: 100%;
    height: 100%;
}

.game-detail-tips {
    background-color: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.game-detail-tips-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.game-detail-tips-list {
    padding-left: 20px;
    color: var(--text-secondary);
}

.game-detail-tips-list li {
    margin-bottom: 8px;
    font-size: 14px;
}

/* 游戏详情页面响应式 */
@media (min-width: 768px) {
    .game-detail-header {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .game-detail-thumbnail {
        width: 400px;
        flex-shrink: 0;
    }
}

/* 游戏播放页面 */
.play-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.play-game-container {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.play-loading {
    color: var(--text-secondary);
    font-size: 18px;
}

.play-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* 悬浮返回按钮 */
.back-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-color), #357ABD);
    color: var(--bg-white);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(74, 144, 226, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-float-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(74, 144, 226, 0.5);
}

.back-float-btn:active {
    transform: translateY(0);
}

/* 播放页面响应式 */
@media (max-width: 768px) {
    .back-float-btn {
        bottom: 16px;
        right: 16px;
        padding: 12px 20px;
        font-size: 14px;
    }
}
