/* ========================================
   GAMEHUB 游戏整合站 - 主样式表
   现代暗色主题 | 青色强调 | 星空背景
   ======================================== */

/* ===== CSS 变量 ===== */
:root {
  --bg-primary: #0a0f1a;
  --bg-secondary: #111827;
  --bg-card: #161e2c;
  --bg-card-hover: #1c2a3f;
  --bg-overlay: rgba(15, 23, 42, 0.95);
  --accent: #00d4ff;
  --accent-light: #33ddff;
  --accent-dark: #00a8cc;
  --accent-glow: rgba(0, 212, 255, 0.3);
  --text-primary: #e8edf2;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #1e2d40;
  --border-light: #2a3a50;
  --gold: #f0b90b;
  --silver: #a8b8c8;
  --bronze: #d4845a;
  --danger: #ef4444;
  --success: #10b981;
  --nav-height: 60px;
  --max-width: 1200px;
  --radius: 8px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ===== Starfield Canvas ===== */
#starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===== App Container ===== */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Navigation Bar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 15, 26, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.nav-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--bg-primary);
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  position: relative;
}

.nav-links a:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.nav-links a.active {
  color: var(--accent);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

/* ===== Main Content Area ===== */
main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===== Page Container ===== */
.page {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  visibility: hidden;
}

.page.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  position: relative;
  visibility: visible;
}

/* Page enter animation for child elements */
.page.active .game-card,
.page.active .article-card,
.page.active .quick-card {
  animation: cardFadeIn 0.4s ease backwards;
}

/* Staggered delays for cards */
.page.active .game-card:nth-child(1),
.page.active .article-card:nth-child(1),
.page.active .quick-card:nth-child(1) { animation-delay: 0.05s; }
.page.active .game-card:nth-child(2),
.page.active .article-card:nth-child(2),
.page.active .quick-card:nth-child(2) { animation-delay: 0.1s; }
.page.active .game-card:nth-child(3),
.page.active .article-card:nth-child(3),
.page.active .quick-card:nth-child(3) { animation-delay: 0.15s; }
.page.active .game-card:nth-child(4),
.page.active .article-card:nth-child(4),
.page.active .quick-card:nth-child(4) { animation-delay: 0.2s; }
.page.active .game-card:nth-child(5),
.page.active .article-card:nth-child(5),
.page.active .quick-card:nth-child(5) { animation-delay: 0.25s; }
.page.active .game-card:nth-child(6),
.page.active .article-card:nth-child(6),
.page.active .quick-card:nth-child(6) { animation-delay: 0.3s; }
.page.active .game-card:nth-child(7),
.page.active .article-card:nth-child(7),
.page.active .quick-card:nth-child(7) { animation-delay: 0.35s; }
.page.active .game-card:nth-child(8),
.page.active .article-card:nth-child(8),
.page.active .quick-card:nth-child(8) { animation-delay: 0.4s; }
.page.active .game-card:nth-child(n+9),
.page.active .article-card:nth-child(n+9),
.page.active .quick-card:nth-child(n+9) { animation-delay: 0.45s; }

/* Section title animation */
.page.active .section-title,
.page.active .game-detail-header,
.page.active .article-detail-header {
  animation: fadeSlideIn 0.4s ease backwards;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Section Title ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-align: center;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  text-align: center;
}

/* ===== Hero Section (Home) ===== */
.hero {
  text-align: center;
  padding: 60px 20px 40px;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 12px;
  text-shadow: 0 0 40px var(--accent-glow);
  letter-spacing: 2px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 28px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.05);
}

/* ===== Quick Access Cards ===== */
.quick-access {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 50px;
}

.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.quick-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.quick-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.quick-card:hover::before { opacity: 1; }

.quick-card-icon {
  font-size: 2rem;
  margin-bottom: 14px;
  display: block;
}

.quick-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.quick-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Game Cards Grid ===== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}

.game-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.game-card-cover {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--bg-secondary);
}

.game-card-body {
  padding: 16px 18px;
}

.game-card-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.game-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.game-card-meta .sep {
  color: var(--border-light);
  margin: 0 2px;
}

.game-card-developer {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.game-card-link {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition);
}

.game-card-link:hover { color: var(--accent-light); gap: 8px; }

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-btn {
  font-size: 0.82rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 7px 18px;
  cursor: pointer;
  border-radius: 20px;
  transition: all var(--transition);
}

.filter-btn:hover { border-color: var(--accent); color: var(--text-primary); }

.filter-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 600;
}

/* ===== Search Bar ===== */
.search-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.search-btn {
  font-size: 0.82rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 9px 18px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.search-btn:hover { border-color: var(--accent); color: var(--text-primary); }

/* ===== Article Cards ===== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.article-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.article-badge {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  margin-top: 3px;
}

.badge-moba { background: linear-gradient(135deg, #00d4ff, #0066cc); }
.badge-rpg { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.badge-fps { background: linear-gradient(135deg, #f97316, #ea580c); }
.badge-action { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.badge-guide { background: linear-gradient(135deg, #10b981, #059669); }
.badge-info { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.badge-review { background: linear-gradient(135deg, #f59e0b, #d97706); }

.article-card-body { flex: 1; min-width: 0; }

.article-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.article-card-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  align-items: center;
}

.article-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.article-card-tag {
  font-size: 0.72rem;
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ===== Game Detail Page ===== */
.game-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}

.game-detail-cover {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.game-detail-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-detail-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.game-detail-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.game-detail-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.game-detail-spec {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

.game-detail-spec-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.game-detail-spec-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  align-self: flex-start;
}

.btn-download:hover {
  background: var(--accent-light);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ===== Article Detail ===== */
.article-detail {
  max-width: 800px;
  margin: 0 auto;
}

.article-detail-cover {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  background: var(--bg-secondary);
}

.article-detail-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.article-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.article-detail-content {
  font-size: 0.92rem;
  line-height: 1.9;
  color: var(--text-secondary);
}

.article-detail-content h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 30px 0 14px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.article-detail-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-light);
  margin: 22px 0 10px;
}

.article-detail-content p { margin-bottom: 14px; }
.article-detail-content ul, .article-detail-content ol { margin: 10px 0 16px 20px; }
.article-detail-content li { margin-bottom: 6px; }
.article-detail-content strong { color: var(--accent); }

/* ===== Ranking Page ===== */
.ranking-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
}

.ranking-tab {
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 24px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ranking-tab:hover { border-color: var(--accent); color: var(--text-primary); }

.ranking-tab.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.ranking-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ranking-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.ranking-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.ranking-badge.gold { background: var(--gold); color: #1a1a2e; }
.ranking-badge.silver { background: var(--silver); color: #1a1a2e; }
.ranking-badge.bronze { background: var(--bronze); color: #1a1a2e; }
.ranking-badge.normal { background: var(--bg-secondary); color: var(--text-muted); }

.ranking-card-cover {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--bg-secondary);
}

.ranking-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.ranking-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ranking-heat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ===== Back Button ===== */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  transition: all var(--transition);
}

.btn-back:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Load State ===== */
.load-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== No Results ===== */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ===== Error State ===== */
.error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--danger);
}

.error-state p:first-child {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.footer-brand .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--bg-primary);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

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

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== Responsive ===== */

@media (max-width: 900px) {
  .quick-access { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto 50px; }
  .game-detail { grid-template-columns: 1fr; }
  .ranking-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
  .hero-title { font-size: 2rem; }
}

@media (max-width: 640px) {
  :root { --nav-height: 54px; }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg-overlay);
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    z-index: 99;
    backdrop-filter: blur(12px);
  }

  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 14px; }
  .nav-links a.active::after { display: none; }
  .nav-toggle { display: block; }

  .hero { padding: 40px 12px 30px; }
  .hero-title { font-size: 1.6rem; }
  .hero-subtitle { font-size: 0.9rem; }

  .section-title { font-size: 1.2rem; }

  .game-grid { grid-template-columns: 1fr; gap: 14px; }
  .filter-btn { font-size: 0.75rem; padding: 5px 12px; }

  .article-card { flex-direction: column; gap: 12px; padding: 16px 18px; }
  .article-badge { align-self: flex-start; }

  .ranking-grid { grid-template-columns: 1fr; }

  .game-detail-specs { grid-template-columns: 1fr; }

  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { gap: 16px; }

  .page { padding: 20px 14px; }
}