/* ==========================================================================
   RX Switch V2 · WP grid-style theme
   格子背景 + 蓝白主色 + 卡片式详情页
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.1);
  --accent: #3b82f6;
  --bg: #f5f7fb;
  --bg-surface: #ffffff;
  --border: #e6ecf5;
  --text: #1f2937;
  --text-muted: #64748b;
  --chip-bg: #ffffff;
  --chip-border: #e2e8f0;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-card: 0 12px 30px -20px rgba(20, 40, 80, 0.35);
  --shadow-hover: 0 22px 40px -18px rgba(37, 99, 235, 0.3);
  --grid-line: rgba(15, 23, 42, 0.035);
  --grid-line-strong: rgba(15, 23, 42, 0.05);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-surface: #0f172a;
  --border: rgba(148, 163, 184, 0.16);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --chip-bg: rgba(15, 23, 42, 0.72);
  --chip-border: rgba(148, 163, 184, 0.18);
  --shadow-card: 0 12px 30px -20px rgba(2, 6, 23, 0.7);
  --shadow-hover: 0 22px 40px -18px rgba(59, 130, 246, 0.35);
  --grid-line: rgba(148, 163, 184, 0.06);
  --grid-line-strong: rgba(148, 163, 184, 0.09);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===================== 格子背景 (WP 主题 core) ===================== */
.bg-decoration {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(900px 420px at 50% -8%, rgba(37, 99, 235, 0.14), transparent 60%),
              radial-gradient(640px 320px at 12% 18%, rgba(99, 102, 241, 0.08), transparent 62%),
              radial-gradient(520px 280px at 88% 12%, rgba(14, 165, 233, 0.08), transparent 65%),
              linear-gradient(var(--grid-line) 1px, transparent 1px),
              linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
              var(--bg);
  background-size: auto, auto, auto, 44px 44px, 44px 44px, auto;
  background-position: center top, left top, right top, center top, center top, center;
  -webkit-mask-image: radial-gradient(140% 90% at 50% 0%, #000 35%, rgba(0, 0, 0, 0.92) 70%, #000 100%);
  mask-image: radial-gradient(140% 90% at 50% 0%, #000 35%, rgba(0, 0, 0, 0.92) 70%, #000 100%);
}

/* ===================== Header ===================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease;
}
[data-theme="dark"] .site-header {
  background: rgba(15, 23, 42, 0.82);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 4px 10px -4px rgba(37, 99, 235, 0.45);
}
.brand-mark svg { width: 18px; height: 18px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.brand-text small { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.header-search {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 16px;
  height: 38px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.header-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.hs-ico { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.header-search input::placeholder { color: var(--text-muted); }
.hs-clear {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
}
.hs-clear svg { width: 14px; height: 14px; }

.header-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.back-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.back-home-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -6px rgba(37, 99, 235, 0.35);
}
.back-home-btn svg { width: 15px; height: 15px; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .ico-moon { display: none; }
[data-theme="dark"] .icon-btn .ico-sun { display: none; }
[data-theme="dark"] .icon-btn .ico-moon { display: block; }

/* ===================== Main layout ===================== */
.page-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ===================== Hero ===================== */
.hero-section {
  position: relative;
  text-align: center;
  padding: 56px 20px 16px;
  margin-bottom: 8px;
}
.hero-glow {
  position: absolute;
  width: 480px;
  height: 240px;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.16), transparent 70%);
  filter: blur(30px);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 720px; margin: 0 auto; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 18px;
}
[data-theme="dark"] .hero-kicker { background: rgba(15, 23, 42, 0.6); }
.hero-kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

.hero-title {
  font-size: clamp(2rem, 5vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text) 30%, var(--primary) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }
.hero-desc b { color: var(--primary); }

/* Hero search */
.hero-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 580px;
  margin: 0 auto 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 8px 8px 20px;
  box-shadow: 0 18px 40px -24px rgba(15, 23, 42, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.hero-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 18px 40px -24px rgba(37, 99, 235, 0.4), 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.hero-search .hs-ico { width: 20px; height: 20px; }
.hero-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.hero-search input::placeholder { color: var(--text-muted); }
.hs-submit {
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.hs-submit:hover { background: var(--primary-hover); transform: translateY(-1px); }

/* Chips */
.chip-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===================== Feature banner (置顶推荐卡片) ===================== */
.feature-banner {
  max-width: 720px;
  margin: 0 auto 24px;
}
.feature-banner-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(99, 102, 241, 0.06) 60%, rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(37, 99, 235, 0.22);
  box-shadow: 0 14px 30px -18px rgba(37, 99, 235, 0.35);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.feature-banner-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 40px -18px rgba(37, 99, 235, 0.45);
  border-color: rgba(37, 99, 235, 0.4);
}
[data-theme="dark"] .feature-banner-link {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(99, 102, 241, 0.1) 60%, rgba(14, 165, 233, 0.12));
  border-color: rgba(59, 130, 246, 0.3);
}
.feature-banner-cover {
  width: 88px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #dbeafe, #eef2ff);
  display: grid;
  place-items: center;
}
.feature-banner-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.feature-banner-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.feature-banner-tag {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
}
.feature-banner-title {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feature-banner-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feature-banner-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.25s ease, background 0.25s ease;
}
.feature-banner-arrow svg { width: 16px; height: 16px; }
.feature-banner-link:hover .feature-banner-arrow {
  transform: translateX(4px);
  background: var(--primary);
  color: #fff;
}

/* ===================== Stats + Filters ===================== */
.stats-panel {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}
[data-theme="dark"] .stats-panel {
  background: rgba(15, 23, 42, 0.85);
}

.stats-total { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.stats-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.stats-value {
  font-size: 32px;
  font-weight: 820;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stats-recent-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 3px 10px;
}
.stats-recent-badge b { color: var(--primary); }

.stats-divider {
  width: 1px;
  height: 44px;
  background: var(--border);
  flex-shrink: 0;
}

.filters-wrap { flex: 1; min-width: 280px; }

.category-row, .genre-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.genre-row { margin-top: 10px; }

.genre-row-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.75;
  margin-right: 2px;
  white-space: nowrap;
}

.cat-chip, .genre-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cat-chip:hover, .genre-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.cat-chip.is-active, .genre-chip.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.4);
}
.cat-count, .genre-count {
  min-width: 1.5em;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.cat-chip.is-active .cat-count, .genre-chip.is-active .genre-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.genre-chip { padding: 5px 10px; font-size: 12px; }
.genre-chip .genre-count { font-size: 10px; }

.browse-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.browse-all-btn, .random-pick-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.browse-all-btn:hover, .random-pick-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, 0.4);
}
.browse-all-btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.browse-all-btn svg, .random-pick-btn svg { width: 16px; height: 16px; }

/* ===================== Results bar ===================== */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.results-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.results-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.results-controls { display: flex; gap: 10px; }
.ctrl-select select {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.ctrl-select select:focus { border-color: var(--primary); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===================== Game grid ===================== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1280px) { .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px) { .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
@media (max-width: 420px) { .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }

.game-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  animation: cardIn 0.4s ease both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.game-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: #cddcfa;
  z-index: 2;
}
[data-theme="dark"] .game-card:hover { border-color: rgba(59, 130, 246, 0.35); }

.card-cover {
  position: relative;
  aspect-ratio: 92 / 43;
  overflow: hidden;
  background: linear-gradient(135deg, #eef1f5, #dbe4f5);
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.game-card:hover .card-cover img { transform: scale(1.08); }
.card-cover-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(99, 102, 241, 0.1));
}

.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: rgba(37, 99, 235, 0.82);
  backdrop-filter: blur(4px);
}

.card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #94a3b8;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}
.card-fav:hover { color: #ef4444; transform: scale(1.1); }
.card-fav.is-on { color: #ef4444; }
.card-fav svg { width: 16px; height: 16px; }

.card-store-badges {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
}
.card-store-chip {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.card-body { padding: 12px 14px 14px; }
.card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.8em;
  margin-bottom: 4px;
}
.card-alias {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}
.card-genres { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.genre-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}
.card-views {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--primary);
  opacity: 0.85;
  white-space: nowrap;
}
.card-views svg { width: 12px; height: 12px; }
.card-stores { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; margin-left: auto; }
.card-stores svg { width: 12px; height: 12px; }

/* Random pick gacha card */
.random-pick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.04) 40%, rgba(99, 102, 241, 0.08));
  border: 1.5px dashed rgba(37, 99, 235, 0.4);
  border-radius: var(--radius);
  min-height: 200px;
  overflow: hidden;
}
.random-pick-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}
.rp-visual { display: grid; place-items: center; margin-bottom: 10px; }
.rp-dice { width: 46px; height: 46px; color: var(--primary); }
.rp-card-title { font-size: 14px; font-weight: 800; text-align: center; }
.rp-card-sub { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 4px; }

/* ===================== Pagination ===================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.pagination.is-hidden { display: none; }
.page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.page-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}
.page-btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.4);
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-ellipsis { color: var(--text-muted); padding: 0 4px; }
.page-meta { font-size: 12px; color: var(--text-muted); margin-left: 8px; }

/* ===================== State cards ===================== */
.state-card {
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: 20px 0;
}
.state-card.is-hidden { display: none; }
.state-illus { width: 96px; height: 96px; margin: 0 auto 16px; color: var(--primary); opacity: 0.45; }
.state-card h4 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.state-card p { font-size: 13px; color: var(--text-muted); max-width: 420px; margin: 0 auto; }
.state-icon { width: 46px; height: 46px; margin: 0 auto 14px; color: #ef4444; }

.retry-btn {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.retry-btn:hover { background: var(--primary-hover); }

/* Skeleton */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 768px) { .skeleton-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.skeleton-grid.is-hidden { display: none; }
.sk-card {
  height: 220px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--bg-surface) 30%, rgba(148, 163, 184, 0.12) 50%, var(--bg-surface) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border: 1px solid var(--border);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===================== Detail modal (WP style) ===================== */
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 0 40px;
  overflow-y: auto;
}
.detail-modal[hidden] { display: none; }
.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.55);
  backdrop-filter: blur(4px);
}
.detail-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1160px;
  margin: 24px auto;
  background: var(--bg-surface);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}
[data-theme="dark"] .detail-shell { background: rgba(15, 23, 42, 0.98); }

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.back-link:hover { color: var(--primary); }
.back-link svg { width: 17px; height: 17px; }
.detail-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.detail-close:hover { color: var(--text); border-color: var(--text-muted); }
.detail-close svg { width: 16px; height: 16px; }

/* Detail hero with mascots */
.detail-hero {
  position: relative;
  padding: 30px 28px 22px;
  overflow: hidden;
}
.uc-title-mascots {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 8px;
  opacity: 0.05;
  pointer-events: none;
}
.uc-title-mascots img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}
.uc-title-main { position: relative; z-index: 1; text-align: center; }
.detail-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 820;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.detail-meta-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.detail-updated svg { width: 14px; height: 14px; }
.detail-genre-pills { display: flex; gap: 6px; }
.detail-genre-pills .genre-pill { font-size: 12px; padding: 3px 12px; }

/* Detail card body */
.detail-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 28px;
  padding: 0 28px 30px;
}
@media (max-width: 900px) {
  .detail-card { grid-template-columns: 1fr; padding: 0 18px 24px; }
}

/* Gallery */
.detail-gallery { position: relative; }
.gallery-main {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0f172a;
  cursor: zoom-in;
}
.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.3s ease;
}
.gallery-main img:hover { transform: scale(1.02); }
.gallery-main .gallery-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 64px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, #1e293b, #0f172a);
}
.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
  margin-top: 10px;
  max-height: 110px;
  overflow-y: auto;
}
.gallery-thumbs .thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 2px solid transparent;
  cursor: pointer;
  background: #e2e8f0;
  padding: 0;
}
.gallery-thumbs .thumb.is-active { border-color: var(--primary); }
.gallery-thumbs .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-thumbs .thumb:hover img { transform: scale(1.05); }

/* Right info panel */
.detail-right { min-width: 0; }
.game-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.game-meta-item {
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.game-meta-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}
.game-meta-value { font-size: 14px; font-weight: 700; color: var(--text); }

.detail-intro {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.06);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.is-on { background: var(--primary); color: #fff; border-color: var(--primary); }
.action-btn svg { width: 15px; height: 15px; }

/* Transfer section */
.detail-transfer .store-links { display: grid; gap: 8px; }
.store-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.store-link:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateX(3px);
}
.store-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.store-link.is-loading { opacity: 0.7; pointer-events: none; }
.store-link.is-active { border-color: var(--primary); background: var(--primary-soft); }

/* ---- transfer result box ---- */
.transfer-box {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.05);
  padding: 16px;
  text-align: center;
}
.transfer-box.is-hidden { display: none; }

.transfer-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 20px;
}
.transfer-status.is-ok { color: var(--primary); }
.transfer-status.is-error { color: #ef4444; }

.transfer-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.transfer-qr-wrap {
  margin-top: 12px;
}
.transfer-qr-wrap.is-hidden { display: none; }
.transfer-qr-img {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px;
  display: block;
  margin: 0 auto 8px;
}
.transfer-qr-hint { font-size: 12px; color: var(--text-muted); }

.transfer-link-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.transfer-link-row.is-hidden { display: none; }
.transfer-link-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.transfer-link-btn {
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.transfer-link-btn:hover { border-color: var(--primary); color: var(--primary); }
.transfer-link-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.transfer-link-btn.primary:hover { background: var(--primary-hover); }
.transfer-link-btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.transfer-detail {
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 10px;
  background: var(--bg);
  border-radius: 8px;
  padding: 10px;
  max-height: 120px;
  overflow-y: auto;
}
.transfer-detail.is-hidden { display: none; }

/* ===================== Random pick modal ===================== */
.rp-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rp-modal.is-hidden { display: none; }
.rp-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 20, 0.6); }
.rp-shell {
  position: relative;
  z-index: 2;
  width: min(520px, 90vw);
  background: var(--bg-surface);
  border-radius: 22px;
  padding: 30px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5);
}
.rp-close, .share-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 3;
}
.rp-reel { transition: opacity 0.2s ease; }
.rp-reel[data-state="spinning"] .rp-card { animation: rpSpin 1.2s ease; }
@keyframes rpSpin { 0% { transform: rotate(0) scale(0.9); opacity: 0.4; } 50% { transform: rotate(360deg) scale(1.05); } 100% { transform: rotate(0) scale(1); } }
.rp-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(148, 163, 184, 0.05);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
}
.rp-cover {
  width: 120px;
  height: 68px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(99, 102, 241, 0.1));
  display: grid;
  place-items: center;
}
.rp-cover img { width: 100%; height: 100%; object-fit: cover; }
.rp-cover .fallback { font-size: 28px; font-weight: 800; color: var(--primary); }
.rp-cat { font-size: 11px; color: var(--primary); font-weight: 700; }
.rp-info h3 { font-size: 16px; font-weight: 700; margin: 6px 0 4px; }
.rp-info p { font-size: 12px; color: var(--text-muted); }
.rp-actions { display: flex; gap: 10px; justify-content: center; }
.rp-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
}
.rp-btn.ghost { background: var(--chip-bg); color: var(--text); }
.rp-btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.rp-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.rp-btn.primary:hover { background: var(--primary-hover); }

/* ===================== Share modal ===================== */
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 310;
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-modal.is-hidden { display: none; }
.share-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 20, 0.6); }
.share-shell {
  position: relative;
  z-index: 2;
  width: min(420px, 90vw);
  background: var(--bg-surface);
  border-radius: 22px;
  padding: 28px;
  text-align: center;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.4);
}
.share-shell h3 { font-size: 17px; margin-bottom: 6px; }
.share-name { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.share-qr { width: 200px; height: 200px; margin: 0 auto 16px; }
.share-qr img { width: 100%; height: 100%; border-radius: 12px; }
.share-link {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  margin-bottom: 10px;
  outline: none;
}
.share-copy {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.share-copy:hover { background: var(--primary-hover); }

/* ===================== Lightbox ===================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(2, 6, 23, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox.is-hidden { display: none; }
.lightbox img {
  max-width: 90vw;
  max-height: 84vh;
  border-radius: 12px;
  object-fit: contain;
}
.lb-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-caption {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
}

/* ===================== Toast ===================== */
.toast {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: #1e293b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 500;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== Responsive ===================== */
@media (max-width: 768px) {
  .header-inner { padding: 0 14px; gap: 10px; }
  .header-search { display: none; }
  .back-home-btn { padding: 0 10px; font-size: 12px; }
  .back-home-btn span { display: none; }
  .page-main { padding: 0 14px 40px; }
  .hero-section { padding: 36px 8px 8px; }
  .hero-title { font-size: 1.7rem; }
  .hero-search input { font-size: 14px; }
  .hs-submit { padding: 9px 18px; font-size: 13px; }
  .stats-panel { padding: 14px; gap: 12px; }
  .stats-value { font-size: 24px; }
  .category-row, .genre-row { gap: 6px; }
  .cat-chip, .genre-chip { padding: 6px 10px; font-size: 12px; }
  .detail-shell { margin: 10px; border-radius: 18px; }
  .detail-card { grid-template-columns: 1fr; }
  .detail-hero { padding: 20px 16px 14px; }
  .detail-title { font-size: 1.3rem; }
}
