/* ============================================
   Demo9 — Dark Dungeon RPG 风格 (暗黑地牢RPG)
   主题: 暗黑地牢、RPG冒险、史诗战斗、魔法符文
   ============================================ */

/* ---- 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;
  background: #0a0a0e;
  font-family: 'Torus', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #e4e4e7;
}
a { text-decoration: none; color: inherit; }
input { font-family: 'Torus'; }
img { display: block; max-width: 100%; }

/* ---- 暗黑地牢背景 ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(113, 113, 122, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 30% 100%, rgba(10, 10, 14, 0.05) 0%, transparent 50%),
    linear-gradient(180deg, #0a0a0e 0%, #0a0a0e 50%, #0a0a0e 100%);
  z-index: -1;
  pointer-events: none;
}

.gh-page {
  max-width: 480px;
  margin: 0 auto;
  background: rgba(10, 10, 14, 0.97);
  min-height: 100vh;
  position: relative;
}

/* ---- 地牢顶部栏 ---- */
.gh-search-bar {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(20, 20, 30, 0.15);
  background: rgba(10, 10, 14, 0.95);
  backdrop-filter: blur(10px);
}
.gh-search-bar input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid rgba(20, 20, 30, 0.2);
  border-radius: 20px;
  font-size: 13px;
  background: rgba(10, 10, 14, 0.8);
  color: #e4e4e7;
}
.gh-search-bar input::placeholder { color: rgba(228, 228, 231, 0.4); }

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

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

/* ---- 地牢分区 ---- */
.gh-section { margin: 0 12px 16px; }
.gh-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.gh-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #e4e4e7;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  padding-left: 12px;
}
.gh-section-title::before {
  content: "◆";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #71717a;
  font-size: 8px;
}
.gh-section-more {
  font-size: 12px;
  color: #e4e4e7;
  border: 1px solid rgba(20, 20, 30, 0.2);
  border-radius: 6px;
  padding: 4px 10px;
  background: rgba(14, 14, 18, 0.5);
  transition: all 0.2s ease;
}
.gh-section-more:active {
  background: rgba(113, 113, 122, 0.1);
  box-shadow: 0 0 8px rgba(113, 113, 122, 0.15);
}

/* ---- 地牢游戏网格 ---- */
.gh-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.gh-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(20, 20, 30, 0.15);
  border-radius: 10px;
  background: rgba(10, 10, 14, 0.6);
  backdrop-filter: blur(5px);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.gh-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(113, 113, 122, 0.2);
}
.gh-card:active {
  transform: scale(0.97);
  box-shadow: 0 0 15px rgba(113, 113, 122, 0.15);
}
.gh-card-thumb { width: 100%; aspect-ratio: 1/1; border-radius: 8px; overflow: hidden; background: #0a0a0e; border: 1px solid rgba(20, 20, 30, 0.1); }
.gh-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gh-card-name { font-size: 12px; text-align: center; color: #e4e4e7; line-height: 1.3; }

/* ---- 地牢底部 ---- */
.gh-footer {
  text-align: center;
  font-size: 12px;
  color: rgba(228, 228, 231, 0.4);
  padding: 14px 12px;
  border-top: 1px solid rgba(20, 20, 30, 0.1);
  background: rgba(10, 10, 14, 0.5);
}

#search-result { display: none; margin: 0 12px 12px; }
#search-result.gh-active { display: block; }
.gh-empty { text-align: center; color: rgba(228, 228, 231, 0.4); font-size: 13px; padding: 20px 0; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0a0a0e; }
::-webkit-scrollbar-thumb { background: rgba(113, 113, 122, 0.3); border-radius: 2px; }

/* ---- Unified App Header ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(20, 20, 30, 0.06);
  background: rgba(10, 10, 14, 0.95);
  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: #e4e4e7;
  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: #e4e4e7;

  background: #0e0e12;}
.search-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #e4e4e7;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(20, 20, 30, 0.1);
  border-radius: 20px;
  background: rgba(14, 14, 18, 0.03);
}
.search-trigger:active { background: rgba(14, 14, 18, 0.06); }

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


/* ---- 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 {
  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: #e4e4e7;
  font-size: 13px;
  padding: 16px 12px;
}
.gh-reached-bottom {
  color: #e4e4e7;
  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: #0a0a0e;
  border-right: 1px solid rgba(20, 20, 30, 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(20, 20, 30, 0.1);
  margin-bottom: 8px;
}
.drawer-header span {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, #71717a, #71717a);
  -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: #e4e4e7;
  cursor: pointer;
  background: rgba(14, 14, 18, 0.05);
  border: 1px solid rgba(20, 20, 30, 0.1);
  border-radius: 8px;
}
.drawer-close:active { background: rgba(113, 113, 122, 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: #e4e4e7;
  transition: background 0.15s ease;
  text-decoration: none;
}
.drawer-nav a:hover,
.drawer-nav a:active {
  background: rgba(113, 113, 122, 0.08);
  color: #e4e4e7;
}
.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(14, 14, 18, 0.05);
  border: 1px solid rgba(20, 20, 30, 0.1);
  border-radius: 8px;
  color: #71717a;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-btn:active { background: rgba(113, 113, 122, 0.1); }
.menu-btn svg { width: 20px; height: 20px; }

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