/* ============================================================
   模组加加 (ModPlus) - 游戏库  对齐官网风格
   深色游戏风格 · 绿色主色 #13B056
   ============================================================ */

:root {
  --bg: #0a0a0b;
  --bg-soft: #0f0f11;
  --surface: #151518;
  --surface-2: #1c1c20;
  --surface-3: #26262b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --primary: #13b056;
  --primary-2: #1fd269;
  --primary-dim: rgba(19, 176, 86, 0.14);
  --accent: #38bdf8;

  --text: #e8eaf0;
  --text-2: #a2a8b6;
  --text-3: #6b7280;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --maxw: 1160px;

  --nav-h: 64px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100%;
}
a { color: var(--primary-2); text-decoration: none; }
a:hover { color: #4be28b; }
img { max-width: 100%; }
::selection { background: rgba(19, 176, 86, 0.35); }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; width: 100%; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; height: 100%; }
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; font-size: 18px;
  margin-right: 28px; flex-shrink: 0;
}
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand small { color: var(--text-3); font-weight: 400; font-size: 12px; margin-left: 4px; }
.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; }
.nav-links li { display: flex; }
.nav-links a {
  display: flex; align-items: center;
  padding: 8px 14px;
  color: var(--text-2); font-size: 15px; font-weight: 500;
  transition: color .15s;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--primary-2); font-weight: 600; }

/* ---------- 页头 ---------- */
.page-head { padding: 48px 0 8px; }
.page-head h1 { font-size: 32px; font-weight: 800; }
.page-head .crumb { color: var(--text-3); font-size: 13px; margin-bottom: 8px; }
.page-head p { color: var(--text-2); margin-top: 8px; }

/* ---------- 区块 ---------- */
.section { padding: 72px 0; }

/* ---------- 工具栏 + 排序 ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.sort-tabs {
  display: inline-flex; gap: 6px; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px;
}
.sort-btn {
  padding: 8px 18px; border: 1px solid transparent;
  background: transparent; color: var(--text-2);
  border-radius: 999px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; line-height: 1.4;
  transition: border-color .15s, background .15s, color .15s;
}
.sort-btn i { margin-right: 6px; }
.sort-btn:hover { color: var(--text); background: var(--surface-3); }
.sort-btn.active {
  background: var(--primary-dim); border-color: var(--primary-2);
  color: var(--primary-2);
}
.sort-btn.disabled { opacity: .5; pointer-events: none; }
.refresh-note { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* ---------- 工具栏右侧（搜索 + 申请支持） ---------- */
.toolbar-right {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.game-request-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; white-space: nowrap;
  background: var(--primary-dim); border: 1px solid var(--primary-2);
  color: var(--primary-2); border-radius: 999px;
  font-size: 14px; font-weight: 600; line-height: 1.4; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.game-request-btn:hover {
  background: var(--primary-2); color: #fff; border-color: var(--primary-2);
}
.game-request-btn i { font-size: 12px; }

/* ---------- 搜索框 ---------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  min-width: 260px; padding: 8px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.search-box:focus-within {
  border-color: var(--primary-2);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.search-icon { color: var(--text-3); font-size: 13px; flex-shrink: 0; }
.search-box:focus-within .search-icon { color: var(--primary-2); }
.search-box input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  color: var(--text); font-size: 14px; font-family: inherit;
}
.search-box input::placeholder { color: var(--text-3); }
.search-clear {
  display: none; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0; border: none; cursor: pointer;
  background: var(--surface-3); color: var(--text-2);
  border-radius: 50%; font-size: 11px; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.search-clear:hover { background: var(--primary); color: #fff; }
.search-box.has-keyword .search-clear { display: inline-flex; }

/* ---------- 统计条 ---------- */
.stats-bar { display: flex; justify-content: flex-start; margin-bottom: 22px; }
.game-count {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); font-size: 13px;
}

/* ---------- 游戏网格（竖向卡片） ---------- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.game-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(19, 176, 86, 0.4);
  background: var(--surface-2);
}
.card-img {
  position: relative; width: 100%; height: 200px; overflow: hidden;
  background: var(--surface-2);
}
.card-img img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
}
/* state=1 游戏：图片右上角「支持管理器」标记（半透明） */
.card-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(19, 176, 86, 0.45); color: #fff;
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 4px 8px; border-radius: 999px;
  backdrop-filter: blur(2px);
  pointer-events: none; /* 不挡卡片点击 */
}
.game-card:hover .card-img img { transform: scale(1.03); }
.card-content {
  padding: 14px 16px 16px; flex: 1;
  display: flex; flex-direction: column; gap: 5px;
}
.game-title {
  font-weight: 700; font-size: 15px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.game-en {
  color: var(--text-3); font-size: 12px; letter-spacing: 0.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.game-meta {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
  margin-top: 8px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.game-type {
  background: var(--primary-dim); color: var(--primary-2);
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.game-heat {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); font-size: 12px; font-weight: 600;
}
.game-heat i { font-size: 11px; color: #f97316; }

/* ---------- 加载 / 错误 / 空 ---------- */
.loading-container, .error-container {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 24px; text-align: center; gap: 14px;
  border-radius: var(--radius); background: var(--surface);
  border: 1px dashed var(--border-strong);
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(19, 176, 86, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-container p, .error-container p { color: var(--text-2); }
.error-icon { font-size: 2.4rem; color: #f97316; }
.error-container h3 { font-size: 18px; font-weight: 700; }
.retry-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 10px 24px; border: none; cursor: pointer;
  border-radius: 999px; font-size: 14px; font-weight: 600; font-family: inherit;
  background: linear-gradient(135deg, var(--primary), #0e9a48); color: #fff;
  box-shadow: 0 6px 20px rgba(19, 176, 86, 0.35);
  transition: transform .12s, box-shadow .15s;
}
.retry-btn:hover { background: linear-gradient(135deg, #17c862, #11a851); }
.retry-btn:active { transform: translateY(1px); }
.no-data {
  grid-column: 1 / -1; text-align: center; padding: 40px;
  color: var(--text-3); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); background: var(--surface);
}

/* ---------- 页脚 ---------- */
.footer { margin-top: auto; border-top: 1px solid var(--border); background: var(--bg-soft); padding: 48px 0 28px; }
.footer-links {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px;
  padding: 18px 0 16px; margin-bottom: 18px;
}
.footer-links .fl-label { color: var(--text-2); font-size: 13px; font-weight: 600; }
.footer-links a { color: var(--text-3); font-size: 13px; }
.footer-links a:hover { color: var(--primary-2); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 20px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--text-3); font-size: 13px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .nav { overflow-x: auto; overflow-y: hidden; }
  .brand { margin-right: 16px; }
  .brand small { display: none; }
  .nav-links a { padding: 0 12px; font-size: 14px; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .card-img { height: 150px; }
}
@media (max-width: 520px) {
  .toolbar { flex-direction: column; align-items: flex-start; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .game-title { font-size: 14px; }
  .sort-btn { padding: 7px 14px; font-size: 13px; }
}
/* ---------- 导航下拉「资源」（整合/模组/工具） ---------- */
.nav-item-drop { position: relative; }
.nav-drop-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  color: var(--text-2); font-size: 15px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: color .15s;
}
.nav-drop-toggle:hover { color: var(--text); }
.nav-caret { color: var(--text-3); flex-shrink: 0; transition: transform .2s; }
.nav-item-drop:hover .nav-caret, .nav-item-drop:focus-within .nav-caret { transform: rotate(180deg); }
.nav-drop-menu {
  position: absolute; top: 100%; left: 0; min-width: 132px;
  padding: 6px; margin: 0;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow);
  list-style: none; z-index: 120;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.nav-item-drop:hover .nav-drop-menu, .nav-item-drop:focus-within .nav-drop-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-drop-menu a {
  display: block; padding: 9px 12px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; white-space: nowrap;
}
.nav-drop-menu a:hover { background: var(--surface-3); color: var(--text); }
.nav-drop-menu a.active { background: var(--primary-dim); color: var(--primary-2); font-weight: 600; }
/* ---------- 页脚 grid（对齐官网，供 footer.js 注入） ---------- */
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; margin-bottom: 34px; }
.footer h4 { font-size: 15px; margin-bottom: 12px; }
.footer p, .footer li { color: var(--text-3); font-size: 13.5px; }
.footer ul { list-style: none; }
.footer li { margin-bottom: 8px; }
.footer a { color: var(--text-3); }
.footer a:hover { color: var(--primary-2); }
.footer .desc { margin-top: 8px; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- 分页 ---------- */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 28px; flex-wrap: wrap;
}
.pagination .page-btn,
.pagination .page-number {
  min-width: 34px; height: 34px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 13.5px; border-radius: 8px;
  cursor: pointer; user-select: none; transition: all .15s;
}
.pagination .page-btn:hover:not(:disabled),
.pagination .page-number:hover { border-color: var(--primary); color: var(--primary-2); }
.pagination .page-btn:disabled {
  opacity: .4; cursor: not-allowed;
}
.pagination .page-number.active {
  background: var(--primary-dim); border-color: var(--primary); color: var(--primary-2); font-weight: 600;
}
.pagination .page-ellipsis { color: var(--text-3); padding: 0 2px; }
.pagination .page-total { margin-left: 8px; color: var(--text-3); font-size: 13px; }