/* ---- Fonts (from demo1) ---- */
@font-face {
  font-family: 'Torus';
  font-display: swap;
  font-weight: 700;
  src: url('./fonts/torus-bold-latin.woff2') format('woff2');
}

/* ============================================
   GameHub — Game theme mobile homepage style
   Dark neon theme, fits 320px ~ 480px viewport
   ============================================ */

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Torus', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0a1220;
  color: #93c5fd;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
input {
  font-family: 'Torus';
}
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ---- Global background ---- */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    linear-gradient(180deg, #0a1220 0%, #0a1220 50%, #0a1220 100%);
  z-index: -1;
  pointer-events: none;
}

/* ---- Header ---- */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10, 18, 32, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(13, 26, 46, 0.1);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header .brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700;
  background: linear-gradient(90deg, #3b82f6, #3b82f6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #3b82f6, #3b82f6);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #93c5fd; font-weight: bold;
}

/* ---- Search trigger ---- */
.search-trigger {
  display: flex; align-items: center; gap: 8px;
  background: rgba(10, 22, 38, 0.05);
  border: 1px solid rgba(13, 26, 46, 0.15);
  border-radius: 24px;
  padding: 8px 14px;
  font-size: 13px;
  color: #93c5fd;
  transition: all 0.2s ease;
}
.search-trigger:active { background: rgba(59, 130, 246, 0.1); }

/* ---- Game card (home) ---- */
.game-card {
  display: block;
  background: rgba(10, 18, 32, 0.03);
  border: 1px solid rgba(13, 26, 46, 0.08);
  border-radius: 12px;
  padding: 6px;
  transition: all 0.2s ease;
}
.game-card.no-border {
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
}
.game-card:active { transform: scale(0.96); }
.game-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #0a1220;
  position: relative;
}
.game-card.no-border .game-thumb { border-radius: 10px; }
.game-thumb::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 8px;
  box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.05);
  pointer-events: none;
}
.game-card.no-border .game-thumb::after { border-radius: 10px; }
.game-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.game-card:hover .game-thumb img { transform: scale(1.05); }
.game-name {
  font-size: 12px;
  text-align: center;
  color: #93c5fd;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 6px 2px 0;
}

/* ---- Category nav (kept for compatibility) ---- */
.cat-nav {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(10, 18, 32, 0.03);
  border: 1px solid rgba(13, 26, 46, 0.08);
  border-radius: 12px;
  padding: 8px;
  min-width: 80px;
  transition: all 0.2s ease;
}
.cat-nav-item:active { background: rgba(59, 130, 246, 0.08); }
.cat-nav-item img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.cat-nav-item span { font-size: 11px; color: #93c5fd; white-space: nowrap; }

/* ---- Section ---- */
.section { margin: 16px 0; padding: 0 12px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-title {
  font-size: 16px; font-weight: 700; color: #93c5fd;
  display: flex; align-items: center; gap: 6px;
}
.section-title::before { content: "◆"; color: #3b82f6; font-size: 10px; }
.gh-section-more {
  font-size: 13px; color: #3b82f6;
  padding: 4px 10px;
  border: 1px solid rgba(13, 26, 46, 0.2);
  border-radius: 12px;
  transition: all 0.2s ease;

  background: #0a1626;}
.gh-section-more:active { background: rgba(59, 130, 246, 0.1); }

/* ---- Game grid (home 3-col) ---- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* ---- Masonry grid (search 2-col waterfall) ---- */
.masonry-grid {
  display: flex;
  gap: 10px;
}
.masonry-grid#searchResults {
  padding: 0 12px;
}
.masonry-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.masonry-grid .game-card {
  width: 100%;
  height: auto;
  margin-bottom: 0;
}
.masonry-grid .game-thumb {
  width: 100%;
  aspect-ratio: auto;
  height: auto;
  border-radius: 10px;
  overflow: hidden;
  background: #0a1220;
}
.masonry-grid .game-thumb img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.gh-ad {
  margin: 0 auto;
  width: 100%;
  text-align: center;
}

.list-gh-ad {
  text-align: center;
}

/* ---- Footer ---- */
.app-footer {
  text-align: center;
  font-size: 12px;
  color: #93c5fd;
  padding: 20px 12px;
  border-top: 1px solid rgba(13, 26, 46, 0.06);
  margin-top: 20px;
}

/* ---- Search page ---- */
.search-page .search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
}
.search-page .search-bar .back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #3b82f6;
  text-decoration: none;
}
.search-page .search-bar .back-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
.search-page .search-bar input {
  flex: 1;
  background: rgba(10, 18, 32, 0.05);
  border: 1px solid rgba(13, 26, 46, 0.15);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  color: #93c5fd;
  outline: none;
}
.search-page .search-bar input::placeholder { color: #93c5fd; }
.search-page .search-bar .cancel-btn {
  font-size: 14px;
  color: #3b82f6;
  padding: 8px 12px;
}

/* ---- Category page ---- */
.cat-header {
  display: flex;
  height: 70px;
  align-items: center;
  gap: 12px;
  padding: 16px 12px;
}
.cat-header .back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
  width: 40px;
  height: 40px;
}
.cat-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #93c5fd;
  margin: 0;
  height: 40px;
  line-height: 40px;
}

/* ---- Empty state ---- */
.empty-msg {
  text-align: center; color: #93c5fd;
  font-size: 14px; padding: 40px 0;
  grid-column: 1 / -1;
}

/* ---- Loading indicator ---- */
.load-more-indicator {
  text-align: center;
  color: #93c5fd;
  font-size: 13px;
  padding: 16px 12px;
}
.reached-bottom {
  color: #93c5fd;
  font-style: italic;
}

/* ---- Scroll sentinel (outside grid) ---- */
.scroll-sentinel {
  height: 1px;
  visibility: hidden;
  margin-top: 8px;
}

/* ---- Drawer ---- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 200;
}
.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}
.drawer-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100%;
  background: #0a1220;
  border-right: 1px solid rgba(13, 26, 46, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 201;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}
.drawer-panel.open {
  transform: translateX(0);
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 1px solid rgba(13, 26, 46, 0.1);
  margin-bottom: 8px;
}
.drawer-header span {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, #3b82f6, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.drawer-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
  cursor: pointer;
  background: rgba(10, 22, 38, 0.05);
  border: 1px solid rgba(13, 26, 46, 0.1);
  border-radius: 8px;
}
.drawer-close:active { background: rgba(59, 130, 246, 0.1); }
.drawer-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}
.drawer-nav li {
  margin: 2px 0;
}
.drawer-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: 14px;
  color: #93c5fd;
  transition: background 0.15s ease;
  text-decoration: none;
}
.drawer-nav a:hover,
.drawer-nav a:active {
  background: rgba(59, 130, 246, 0.08);
  color: #93c5fd;
}
.drawer-nav a .drawer-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.drawer-nav a .drawer-icon svg {
  width: 20px;
  height: 20px;
}
.menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(10, 22, 38, 0.05);
  border: 1px solid rgba(13, 26, 46, 0.1);
  border-radius: 8px;
  color: #3b82f6;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-btn:active { background: rgba(59, 130, 246, 0.1); }
.menu-btn svg { width: 20px; height: 20px; }

/* ---- Toolbar hidden ---- */
.toolbar-hidden .app-header { display: none; }

/* ============================================
  AdX Anchor Ad — force fixed position
  ADX 后台通常无法直接设置广告 iframe 的 position 属性，
  因此通过项目 CSS 强制覆盖 GPT 注入的样式。
  ============================================ */
ins[id^="gpt_unit_"] {
  position: fixed !important;
}

.iframe-center div[id^="google_ads_iframe_"] {
  display: flex;
  justify-content: center;
  align-items: center;
}
