
/* 字体导入 - 通过JavaScript动态加载 */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #e5e7eb;
    background-color: #0f0f0f;
}

.container {
    padding: 0 20px;
}

.nav-container {
    padding: 0 20px;
}

/* 顶部导航栏 */
.top-nav {
    background: #1a1a1a;
    border-bottom: 1px solid #333333;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-nav .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    padding: 0 20px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.nav-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

/* 搜索框样式 */
.nav-search {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.search-box {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 12px 50px 12px 16px;
    font-size: 14px;
    border: 2px solid #4f46e5;
    border-radius: 25px;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: #ffffff;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
    font-family: 'Inter', sans-serif;
}

.search-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2), 0 8px 20px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.search-input:focus + .search-btn {
    transform: translateY(-50%) translateY(-1px);
}

.search-input::placeholder {
    color: #a5b4fc;
    font-weight: 400;
}

.search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border: none;
    border-radius: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.search-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.search-input:focus + .search-btn:hover {
    transform: translateY(-50%) translateY(-1px) scale(1.1);
}

.search-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.search-input:focus + .search-btn:active {
    transform: translateY(-50%) translateY(-1px) scale(0.95);
}

.search-icon {
    font-size: 16px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.search-icon svg {
    width: 18px;
    height: 18px;
}

/* 搜索高亮样式 */
.search-highlight {
    background-color: #fbbf24;
    color: #1f2937;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* 搜索页面样式 */
.search-container {
    max-width: 600px;
    margin: 0 auto 40px auto;
    position: relative;
}

.search-page-input {
    width: 100%;
    padding: 18px 60px 18px 24px;
    font-size: 18px;
    border: 2px solid #4f46e5;
    border-radius: 25px;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: #ffffff;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.2);
    font-family: 'Inter', sans-serif;
}

.search-page-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2), 0 12px 24px rgba(79, 70, 229, 0.3);
    transform: translateY(-2px);
}

.search-page-input::placeholder {
    color: #a5b4fc;
    font-weight: 400;
}

.search-page-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #a5b4fc;
    font-size: 22px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.search-page-icon:hover {
    color: #8b5cf6;
    transform: translateY(-50%) scale(1.1);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border: 2px solid #4f46e5;
    border-radius: 16px;
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.3);
    backdrop-filter: blur(10px);
}

.suggestion-item {
    padding: 14px 18px;
    cursor: pointer;
    border-bottom: 1px solid rgba(79, 70, 229, 0.2);
    color: #e5e7eb;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    position: relative;
}

.suggestion-item:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.2));
    color: #ffffff;
    transform: translateX(4px);
    border-left: 3px solid #8b5cf6;
}

.suggestion-item:last-child {
    border-bottom: none;
    border-radius: 0 0 14px 14px;
}

.suggestion-item:first-child {
    border-radius: 14px 14px 0 0;
}

.nav-menu {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
}

.nav-link {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: #e5e7eb;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    color: #ffffff;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-menu {
    position: relative;
    cursor: pointer;
}

.user-text {
    color: #e5e7eb;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.user-text:hover {
    background: #333333;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #2a2a2a;
    border: 1px solid #333333;
    border-radius: 8px;
    padding: 8px 0;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1001;
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 8px 16px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #333333;
    color: #ffffff;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px;
}

.hamburger span {
    width: 20px;
    height: 2px;
    background: #e5e7eb;
    transition: 0.3s;
}

/* 面包屑导航 */
.breadcrumb-nav {
    background: #1a1a1a;
    border-bottom: 1px solid #333333;
    padding: 12px 0;
}

.breadcrumb-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.breadcrumb-menu::-webkit-scrollbar {
    display: none;
}

.breadcrumb-item {
    flex-shrink: 0;
}

.breadcrumb-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: #ffffff;
    font-family: 'Fredoka One', cursive;
    font-weight: 400;
    font-size: 14px;
    white-space: nowrap;
    border-radius: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
    letter-spacing: 0.3px;
}

.breadcrumb-link:hover {
    color: #ffffff;
    background: #333333;
}

.breadcrumb-link.active {
    color: #3b82f6;
    background: #333333;
    border-color: #4b5563;
}

.breadcrumb-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}

/* 分类页面样式 */
.category-header {
    margin-bottom: 40px;
    padding: 40px 0;
}

.category-header h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    font-weight: 400;
    color: #ffffff;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.category-header p {
    font-size: 1.1rem;
    color: #9ca3af;
}

#category-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.category-menu {
    display: flex;
    list-style: none;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-menu::-webkit-scrollbar {
    display: none;
}

.category-link {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: #ffffff;
    font-family: 'Fredoka One', cursive;
    font-weight: 400;
    white-space: nowrap;
    border-radius: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
    letter-spacing: 0.3px;
}

.category-link:hover {
    color: #ffffff;
    background: #333333;
}

.category-link.active {
    color: #3b82f6;
    background: #333333;
    border-color: #4b5563;
}

/* 主内容区域 */
.main-content {
    padding: 24px 0;
    background: #0f0f0f;
    contain: layout style; /* 防止布局偏移 */
    will-change: auto; /* 优化渲染性能 */
}

.game-section {
    margin-bottom: 48px;
    min-height: 300px; /* 防止布局偏移 */
    contain: layout style; /* 优化渲染性能 */
}

.section-header {
    display: flex;
    justify-content: flex-start;
    align-items: center; /* 回到center对齐 */
    margin-bottom: 24px;
    gap: 16px;
    height: 40px; /* 固定高度防止布局偏移 */
    min-height: 40px; /* 确保最小高度 */
}

.section-header h2 {
    font-family: var(--font-loaded, 'Arial', sans-serif), 'Fredoka One', cursive;
    font-size: 24px;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: 0.5px;
    margin: 0; /* 移除默认margin */
    line-height: 1; /* 标准行高 */
    transition: font-family 0.3s ease; /* 字体切换动画 */
    height: 32px; /* 固定高度防止布局偏移 */
    min-height: 32px; /* 确保最小高度 */
    display: flex; /* 使用flex确保垂直居中 */
    align-items: center; /* 垂直居中对齐 */
    flex-shrink: 0; /* 防止收缩 */
}

.view-more {
    color: #3b82f6;
    text-decoration: none;
    font-family: var(--font-loaded, 'Arial', sans-serif), 'Fredoka One', cursive; /* 使用与标题相同的字体 */
    font-weight: 400; /* 与标题保持一致的字体粗细 */
    font-size: 14px;
    height: 24px; /* 固定高度防止布局偏移 */
    min-height: 24px; /* 确保最小高度 */
    contain: layout; /* 优化渲染性能 */
    display: inline-flex; /* 使用flex确保垂直居中 */
    align-items: center; /* 垂直居中对齐 */
    line-height: 1; /* 标准行高 */
    transition: font-family 0.3s ease; /* 字体切换动画 */
    flex-shrink: 0; /* 防止收缩 */
}

.view-more:hover {
    text-decoration: underline;
}

/* 游戏网格 */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    justify-items: center;
    min-height: 250px; /* 增加最小高度防止布局偏移 */
    contain: layout style; /* 优化渲染性能 */
    will-change: auto; /* 优化渲染性能 */
}

/* 游戏卡片 */
.game-card {
    background: linear-gradient(145deg, #1a1a1a, #1f1f1f);
    border: 1px solid #333333;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    min-height: 80px; /* 恢复原来的最小高度 */
    max-width: 200px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    /* 确保背景渐变也遵循圆角 */
    background-clip: padding-box;
    /* 性能优化 */
    contain: layout style paint;
    will-change: transform;
}

/* 游戏卡片内部光泽效果 */
.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.game-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
}

.game-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-6px) scale(1.03);
    border-radius: 20px;
}

/* 悬停时显示光泽效果 */
.game-card:hover::before {
    opacity: 1;
}

/* 悬停时图片放大效果 */
.game-card:hover .game-image {
    transform: scale(1.15);
    opacity: 1;
    filter: brightness(1.1) contrast(1.05);
    border-radius: 20px 20px 0 0;
}

/* 悬停时显示标题覆盖层 */
.game-card:hover .game-title-overlay {
    opacity: 1;
    transform: translateY(0); /* 不移位，只淡入 */
    backdrop-filter: blur(8px);
}

/* 悬停时隐藏底部标题 */
.game-card:hover .game-title {
    opacity: 0;
    transform: translateY(0); /* 不移位，只淡出 */
    border-radius: 0 0 20px 20px;
}

/* 悬停时游戏缩略图容器效果 */
.game-card:hover .game-thumbnail {
    border-radius: 20px 20px 0 0;
}

/* 悬停时fallback图片圆角 */
.game-card:hover .game-image-fallback {
    border-radius: 20px 20px 0 0;
}

.game-card:active {
    transform: translateY(0);
}

.game-thumbnail {
    position: relative;
    flex: 1;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    transition: border-radius 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.game-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    font-size: 24px;
    opacity: 0.8;
    border-radius: 16px 16px 0 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity, filter;
}

.game-image-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    opacity: 0.8;
    background: #2a2a2a;
    border-radius: 16px 16px 0 0;
}

.game-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 4px 8px;
    border-radius: 12px;
    font-family: 'Fredoka One', cursive;
    font-size: 9px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
    backdrop-filter: blur(4px);
}

.game-badge.new {
    background: #10b981;
    color: white;
}

.game-badge.trending {
    background: #f59e0b;
    color: white;
}

.game-badge.updated {
    background: #3b82f6;
    color: white;
}

.game-badge.hot {
    background: #ef4444;
    color: white;
}

.game-badge.popular {
    background: #8b5cf6;
    color: white;
}

.game-badge.top {
    background: #f59e0b;
    color: white;
}

/* 悬停时徽章动画效果 */
.game-card:hover .game-badge {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.game-card:hover .game-badge.new {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.game-card:hover .game-badge.trending {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.game-card:hover .game-badge.updated {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.game-card:hover .game-badge.hot {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.game-card:hover .game-badge.popular {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.game-card:hover .game-badge.top {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.game-title {
    padding: 8px 6px;
    font-family: 'Fredoka One', cursive;
    font-size: 11px;
    font-weight: 400;
    color: #ffffff;
    line-height: 1.2;
    text-align: center;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity;
    letter-spacing: 0.3px;
    /* 确保标题区域也遵循卡片的圆角 */
    border-radius: 0 0 16px 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

/* 悬停时显示的游戏标题覆盖层 */
.game-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    color: #ffffff;
    padding: 12px 8px 8px;
    font-family: 'Fredoka One', cursive;
    font-size: 12px;
    font-weight: 400;
    text-align: center;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 0 0 16px 16px;
    backdrop-filter: blur(8px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    will-change: transform, opacity;
    letter-spacing: 0.3px;
}

/* 页脚 */
.footer {
    background: #1a1a1a;
    border-top: 1px solid #333333;
    padding: 48px 0 24px;
    margin-top: 48px;
    min-height: 200px; /* 防止布局偏移 */
    /* 防止布局偏移的额外样式 */
    contain: layout style;
    will-change: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

.footer-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 16px;
}

.footer-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 12px;
}

.footer-section p {
    color: #9ca3af;
    line-height: 1.6;
    font-size: 14px;
}

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

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

.footer-section ul li a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-section ul li a:hover {
    color: #3b82f6;
}

.footer-bottom {
    border-top: 1px solid #333333;
    padding-top: 24px;
    text-align: center;
}

.footer-bottom p {
    color: #6b7280;
    font-size: 14px;
}

/* 移动端菜单样式 */
.nav-menu.mobile-open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border-bottom: 1px solid #333333;
    flex-direction: column;
    padding: 16px 20px;
    z-index: 999;
}

.nav-menu.mobile-open .nav-links {
    flex-direction: column;
    width: 100%;
}

.nav-menu.mobile-open .nav-link {
    padding: 12px 0;
    border-bottom: 1px solid #333333;
}

.nav-menu.mobile-open .nav-link:last-child {
    border-bottom: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .user-menu {
        display: none;
    }
    
    .hamburger {
        display: flex;
    }

    .nav-btn {
        display: none;
    }

    .category-menu {
        padding: 0 20px;
    }

    /* 移动端搜索框样式 */
    .nav-search {
        max-width: 200px;
        margin: 0 10px;
    }

    .search-input {
        font-size: 12px;
        padding: 6px 35px 6px 10px;
    }

    .search-btn {
        width: 28px;
        height: 28px;
    }

    .search-icon {
        font-size: 12px;
    }

    .search-icon svg {
        width: 12px;
        height: 12px;
    }

    /* 搜索页面移动端样式 */
    .search-container {
        margin: 0 20px 40px 20px;
    }

    .search-page-input {
        font-size: 16px;
        padding: 16px 50px 16px 20px;
        border-radius: 20px;
    }

    .search-page-icon {
        right: 16px;
        font-size: 20px;
        width: 22px;
        height: 22px;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }

    .game-image {
        font-size: 36px;
    }

    .game-title {
        padding: 8px 12px;
        font-size: 13px;
        letter-spacing: 0.4px;
        border-radius: 0 0 18px 18px;
    }
    
    /* 移动端悬停效果优化 */
    .game-card:hover {
        transform: translateY(-3px) scale(1.02);
        border-radius: 18px;
    }
    
    .game-card:hover .game-image {
        transform: scale(1.08);
        border-radius: 18px 18px 0 0;
    }
    
    .game-card:hover .game-image-fallback {
        border-radius: 18px 18px 0 0;
    }
    
    .game-card:hover .game-badge {
        transform: translateY(-1px) scale(1.05);
    }
    
    .game-title-overlay {
        font-size: 11px;
        padding: 8px 6px 6px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .section-header h2 {
        font-family: 'Fredoka One', cursive;
        font-size: 20px;
        font-weight: 400;
        letter-spacing: 0.4px;
    }
}

@media (max-width: 480px) {
    .container,
    .nav-container {
        padding: 0 16px;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }

    .game-image {
        font-size: 32px;
    }

    .game-title {
        padding: 6px 8px;
        font-size: 12px;
        letter-spacing: 0.4px;
        border-radius: 0 0 16px 16px;
    }
    
    /* 小屏幕悬停效果优化 */
    .game-card:hover {
        transform: translateY(-2px) scale(1.01);
        border-radius: 16px;
    }
    
    .game-card:hover .game-image {
        transform: scale(1.05);
        border-radius: 16px 16px 0 0;
    }
    
    .game-card:hover .game-image-fallback {
        border-radius: 16px 16px 0 0;
    }
    
    .game-card:hover .game-badge {
        transform: translateY(-1px) scale(1.03);
    }
    
    .game-title-overlay {
        font-size: 10px;
        padding: 6px 4px 4px;
    }
}

/* 超小屏幕 */
@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 4px;
    }

    .game-card {
        min-height: 70px;
    }

    .game-title {
        padding: 4px 6px;
        font-size: 11px;
        letter-spacing: 0.4px;
        border-radius: 0 0 14px 14px;
    }

    .game-image {
        font-size: 28px;
    }
    
    /* 超小屏幕悬停效果优化 */
    .game-card:hover {
        transform: translateY(-1px) scale(1.005);
        border-radius: 14px;
    }
    
    .game-card:hover .game-image {
        transform: scale(1.03);
        border-radius: 14px 14px 0 0;
    }
    
    .game-card:hover .game-image-fallback {
        border-radius: 14px 14px 0 0;
    }
    
    .game-card:hover .game-badge {
        transform: translateY(-1px) scale(1.02);
    }
    
    .game-title-overlay {
        font-size: 9px;
        padding: 4px 3px 3px;
    }
    
    /* 小屏幕面包屑图标优化 */
    .breadcrumb-icon {
        width: 20px;
        height: 20px;
    }
    
    .breadcrumb-link {
        gap: 6px;
        padding: 6px 10px;
        font-size: 13px;
    }

    .footer {
        padding: 32px 0 16px;
    }
}

/* 滚动行为 */
html {
    scroll-behavior: smooth;
}

/* 防止布局偏移的全局样式 */
* {
    box-sizing: border-box;
}

/* 为动态内容添加占位符防止布局偏移 */
[id$="-container"] {
    min-height: 1px; /* 确保容器有最小高度 */
}

/* 防止字体加载导致的布局偏移 */
/* 注意：Inter字体通过Google Fonts加载，font-display: swap在link标签中设置 */

/* 焦点样式 */
.game-card:focus,
.category-link:focus,
.nav-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 移除重复的 .game-card 定义，避免覆盖之前的样式 */

/* 移动端优化 */
@media (max-width: 768px) {
    .category-menu {
        gap: 4px;
    }
    
    .category-link {
        padding: 6px 12px;
        font-size: 14px;
        letter-spacing: 0.4px;
    }
    
    /* 移动端面包屑图标优化 */
    .breadcrumb-icon {
        width: 22px;
        height: 22px;
    }
    
    .breadcrumb-link {
        gap: 8px;
        padding: 8px 12px;
    }
    
    /* 移动端模态框优化 */
    .game-modal .modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .game-modal .modal-header {
        padding: 12px 16px;
    }
    
    .game-modal .modal-header h3 {
        font-size: 16px;
    }
    
    .game-modal .modal-controls {
        gap: 4px;
    }
    
    .game-modal .modal-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .game-modal .modal-btn span {
        display: none;
    }
    
    .game-modal .close-btn {
        padding: 6px 8px;
        font-size: 14px;
    }
    
    /* 移动端全屏模式 */
    .game-modal.fullscreen .modal-header {
        padding: 8px 12px;
    }
    
    .game-modal.fullscreen .modal-header h3 {
        font-size: 14px;
    }
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 游戏模态框样式 */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    height: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
}

.modal-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.modal-btn:hover {
    background: #e5e7eb;
}

.modal-btn.primary {
    background: #3b82f6;
    color: white;
}

.modal-btn.primary:hover {
    background: #2563eb;
}

.close-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #dc2626;
}

.modal-body {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
}

.game-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 1;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #374151;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    font-size: 16px;
    color: #9ca3af;
}

/* 全屏模式 */
.game-modal.fullscreen .modal-content {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.game-modal.fullscreen .modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    backdrop-filter: blur(10px);
}

.game-modal.fullscreen .modal-header h3 {
    color: white;
}

.game-modal.fullscreen .modal-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.game-modal.fullscreen .modal-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

/* 游戏卡片加载状态 */
.game-card.loading {
    pointer-events: none;
    opacity: 0.7;
}

.game-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 打印样式 */
@media print {
    .top-nav,
    .category-nav,
    .footer {
        display: none;
    }
    
    .main-content {
        padding: 0;
    }
    
    .game-card {
        break-inside: avoid;
        margin-bottom: 16px;
    }
}

/* 无游戏时的提示信息 */
.no-games-message {
    text-align: center;
    padding: 4rem 2rem;
    color: #a0a0a0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    grid-column: 1 / -1;
    width: 100%;
}

.no-games-message h3 {
    font-size: 1.5rem;
    color: #ffffff;
    margin-bottom: 1rem;
    font-weight: 600;
}

.no-games-message p {
    font-size: 1rem;
    margin-bottom: 2rem;
    color: #9ca3af;
    max-width: 400px;
    line-height: 1.5;
}

/* 通用空状态样式 */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    grid-column: 1 / -1;
    width: 100%;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #ffffff;
    margin-bottom: 1rem;
    font-weight: 600;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: #9ca3af;
    max-width: 400px;
    line-height: 1.5;
}

.back-to-home {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #3b82f6;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.back-to-home:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* Logo链接样式 */
.logo-link {
    text-decoration: none;
    color: inherit;
}

.logo-link:hover {
    opacity: 0.8;
}

/* 触摸设备优化 */
.touch-device .game-card.touch-active {
    transform: scale(0.98);
}

/* 触摸设备悬停效果 */
.touch-device .game-card:active {
    transform: translateY(-3px) scale(1.02);
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.touch-device .game-card:active .game-image {
    transform: scale(1.08);
    filter: brightness(1.05) contrast(1.02);
    border-radius: 18px 18px 0 0;
}

.touch-device .game-card:active .game-image-fallback {
    border-radius: 18px 18px 0 0;
}

.touch-device .game-card:active .game-badge {
    transform: translateY(-1px) scale(1.05);
}

.touch-device .game-card:active .game-title-overlay {
    opacity: 1;
    transform: translateY(0);
    backdrop-filter: blur(6px);
}

.touch-device .game-card:active .game-title {
    opacity: 0;
    transform: translateY(-12px);
}

/* 减少动画以提升性能 */
@media (prefers-reduced-motion: reduce) {
    .game-card,
    .game-image,
    .game-title,
    .game-title-overlay {
        transition: none !important;
        animation: none !important;
    }
    
    .game-card:hover {
        transform: none !important;
    }
    
    .game-card:hover .game-image {
        transform: none !important;
    }
}