/* ============================================
   Demo7 — Space Sci-Fi 风格 (太空科幻)
   主题: 星际航行、星云、未来科技、飞船
   ============================================ */

/* ---- 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: #0b1a2e;
  font-family: 'Torus', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #dbe6ff;
}
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 20% 30%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.03) 0%, transparent 60%),
    linear-gradient(180deg, #0b1a2e 0%, #0b1a2e 50%, #0b1a2e 100%);
  z-index: -1;
  pointer-events: none;
}

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

/* ---- 太空顶部栏 ---- */
.gh-topbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(42, 63, 96, 0.15);
  background: rgba(11, 26, 46, 0.9);
  backdrop-filter: blur(10px);
}
.gh-topbar-item {
  flex: 1;
  text-align: center;
  padding: 9px 4px;
  border: 1px solid rgba(42, 63, 96, 0.15);
  border-radius: 8px;
  font-size: 13px;
  background: rgba(11, 26, 46, 0.8);
  color: #dbe6ff;
  letter-spacing: 0.5px;
}
.gh-topbar-item.gh-brand {
  font-weight: 700;
  color: #dbe6ff;
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(42, 63, 96, 0.3);
  text-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

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

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

/* ---- 太空分区标题 ---- */
.gh-section { margin: 0 12px 12px; }
.gh-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.gh-section-title {
  display: inline-block;
  font-size: 11px;
  height: 32px;
  line-height: 32px;
  border: 1px solid rgba(42, 63, 96, 0.2);
  border-radius: 8px;
  padding: 0px 12px;
  background: rgba(11, 26, 46, 0.6);
  color: #dbe6ff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---- 太空大图+双小图组合 ---- */
.gh-combo { display: flex; gap: 8px; }
.gh-combo-main {
  flex: 1 1 55%;
  border: 1px solid rgba(42, 63, 96, 0.15);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(11, 26, 46, 0.6);
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}
.gh-combo-main:active {
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.2);
}
.gh-combo-main .gh-card-thumb { width: 100%; aspect-ratio: 1/1; background: #16294a; flex: 0 0 auto; }
.gh-combo-main .gh-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gh-combo-main .gh-card-name { font-size: 12px; padding: 6px 8px 8px; color: #dbe6ff; }

.gh-combo-side { flex: 1 1 45%; display: flex; flex-direction: column; gap: 8px; }
.gh-combo-side .gh-card {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(42, 63, 96, 0.15);
  border-radius: 10px;
  overflow: hidden;
  flex: 1;
  background: #16294a;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}
.gh-combo-side .gh-card:active {
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.15);
}
.gh-combo-side .gh-card-thumb { width: 100%; aspect-ratio: 16/10; background: #16294a; flex: 0 0 auto; }
.gh-combo-side .gh-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gh-combo-side .gh-card-name { font-size: 11px; padding: 4px 6px 6px; color: #dbe6ff; }

/* ---- 太空查看更多 ---- */
.gh-more-col {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  flex: 0 0 28px;
  border: 1px solid rgba(42, 63, 96, 0.2);
  border-radius: 8px;
  background: rgba(29, 53, 87, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #dbe6ff;
  transition: all 0.2s ease;
}
.gh-more-col:active {
  background: rgba(37, 99, 235, 0.1);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.15);
}

.gh-more-row {
  display: flex;
  justify-content: flex-end;

  background: #1d3557;}
.gh-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #2a3f60;
  border-radius: 8px;
  background: #1d3557;
  color: #dbe6ff;
  transition: all 0.2s ease;
}
.gh-more-btn:active {
  background: #1d3557;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.15);
}

/* ---- 太空底部 ---- */
.gh-footer {
  text-align: center;
  font-size: 12px;
  color: rgba(37, 99, 235, 0.4);
  padding: 14px 12px;
  border-top: 1px solid rgba(42, 63, 96, 0.1);
  background: rgba(11, 26, 46, 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: 1px solid rgba(42, 63, 96, 0.15); border-radius: 8px; padding: 8px 4px 10px; background: #16294a; }
#search-result .gh-card-thumb { width: 100%; aspect-ratio: 1/1; border-radius: 6px; overflow: hidden; background: #16294a; }
#search-result .gh-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
#search-result .gh-card-name { font-size: 12px; text-align: center; color: #dbe6ff; }
.gh-empty { text-align: center; color: rgba(37, 99, 235, 0.4); font-size: 13px; padding: 20px 0; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0b1a2e; }
::-webkit-scrollbar-thumb { background: rgba(37, 99, 235, 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(42, 63, 96, 0.06);
  background: rgba(11, 26, 46, 0.9);
  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: #dbe6ff;
  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: #dbe6ff;
}
.search-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #dbe6ff;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid #2a3f60;
  border-radius: 20px;
  background: #1d3557;
}
.search-trigger:active { background: #1d3557; }

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


/* ---- Masonry / Search results grid ---- */
.masonry-grid {
  display: flex;
  gap: 10px;
  padding: 0 12px;
}
.masonry-grid.index-grid {
  padding: 0;
}
.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;
}
/* 首页grid卡片正方形 */
#sec1-grid .gh-card-thumb,
#sec2-grid .gh-card-thumb,
#sec3-grid .gh-card-thumb {
  aspect-ratio: 1/1;
}
.masonry-grid .gh-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* ---- Loading indicator ---- */
.gh-load-indicator {
  text-align: center;
  color: #dbe6ff;
  font-size: 13px;
  padding: 16px 12px;
}
.gh-reached-bottom {
  color: #dbe6ff;
  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: #0b1a2e;
  border-right: 1px solid rgba(42, 63, 96, 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(42, 63, 96, 0.1);
  margin-bottom: 8px;
}
.drawer-header span {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, #2563eb, #2563eb);
  -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: #dbe6ff;
  cursor: pointer;
  background: #1d3557;
  border: 1px solid #2a3f60;
  border-radius: 8px;
}
.drawer-close:active { background: #1d3557; }
.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: #dbe6ff;
  transition: background 0.15s ease;
  text-decoration: none;
}
.drawer-nav a:hover,
.drawer-nav a:active {
  background: rgba(37, 99, 235, 0.08);
  color: #dbe6ff;
}
.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: #1d3557;
  border: 1px solid #2a3f60;
  border-radius: 8px;
  color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-btn:active { background: #1d3557; }
.menu-btn svg { width: 20px; height: 20px; }

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