/* ============================================
   Demo6 — Pixel Retro 风格 (像素游戏复古)
   主题: 8-bit像素、复古游戏机、CRT显示器、经典街机
   ============================================ */

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

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  -webkit-touch-callout: none;
  background: #031c24;
  font-family: 'Torus', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #dff6ff;
}
a { text-decoration: none; color: inherit; }
input { font-family: 'Torus'; }
img { display: block; max-width: 100%; }

/* ---- 像素复古背景 ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.15) 0px,
      rgba(0, 0, 0, 0.15) 1px,
      transparent 1px,
      transparent 2px
    ),
    linear-gradient(180deg, #031c24 0%, #031c24 50%, #031c24 100%);
  z-index: -1;
  pointer-events: none;
}

.gh-page { max-width: 480px; margin: 0 auto; background: rgba(3, 28, 36, 0.95); min-height: 100vh; position: relative; }

/* ---- 像素顶部栏 ---- */
.gh-topbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 2px solid #12485c;
  background: rgba(3, 28, 36, 0.95);
}
.gh-topbar-item {
  flex: 1;
  text-align: center;
  padding: 9px 4px;
  border: 2px solid #12485c;
  border-radius: 0;
  font-size: 13px;
  background: #031c24;
  color: #0a8fc4;
  text-transform: uppercase;
  letter-spacing: 1px;
  image-rendering: pixelated;
}
.gh-topbar-item.gh-brand {
  font-weight: 700;
  color: #dff6ff;
  background: #0a8fc4;
  border-color: #12485c;
  text-shadow: 2px 2px 0px rgba(18, 72, 92, 0.3);
}

/* ---- 像素广告位 ---- */
.gh-ad {
  margin: 0 auto;
  width: 100%;
  text-align: center;
}

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

/* ---- 像素药丸分类 ---- */
.gh-pill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px;
}
.gh-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2px solid #12485c;
  border-radius: 0;
  padding: 4px;
  background: #0d3d52;
  transition: all 0.1s ease;
}
.gh-pill:active {
  transform: translate(2px, 2px);
  box-shadow: -2px -2px 0 #0a8fc4;
}
.gh-pill-icon {
  width: 100%;
  height: auto;
  border-radius: 0;
  object-fit: contain;
  background: #0d3d52;
  image-rendering: pixelated;
}
.gh-pill-name { display: none !important; 
  background: #0d3d52;}

/* ---- 像素底部 ---- */
.gh-footer {
  text-align: center;
  font-size: 12px;
  color: rgba(10, 143, 196, 0.5);
  padding: 14px 12px;
  border-top: 2px solid #12485c;
  background: rgba(3, 28, 36, 0.5);
}

#search-result { display: none; margin: 0 12px 12px; }
#search-result.gh-active { display: block; }
#search-result .gh-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}
#search-result .gh-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2px solid #12485c;
  border-radius: 0;
  padding: 8px 4px 10px;
  background: #0a3040;
}
#search-result .gh-card-thumb { width: 100%; aspect-ratio: 1/1; border-radius: 0; overflow: hidden; background: #0a3040; }
#search-result .gh-card-thumb img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
#search-result .gh-card-name { font-size: 12px; text-align: center; color: #dff6ff; font-weight: 700; }
.gh-empty { text-align: center; color: rgba(10, 143, 196, 0.5); font-size: 13px; padding: 20px 0; }

/* 像素滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #031c24; }
::-webkit-scrollbar-thumb { background: #0a8fc4; border-radius: 0; }

/* ---- Unified App Header ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(18, 72, 92, 0.06);
  background: #031c24;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header #catTitle {
  margin: 0;
  font-size: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #0a8fc4;
  text-decoration: none;
}
.brand-icon {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}
.cancel-btn {
  color: #dff6ff;
}
.search-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #0a8fc4;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid #12485c;
  border-radius: 20px;
  background: #0d3d52;
}
.search-trigger:active { background: #0d3d52; }

/* ---- Hide card names, remove borders ---- */
.gh-card-name { display: none !important; }
.gh-card, .gh-masonry .gh-card {
  border: none !important;
  background: #0a3040;
}


/* ---- Masonry / Search results grid ---- */
.masonry-grid {
  display: flex;
  gap: 10px;
  padding: 0 12px;
}
.masonry-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.masonry-grid .gh-card {
  margin-bottom: 0;
  width: 100%;
  height: auto;
}
.masonry-grid .gh-card-thumb {
  display: block;
  width: 100%;
  aspect-ratio: auto;
  height: auto;
  border-radius: 10px;
  overflow: hidden;
}
.masonry-grid .gh-card-thumb img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}
/* ---- Loading indicator ---- */
.gh-load-indicator {
  text-align: center;
  color: #dff6ff;
  font-size: 13px;
  padding: 16px 12px;
}
.gh-reached-bottom {
  color: #dff6ff;
  font-style: italic;
}

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

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

.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: #031c24;
  border-right: 1px solid rgba(18, 72, 92, 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(18, 72, 92, 0.1);
  margin-bottom: 8px;
}
.drawer-header span {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, #0a8fc4, #0a8fc4);
  -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: #dff6ff;
  cursor: pointer;
  background: #0d3d52;
  border: 1px solid #12485c;
  border-radius: 8px;
}
.drawer-close:active { background: #0d3d52; }
.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: #dff6ff;
  transition: background 0.15s ease;
  text-decoration: none;
}
.drawer-nav a:hover,
.drawer-nav a:active {
  background: rgba(10, 143, 196, 0.08);
  color: #dff6ff;
}
.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: #0d3d52;
  border: 1px solid #12485c;
  border-radius: 8px;
  color: #0a8fc4;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-btn:active { background: #0d3d52; }
.menu-btn svg { width: 20px; height: 20px; }

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