/* ==============================================
   重置样式和基础设置
============================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 颜色变量 */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    /* 背景颜色 */
    --bg-color: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: #1e293b;
    --header-bg: rgba(30, 41, 59, 0.95);
    
    /* 文字颜色 */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    /* 边框和阴影 */
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* 尺寸变量 */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* 动画 */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    
    /* 响应式断点 */
    --mobile: 768px;
    --tablet: 1024px;
    --desktop: 1200px;
    
    /* 额外的颜色变量 */
    --bg-primary: var(--bg-color);
    --bg-secondary: var(--card-bg);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 亮色主题 */
body.light-theme {
    /* 背景颜色 */
    --bg-color: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.95);
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    
    /* 文字颜色 */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* 边框和阴影 */
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 全局样式 */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: var(--desktop);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ==============================================
   布局容器
============================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.main-container {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed + .main-container {
    margin-left: var(--sidebar-collapsed-width);
}

/* ==============================================
   左侧导航栏
============================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.sidebar.collapsed .sidebar-header {
    padding: 1.5rem 0.75rem;
    justify-content: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.25rem;
    white-space: nowrap;
}

.logo i {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.logo-text {
    transition: var(--transition);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    transform: translateX(-10px);
}

.sidebar.collapsed .logo {
    display: none;
}

.sidebar-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 6px;
}

.sidebar-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.sidebar-content {
    padding: 1rem 0;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-menu {
    list-style: none;
    padding: 0 1rem;
}

.sidebar.collapsed .nav-menu {
    padding: 0 0.5rem;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
}

.nav-link i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-link span {
    transition: var(--transition);
}

.sidebar.collapsed .nav-link span {
    opacity: 0;
    transform: translateX(-10px);
}

.sidebar.collapsed .nav-link {
    padding: 0.75rem;
    justify-content: center;
    min-width: 48px;
}

.sidebar.collapsed .nav-link i {
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
}

/* 收缩状态下的工具提示样式已经包含在上面的规则中 */

.sidebar.collapsed .nav-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1001;
    margin-left: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.nav-separator {
    margin: 1.5rem 0 0.5rem;
    padding: 0 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.sidebar.collapsed .nav-separator {
    opacity: 0;
}

/* ==============================================
   顶部搜索栏
============================================== */
.top-header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-content {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 100%;
    gap: 1rem;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.theme-toggle,
.fullscreen-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover,
.fullscreen-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ==============================================
   主要内容区域
============================================== */
.main-content {
    flex: 1;
    padding: 0;
}

.page-title {
    padding: 2rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.page-title h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.page-title p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.125rem;
}

/* ==============================================
   游戏展示区域
============================================== */
.games-showcase {
    padding: 2rem 0 4rem;
}

.games-section {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0 1.5rem;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-header h2 i {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.view-options {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.view-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.view-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ==============================================
   游戏图标网格
============================================== */
.games-icons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem;
    padding: 0 1.5rem;
}

.game-icon-card {
    background: transparent;
    border-radius: var(--border-radius-lg);
    padding: 0;
    transition: var(--transition);
    position: relative;
    border: none;
}

.game-icon-card:hover {
    transform: translateY(-4px);
}

.game-icon-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.game-icon-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 0;
}

.game-icon-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.game-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.game-icon-card:hover .game-play-overlay {
    opacity: 1;
}

.game-icon-info {
    display: none;
}

.game-icon-title {
    display: none;
}

.game-icon-meta {
    display: none;
}

.game-category {
    display: none;
}

.game-devices {
    display: none;
}

.game-devices i {
    display: none;
}

.favorite-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(4px);
    opacity: 0;
}

.game-icon-card:hover .favorite-btn {
    opacity: 1;
}

.favorite-btn:hover {
    background: var(--error-color);
    transform: scale(1.1);
}

.favorite-btn.favorited {
    background: var(--error-color);
    opacity: 1;
}

.favorite-btn i {
    width: 16px;
    height: 16px;
}

/* ==============================================
   加载动画
============================================== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==============================================
   移动端遮罩
============================================== */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ==============================================
   页脚
============================================== */
.footer {
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 2rem 1.5rem;
    gap: 3rem;
}

/* 品牌区域 */
.footer-brand {
    flex: 2;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.footer-logo i {
    width: 24px;
    height: 24px;
}

.footer-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 导航区域 */
.footer-nav {
    flex: 3;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.footer-nav-group h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 游戏分类区域的特殊样式 - 2列布局，无图标 */
.footer-nav-group:first-child {
    max-width: 200px;
}

.footer-nav-group:first-child .footer-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.5rem;
    align-items: start;
}

.footer-nav-group:first-child .footer-links a {
    gap: 0;
    justify-content: flex-start;
}

.footer-nav-group:first-child .footer-links a i {
    display: none;
}

.footer-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

.footer-links a:hover {
    color: var(--primary-color);
    transform: translateX(4px);
}

.footer-links a i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* 底部版权区域 */
.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.footer-social span {
    color: var(--text-secondary);
}

/* ==============================================
   响应式设计
============================================== */

/* 平板设备 */
@media (max-width: 1024px) {
    .games-icons-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }
}

/* 移动设备 */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 60px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-container {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .page-title h1 {
        font-size: 1.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .page-title {
        padding: 1.5rem 0;
    }
    
    .games-icons-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        padding: 0 1rem;
    }
    
        .game-icon-card {
        padding: 0;
    }
    
    .section-header {
        padding: 0 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    

    
    .header-content {
        padding: 0 1rem;
    }
    
    .search-container {
        max-width: none;
    }
    
    .footer-content {
        flex-direction: column;
        padding: 1.5rem 1rem;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-brand {
        max-width: none;
    }
    
    .footer-logo {
        justify-content: center;
        font-size: 1.1rem;
    }
    
    .footer-desc {
        font-size: 0.85rem;
    }
    
    .footer-nav {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .footer-nav-group h4 {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    .footer-links {
        align-items: center;
        gap: 0.4rem;
    }
    
    .footer-links a {
        font-size: 0.85rem;
        justify-content: center;
    }
    
    /* 移动端游戏分类保持2列布局 */
    .footer-nav-group:first-child {
        max-width: 180px;
        margin: 0 auto;
    }
    
    .footer-nav-group:first-child .footer-links {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem 0.4rem;
        justify-items: center;
    }
    
    .footer-nav-group:first-child .footer-links a {
        justify-content: center;
        text-align: center;
    }
    
    .footer-links a:hover {
        transform: translateY(-2px);
    }
    
    .footer-bottom {
        padding: 1rem;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        font-size: 0.8rem;
    }
    
    .footer-social {
        gap: 0.75rem;
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    .games-icons-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.75rem;
    }
    
    .page-title h1 {
        font-size: 1.5rem;
    }
    
    .game-icon-card {
        padding: 0;
    }
    

    
    .section-header h2 {
        font-size: 1.25rem;
    }
}

/* ==============================================
   Pagefind 搜索结果样式
============================================== */
.pagefind-ui {
    --pagefind-ui-primary: var(--primary-color);
    --pagefind-ui-text: var(--text-primary);
    --pagefind-ui-background: var(--bg-color);
    --pagefind-ui-border: var(--border-color);
    --pagefind-ui-tag: var(--card-bg);
    position: relative !important;
}

.pagefind-ui__form {
    position: relative !important;
}

.pagefind-ui__search-input {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 0.75rem 1rem !important;
    font-size: 1rem !important;
    position: relative !important;
    z-index: 1000 !important;
}

.pagefind-ui__search-input:focus {
    border-color: var(--primary-color) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2) !important;
}

.pagefind-ui__results-area {
    background: var(--bg-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius) !important;
    margin-top: 0.5rem !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 999 !important;
    box-shadow: var(--shadow-xl) !important;
    padding: 0.75rem !important;
}

.pagefind-ui__results {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

.pagefind-ui__result {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 1rem !important;
    margin: 0 0 0.75rem 0 !important;
    transition: var(--transition) !important;
}

.pagefind-ui__result:hover {
    background: rgba(99, 102, 241, 0.08) !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-1px) !important;
}

.pagefind-ui__result:last-child {
    margin-bottom: 0 !important;
}

.pagefind-ui__result-link {
    color: var(--text-primary) !important;
    text-decoration: none !important;
    display: block !important;
}

.pagefind-ui__result-title {
    color: var(--primary-color) !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    margin: 0 0 0.75rem 0 !important;
    line-height: 1.3 !important;
    display: block !important;
}

.pagefind-ui__result-excerpt {
    color: var(--text-secondary) !important;
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
    margin: 0 0 0.75rem 0 !important;
    display: block !important;
}

.pagefind-ui__result-tags {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    margin: 0 !important;
}

.pagefind-ui__result-tag {
    background: var(--primary-color) !important;
    color: white !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 50px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    display: inline-block !important;
    line-height: 1.2 !important;
}

.pagefind-ui__message {
    color: var(--text-secondary) !important;
    text-align: center !important;
    padding: 2rem 1rem !important;
    font-size: 0.9rem !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm) !important;
    margin: 0 !important;
}

.pagefind-ui__result-count {
    color: var(--text-secondary) !important;
    font-size: 0.875rem !important;
    margin-bottom: 1rem !important;
    padding: 0.5rem 0 !important;
    border-bottom: 1px solid var(--border-color) !important;
    display: block !important;
}

.pagefind-ui__loading {
    color: var(--text-secondary) !important;
    text-align: center !important;
    padding: 1.5rem !important;
    font-size: 0.9rem !important;
}

/* 隐藏搜索结果中的图片，保持简洁 */
.pagefind-ui__result-image {
    display: none !important;
}

/* 自定义滚动条样式 */
.pagefind-ui__results-area::-webkit-scrollbar {
    width: 6px;
}

.pagefind-ui__results-area::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 3px;
}

.pagefind-ui__results-area::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.pagefind-ui__results-area::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 确保搜索结果不被其他元素遮挡 */
.pagefind-ui__results-area {
    width: 100% !important;
}

/* 当搜索结果显示时，调整主内容的层级 */
.main-content {
    position: relative;
    z-index: 1;
}

/* 响应式搜索样式 */
@media (max-width: 768px) {
    .pagefind-ui__search-input {
        font-size: 16px !important; /* 防止iOS缩放 */
    }
    
    .pagefind-ui__results-area {
        max-height: 50vh !important;
        left: -1rem !important;
        right: -1rem !important;
        margin-left: 1rem !important;
        margin-right: 1rem !important;
    }
    
    .search-container {
        max-width: none;
    }
}

/* 游戏页面样式 */
.game-header {
    background: var(--bg-gradient);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.game-header-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .game-header-content {
        grid-template-columns: 1fr;
    }
}

.game-thumbnail {
    position: relative;
    width: 100%;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: var(--bg-secondary);
}

.game-thumbnail::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 宽高比 */
}

.game-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.game-thumbnail img:hover {
    transform: scale(1.05);
}

.game-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.game-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.game-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.game-tag {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background-color 0.2s;
}

.game-tag:hover {
    background: var(--primary-color-dark);
}

.game-devices {
    display: flex;
    gap: 0.5rem;
}

.device-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
}

.game-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.game-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.game-actions button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s;
}

.game-actions .icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* 游戏容器包装器 */
.game-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (max-width: 768px) {
    .game-wrapper {
        padding: 0;
    }
}

/* 游戏容器样式 */
.game-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 宽高比 */
    margin-bottom: 2rem;
    background: var(--bg-secondary);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: var(--bg-secondary);
}

/* 强制覆盖 iframe 中的 canvas 样式 */
.game-iframe canvas,
.game-iframe >>> canvas,
.game-iframe /deep/ canvas,
.game-iframe::part(canvas),
canvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: var(--canvas-width, 100%) !important;
    height: var(--canvas-height, 100%) !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    max-width: 100% !important;
    max-height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
    border: none !important;
    outline: none !important;
    box-sizing: border-box !important;
}

/* 确保 iframe 内的所有元素都不会影响 canvas 的布局 */
.game-iframe * {
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.game-iframe html,
.game-iframe body {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
}

.game-iframe.loaded {
    opacity: 1;
}

.game-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    z-index: 1;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-primary);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 游戏详情和侧边栏 */
.game-details {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 992px) {
    .game-details {
        grid-template-columns: 1fr;
    }
}

.content-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.section-text {
    color: var(--text-secondary);
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-icon {
    color: var(--primary-color);
}

.info-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.card-icon {
    color: var(--primary-color);
}

.instructions-list {
    color: var(--text-secondary);
    line-height: 1.6;
}

.game-stats .stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.game-stats .stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    color: var(--text-primary);
    font-weight: 500;
}

.status-free {
    color: var(--success-color);
}

/* 相关游戏推荐 */
.related-games {
    margin-bottom: 3rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.related-card {
    background: var(--bg-secondary);
    border-radius: 1rem;
    overflow: hidden;
    transition: transform 0.2s;
    text-decoration: none;
    color: inherit;
}

.related-card:hover {
    transform: translateY(-4px);
}

.card-image {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 宽高比 */
    background: var(--bg-secondary);
    overflow: hidden;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-card:hover .card-image img {
    transform: scale(1.05);
}

.card-content {
    padding: 1.5rem;
}

.card-content .card-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.play-now {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

/* iframe 内部 canvas 样式 */
.game-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: var(--bg-secondary);
}

/* 注入到 iframe 中的样式 */
.game-frame-style {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.game-frame-style canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 图片加载状态 */
.game-thumbnail img,
.card-image img {
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 图片加载失败状态 */
.game-thumbnail img[src$="default-game.png"],
.card-image img[src$="default-game.png"] {
    object-fit: contain;
    padding: 1rem;
    background: var(--bg-secondary);
}