/* ========================================
   小梦怀旧手游 - 主样式表
   现代暗色主题 | 青色强调 | 星空背景
   ======================================== */

/* ===== CSS 变量 ===== */
:root {
  --bg-primary: #f5f6f8;
  --bg-secondary: #eceff4;
  --bg-card: #ffffff;
  --bg-card-hover: #fafbfe;
  --bg-overlay: rgba(255, 255, 255, 0.97);
  --accent: #4f46e5;
  --accent-light: #6366f1;
  --accent-dark: #4338ca;
  --accent-glow: rgba(79, 70, 229, 0.18);
  --hot: #f97316;
  --hot-soft: rgba(249, 115, 22, 0.1);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #8b95a7;
  --border: #e3e8ef;
  --border-light: #cdd5e0;
  --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; }

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; }

/* ===== 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(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 12px rgba(30, 41, 59, 0.05);
  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: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: #ffffff;
}

.nav-logo-img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.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: var(--accent-glow); }

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

.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;
}

/* ===== 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;
  display: none;
}

.page.active {
  display: block;
}

/* 返回列表/首页时的轻微弹出 */
.page.pop-in { animation: popIn 0.22s ease; }

/* 返回弹出动画 */
@keyframes popIn {
  from { opacity: 0.5; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== Section Title ===== */
.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(120deg, var(--accent-dark), var(--accent) 55%, var(--hot));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 8px;
  text-align: center;
  letter-spacing: 1px;
}

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

/* ===== Hero Section (Home) ===== */
.hero {
  text-align: center;
  padding: 32px 16px 24px;
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(120deg, var(--accent-dark), var(--accent) 50%, var(--hot));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.hero-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-weight: 500;
}

.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: var(--accent-glow);
}

/* ===== Quick Access Cards ===== */
.quick-access {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  max-width: 440px;
  margin: 0 auto 44px;
}

.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.quick-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(30, 41, 59, 0.12);
}

.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: 1.3rem;
  margin-bottom: 6px;
  display: block;
}

.quick-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

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

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

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(30, 41, 59, 0.04);
}

.game-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(30, 41, 59, 0.12);
}

.game-card-cover {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  object-position: 50% 40%;
  background: var(--bg-secondary);
}

.game-card-body {
  padding: 12px 14px 14px;
}

.game-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.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(--hot);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition);
}

.game-card-link:hover { color: var(--accent); 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: 2px solid var(--border-light);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  gap: 20px;
  align-items: flex-start;
  box-shadow: 0 1px 4px rgba(30, 41, 59, 0.05);
}

.article-card:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.12);
}

.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: 700;
  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: var(--accent-glow);
  font-weight: 600;
  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%;
  max-width: 300px;
  aspect-ratio: 4/3;
  object-fit: cover;
  object-position: 50% 40%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  box-shadow: 0 4px 16px rgba(30, 41, 59, 0.08);
}

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

.game-detail-name {
  font-size: 1.5rem;
  font-weight: 800;
  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);
}

.game-detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* 两个按钮共用基础样式：统一字体、行高、尺寸，保证完全等大 */
.btn-guides,
.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  padding: 12px 26px;
  min-width: 138px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  align-self: flex-start;
}

.btn-guides {
  color: var(--accent-dark);
  border: 2px solid var(--accent-dark);
}

.btn-guides:hover {
  background: var(--accent-dark);
  color: #fff;
}

.btn-download {
  color: #16a34a;
  border: 2px solid #16a34a;
}

.btn-download:hover {
  background: #16a34a;
  color: #fff;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
}

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

.article-detail-cover {
  width: 100%;
  max-height: 280px;
  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); }

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

@media (max-width: 900px) {
  .game-detail { grid-template-columns: 1fr; }
  .ranking-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
}

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

  .nav-logo span:not(.logo-icon) { display: none; }

  .nav-links { gap: 0; }
  .nav-links a { font-size: 0.85rem; padding: 8px 10px; }
  .nav-links a.active::after { left: 10px; right: 10px; }

  .hero { padding: 18px 10px 14px; }
  .hero-title { font-size: 1.5rem; letter-spacing: 1.5px; }
  .hero-subtitle { font-size: 0.8rem; margin-bottom: 22px; }

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

  .game-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .game-card-name { font-size: 0.82rem; }
  .filter-btn { font-size: 0.72rem; padding: 5px 10px; }

  .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; }
}