/* ===== Reset & Variables ===== */
:root {
  --bg: #0d0d1a;
  --sidebar-bg: #111122;
  --card-bg: #1a1a30;
  --accent: #7c6ff7;
  --accent2: #00ddaa;
  --text: #e8e8f0;
  --text-muted: #9090aa;
  --border: #252540;
  --ad-bg: #151528;
  --ad-border: #2a2a45;
  --tag-new: #00ddaa;
  --tag-hot: #ff6b6b;
  --star: #ffb347;
  --sidebar-width: 160px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== Top Nav ===== */
.top-nav {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(13,13,26,0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.top-nav .logo {
  font-size: 1.35rem; font-weight: 800; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  text-decoration: none; color: inherit; display: inline-block;
}
.top-nav .nav-right {
  display: flex; align-items: center; gap: 16px;
}
.top-nav .update-badge {
  font-size: 0.75rem; background: rgba(0,221,170,0.15);
  color: var(--accent2); padding: 4px 10px; border-radius: 12px;
  display: flex; align-items: center; gap: 5px;
}
.update-badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent2);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; } 50% { opacity: 0.3; }
}

/* ===== Language Switcher ===== */
.lang-switcher { position: relative; }
.lang-switcher::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  height: 10px;
}
.lang-btn {
  background: rgba(255,255,255,0.06); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font-size: 0.85rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}
.lang-btn:hover, .lang-switcher:hover .lang-btn { background: rgba(255,255,255,0.12); }
.lang-btn .arrow { font-size: 0.7rem; opacity: 0.7;
                   transition: transform 0.15s; }
.lang-switcher:hover .lang-btn .arrow { transform: rotate(180deg); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #1a1a30; border: 1px solid var(--border);
  border-radius: 10px; min-width: 180px; padding: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  display: block; opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  z-index: 1100;
}
.lang-switcher:hover .lang-menu,
.lang-menu:hover {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
}
.lang-menu a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-radius: 6px; color: var(--text);
  text-decoration: none; font-size: 0.88rem; cursor: pointer;
}
.lang-menu a:hover { background: rgba(124,111,247,0.15); }
.lang-menu a.active { color: var(--accent2); font-weight: 700; }
.lang-menu a .check { color: var(--accent2); }

/* ===== Layout: Homepage ===== */
.home-layout {
  display: flex; max-width: 1440px; margin: 0 auto; padding: 16px 8px;
  min-height: calc(100vh - 56px);
}
/* Sidebar Ads */
.ad-sidebar {
  width: var(--sidebar-width); flex-shrink: 0;
  padding: 8px; display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 72px; align-self: flex-start; max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.ad-sidebar.left-ads { order: 1; }
.ad-sidebar.right { order: 4; }

.ad-slot {
  background: var(--ad-bg); border: 1px dashed var(--ad-border);
  border-radius: 10px; text-align: center; padding: 12px 6px;
  font-size: 0.7rem; color: var(--text-muted);
  min-height: 120px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
}
.ad-slot .ad-label {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px;
  color: #555;
}
.ad-slot.ad-slot--filled {
  border-style: solid; background: transparent; padding: 4px;
}
.ad-slot .ad-placeholder {
  width: 100%; height: 100px; background: rgba(255,255,255,0.03);
  border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-size: 0.75rem;
}
/* Main Content */
.main-content {
  flex: 1; order: 3; padding: 0 16px; min-width: 0;
}

/* ===== Hero ===== */
.hero-bar {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(124,111,247,0.25);
  border-radius: 16px;
  padding: 26px 24px;
  margin-bottom: 20px;
  text-align: center;
  /* 深色基底 + 多色径向光晕，让品牌色真正"亮"起来 */
  background:
    radial-gradient(ellipse 60% 80% at 12% 50%, rgba(124,111,247,0.45) 0%, transparent 60%),
    radial-gradient(ellipse 50% 70% at 88% 50%, rgba(0,221,170,0.32) 0%, transparent 60%),
    radial-gradient(circle at 50% 120%, rgba(255,107,107,0.18) 0%, transparent 55%),
    linear-gradient(135deg, #1a1638 0%, #14132e 50%, #0f2235 100%);
  box-shadow: 0 6px 28px rgba(124,111,247,0.18), inset 0 1px 0 rgba(255,255,255,0.04);
}
/* 装饰性点状纹理（增加质感，不喧宾夺主） */
.hero-bar::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
  opacity: 0.5;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0.2));
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0.2));
}
.hero-bar h1 {
  position: relative;
  font-size: 1.55rem; font-weight: 800; letter-spacing: -0.01em;
  /* 渐变文字：白 → 淡紫，与 logo 风格一致 */
  background: linear-gradient(135deg, #ffffff 0%, #d8c9ff 60%, #b8e8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-bar p {
  position: relative;
  font-size: 0.9rem;
  color: rgba(232,232,240,0.78);
  margin-top: 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ===== Category Sidebar ===== */
.category-sidebar {
  width: 190px; flex-shrink: 0; order: 2;
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 72px; align-self: flex-start;
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.category-sidebar .cat-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px;
  color: #555; padding: 4px 8px; margin-bottom: 4px;
}
.category-sidebar button {
  display: block; width: 100%; text-align: left;
  background: var(--card-bg); border: 1px solid var(--border);
  color: var(--text-muted); padding: 9px 14px; border-radius: 8px;
  font-size: 0.82rem; cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.category-sidebar button:hover { border-color: var(--accent); color: var(--text); }
.category-sidebar button.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 600;
}
.category-sidebar .cat-count {
  float: right; font-size: 0.7rem; opacity: 0.7;
}
.category-sidebar .cat-icon {
  display: inline-block; width: 22px; text-align: center; margin-right: 2px;
}

/* ===== Top Banner Ad ===== */
.top-banner-ad {
  background: var(--ad-bg); border: 1px dashed var(--ad-border);
  border-radius: 10px; padding: 14px; text-align: center;
  margin-bottom: 20px; font-size: 0.75rem; color: var(--text-muted);
}
.top-banner-ad .ad-placeholder {
  height: 60px; background: rgba(255,255,255,0.02);
  border-radius: 6px; display: flex; align-items: center;
  justify-content: center;
}

/* ===== Game Grid ===== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.game-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: block; color: inherit; text-decoration: none;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(124,111,247,0.15);
  text-decoration: none;
}
.game-card .thumb {
  width: 100%; height: 130px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1a1a35, #222240);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
}
.game-card .thumb.cover {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.game-card .thumb .game-emoji { opacity: 0.85; }
.game-card .thumb .tag {
  position: absolute; top: 8px; right: 8px;
  font-size: 0.65rem; padding: 2px 8px; border-radius: 10px;
  font-weight: 700; color: #fff;
}
.tag-new  { background: var(--tag-new); }
.tag-hot  { background: var(--tag-hot); }
.game-card .thumb .source {
  position: absolute; bottom: 6px; left: 8px;
  font-size: 0.6rem; background: rgba(0,0,0,0.55);
  color: #ccc; padding: 2px 7px; border-radius: 6px;
}
.game-card .info { padding: 10px 12px 12px; }
.game-card .info h3 {
  font-size: 0.9rem; font-weight: 600; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-card .info .meta {
  font-size: 0.72rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.game-card .info .meta .star { color: var(--star); }

/* ===== Footer ===== */
.site-footer {
  text-align: center; padding: 24px; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.8rem; margin-top: 40px;
}

/* ===== Category Intro（SEO） ===== */
.category-intro {
  max-width: 1100px; margin: 40px auto; padding: 0 20px;
}
.category-intro .intro-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.category-intro .intro-item {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px;
  transition: border-color 0.2s;
}
.category-intro .intro-item:hover { border-color: var(--accent); }
.category-intro .intro-item h3 {
  font-size: 1rem; margin-bottom: 6px;
}
.category-intro .intro-item h3 a {
  color: var(--accent); text-decoration: none;
}
.category-intro .intro-item h3 a:hover { text-decoration: underline; }
.category-intro .intro-item p {
  font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin: 0;
}

/* ===== Hidden ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
.mobile-cat-strip {
  display: none; overflow-x: auto; white-space: nowrap;
  padding: 8px 0; margin-bottom: 14px; gap: 6px;
}
.mobile-cat-strip button {
  display: inline-block; flex-shrink: 0;
  background: var(--card-bg); border: 1px solid var(--border);
  color: var(--text-muted); padding: 7px 16px; border-radius: 20px;
  font-size: 0.82rem; cursor: pointer; margin-right: 6px;
}
.mobile-cat-strip button.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
@media (max-width: 1200px) {
  .ad-sidebar { width: 120px; }
  .category-sidebar { width: 140px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 900px) {
  .ad-sidebar { display: none; }
  .category-sidebar { display: none; }
  .mobile-cat-strip { display: flex; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .top-banner-ad { display: none !important; }
}
@media (max-width: 500px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .game-card .thumb { height: 100px; }
  .game-card .info h3 { font-size: 0.8rem; }
  .hero-bar { padding: 20px 16px; }
  .hero-bar h1 { font-size: 1.2rem; }
  .category-intro .intro-grid { grid-template-columns: 1fr; }
}
