/* US Game Hub - 主样式文件 */
/* 参考 CrazyGames/Poki 设计风格，适配 AdSense 需求 */

/* CSS Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主色调 */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    
    /* 次要颜色 */
    --secondary-color: #FF5722;
    --accent-color: #4CAF50;
    
    /* 暗色主题文本色彩系统 */
    --text-primary: #f8f9fa;    /* 主文本 - 亮白色，确保在暗背景上清晰 */
    --text-secondary: #e9ecef;  /* 次要文本 - 柔和白色 */
    --text-muted: #adb5bd;      /* 辅助文本 - 浅灰 */
    --text-white: #ffffff;      /* 纯白文本 */
    --text-white-soft: #f8f9fa; /* 柔和白色 */
    --text-dark: #ffffff;       /* 在暗色主题中也使用白色 */
    --text-light: #dee2e6;      /* 浅灰白色文本 */
    
    /* 暗色背景系统 */
    --bg-white: #1a1a1a;        /* 深灰黑背景 */
    --bg-light: #2d2d2d;        /* 深灰背景 */
    --bg-gray: #3a3a3a;         /* 中深灰背景 */
    --bg-dark: #000000;         /* 纯黑背景 */
    
    /* 卡片和边框暗色系统 */
    --card-bg: #2a2a3e;         /* 深紫灰背景 */
    --card-border: #495057;     /* 深色边框 */
    --card-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.4), 0 2px 6px 0 rgba(0, 0, 0, 0.3);
    
    /* 语义色彩 */
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --error-color: #F44336;
    
    /* 暗色主题阴影系统 */
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 24px rgba(0,0,0,0.6), 0 8px 12px rgba(0,0,0,0.5);
    
    /* 边框圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* 间距 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* 字体 */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Inter', system-ui, sans-serif;
}

/* 基础样式 */
html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(180deg, #000000 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 无障碍和焦点样式 */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

a:focus-visible {
    text-decoration: underline;
}

button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

.section {
    padding: var(--spacing-xl) 0;
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

.section-title {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    color: var(--text-dark);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    margin: var(--spacing-sm) auto 0;
    border-radius: var(--radius-sm);
}

/* 按钮组件 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
    gap: var(--spacing-xs);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* 导航栏 */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 0;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-sm);
    max-width: 1200px;
    margin: 0 auto;
}

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

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-dark);
    gap: var(--spacing-sm);
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    border-radius: 50%;
    margin-right: 8px;
}

.logo-icon {
    font-size: 20px;
    filter: grayscale(100%) brightness(0) invert(1);
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-right: 8px;
}

.brand-tagline {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 搜索栏 */
.nav-search {
    flex: 1;
    max-width: 400px;
    margin: 0 var(--spacing-lg);
}

.search-form {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
    background: var(--bg-light);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-muted);
}

.search-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    align-items: center;
}

.nav-list {
    display: flex;
    list-style: none;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.1);
}

/* 下拉菜单 */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    min-width: 200px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

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

.dropdown-link {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    text-decoration: none;
    color: var(--text-dark);
    transition: background 0.3s ease;
}

.dropdown-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

/* 语言切换按钮 */
.lang-toggle {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
    transition: all 0.3s ease;
}

.lang-toggle:hover {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

/* 移动端菜单按钮 */
.mobile-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
    gap: 4px;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hero 区域 */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: var(--spacing-xl) 0;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-lg);
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* 轮播组件 */
.featured-carousel {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    aspect-ratio: 16/9; /* 使用16:9比例替代固定高度，更符合现代显示标准 */
    min-height: 400px; /* 设置最小高度确保移动端体验 */
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    z-index: 1;
}

.carousel-item.active {
    opacity: 1;
    z-index: 2;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.carousel-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: var(--spacing-lg) var(--spacing-md) var(--spacing-md);
    z-index: 2;
}

.carousel-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.carousel-content p,
.carousel-description {
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
    opacity: 0.9;
    line-height: 1.4;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.game-source-tag {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-bottom: 8px;
    backdrop-filter: blur(10px);
}

.carousel-actions {
    margin-top: var(--spacing-md);
}

.carousel-play-btn {
    background: rgba(76, 175, 80, 0.9) !important;
    backdrop-filter: blur(10px);
    border: none !important;
    padding: 12px 24px !important;
    font-weight: 600;
    text-shadow: none !important;
    transition: all 0.3s ease;
}

.carousel-play-btn:hover {
    background: rgba(56, 142, 60, 0.95) !important;
    transform: translateY(-2px);
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    border: 2px solid rgba(255,255,255,0.8);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.4rem;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.carousel-btn:hover {
    background: rgba(0,0,0,0.9);
    border-color: #4a9eff;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 6px 16px rgba(74, 158, 255, 0.4);
}

.carousel-btn.prev {
    left: 20px;
}

.carousel-btn.next {
    right: 20px;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: white;
    transform: scale(1.2);
}

/* 分类网格 */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.category-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-dark);
    border: 2px solid transparent;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    display: block;
}

.category-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.category-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
}

.category-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-light);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

/* 游戏网格 */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.game-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #312e81 50%, #4c1d95 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    display: block;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.game-thumbnail {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

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

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

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

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

.game-card:hover .category-icon-display {
    opacity: 0.3;
}

.play-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    z-index: 11;
    position: relative;
}

.game-card:hover .play-btn {
    transform: scale(1);
}

.game-info {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    min-height: 140px; /* 确保一致的卡片高度 */
}


.game-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0; /* 标题高度固定 */
}

.game-description {
    font-size: 0.9rem;
    color: var(--text-secondary);  /* 从text-light改为更深的text-secondary */
    line-height: 1.6;
    margin-bottom: var(--spacing-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1; /* 描述区域占用剩余空间 */
}

.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    flex-shrink: 0; /* 元数据高度固定 */
}

.game-rating {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.stars {
    display: flex;
    gap: 2px;
}

.star {
    color: #FFD700;
    font-size: 0.9rem;
}

.rating-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.game-category {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
}

.game-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    flex-shrink: 0; /* 标签区域高度固定 */
    margin-top: auto; /* 推到底部 */
}

.game-tag {
    background: var(--primary-color);
    color: var(--text-white);
    border: 1px solid var(--primary-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.game-tag:hover {
    background: var(--primary-dark);
    color: var(--text-white);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

/* 标签云 */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.tag-item {
    background: var(--bg-light);
    color: var(--text-dark);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid #E0E0E0;
}

.tag-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* 页脚 */
.footer {
    background: linear-gradient(135deg, #1e3a8a 0%, #312e81 40%, #4c1d95 80%, #5b21b6 100%) !important;
    color: white !important;
    padding: var(--spacing-xl) 0 var(--spacing-lg);
    margin-top: var(--spacing-xl);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: var(--spacing-sm);
    color: white;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--spacing-xs);
}

.footer-links a {
    color: #BDBDBD;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-light);
}

.social-links {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.social-links a {
    font-size: 1.2rem;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.social-links a:hover {
    transform: scale(1.2);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    background: transparent;
}

/* 辅助类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-xs) !important; }
.mb-2 { margin-bottom: var(--spacing-sm) !important; }
.mb-3 { margin-bottom: var(--spacing-md) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--spacing-xs) !important; }
.mt-2 { margin-top: var(--spacing-sm) !important; }
.mt-3 { margin-top: var(--spacing-md) !important; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* 加载动画 */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-spinner.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Cookie 提示 */
.cookie-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--text-dark);
    color: white;
    padding: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.cookie-notice.show {
    transform: translateY(0);
}

.cookie-accept {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
}

/* 面包屑导航 */
.breadcrumb {
    margin-bottom: var(--spacing-lg);
}

.breadcrumb-list {
    display: flex;
    list-style: none;
    gap: var(--spacing-xs);
    align-items: center;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: '›';
    margin-left: var(--spacing-xs);
    color: var(--text-muted);
}

.breadcrumb-item a {
    text-decoration: none;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.breadcrumb-item.active {
    color: var(--text-muted);
    font-size: 0.9rem;
}