/* 游戏乐园 PlayHub — 深色主题 */
:root {
  --bg: #14121f;
  --bg-soft: #1c1930;
  --card: #241f3d;
  --card-hover: #2e2850;
  --line: #322b52;
  --text: #f0eef8;
  --text-dim: #a49cc4;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --hot: #f59e0b;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent-2); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px;
  background: rgba(20,18,31,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; color: var(--text); white-space: nowrap; }
.logo-icon { font-size: 24px; }
.logo-text em { font-style: normal; color: var(--accent); }
.search-wrap {
  flex: 1; max-width: 560px; position: relative;
  display: flex; align-items: center;
}
.search-ico { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--text-dim); pointer-events: none; }
#searchInput {
  width: 100%; padding: 10px 38px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text);
  font-size: 14px; outline: none; transition: border-color .2s;
}
#searchInput:focus { border-color: var(--accent); }
#searchInput::placeholder { color: var(--text-dim); }
.search-clear {
  position: absolute; right: 10px; border: none; background: none;
  color: var(--text-dim); font-size: 14px; padding: 4px;
}
.fav-top {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 14px; white-space: nowrap;
  transition: all .2s;
}
.fav-top:hover { border-color: var(--hot); color: var(--hot); }
.fav-count { color: var(--hot); font-weight: 700; }

/* ---------- 分类条 ---------- */
.catbar {
  position: sticky; top: 57px; z-index: 40;
  display: flex; gap: 8px; overflow-x: auto;
  padding: 10px 22px; background: rgba(20,18,31,.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.catbar::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text-dim);
  padding: 7px 16px; border-radius: 999px; font-size: 13px; white-space: nowrap;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---------- 主区 ---------- */
.main { max-width: 1280px; margin: 0 auto; padding: 20px 22px 60px; }
.section { margin-bottom: 34px; }
.section-title { font-size: 19px; margin-bottom: 14px; display: flex; align-items: baseline; gap: 10px; }
.section-sub { font-size: 13px; color: var(--text-dim); font-weight: 400; }

/* 热门横滚 */
.hot-row {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.hot-row::-webkit-scrollbar { height: 8px; }
.hot-row::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.hot-card {
  flex: 0 0 220px; scroll-snap-align: start;
  border-radius: var(--radius); overflow: hidden; position: relative;
  background: var(--card); border: 1px solid var(--line);
  transition: transform .18s, box-shadow .18s; cursor: pointer;
}
.hot-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.hot-card .thumb { width: 100%; height: 165px; }
.hot-card .hot-rank {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--hot); color: #1a1206; font-weight: 800; font-size: 12px;
  padding: 2px 9px; border-radius: 999px;
}

/* 网格 */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.card {
  border-radius: var(--radius); overflow: hidden; background: var(--card);
  border: 1px solid var(--line); cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.thumb {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--bg-soft);
}
.thumb-fallback {
  width: 100%; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; color: rgba(255,255,255,.85);
}
.card-meta { padding: 9px 11px 11px; }
.card-title {
  font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-sub { font-size: 11px; color: var(--text-dim); margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.card-fav {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.55); color: #fff; font-size: 15px; line-height: 1;
  opacity: 0; transition: opacity .15s; backdrop-filter: blur(4px);
}
.card { position: relative; }
.card:hover .card-fav, .card-fav.on { opacity: 1; }
.card-fav.on { color: var(--hot); }

.load-more-wrap { text-align: center; margin-top: 22px; }
.load-more {
  background: var(--bg-soft); color: var(--text); border: 1px solid var(--line);
  padding: 11px 34px; border-radius: 999px; font-size: 14px; transition: all .2s;
}
.load-more:hover { border-color: var(--accent); color: var(--accent); }
.load-more[hidden] { display: none; }

/* ---------- 游戏弹层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10,8,18,.86); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.overlay[hidden] { display: none; }
.player {
  width: min(1100px, 100%); max-height: 96vh;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 18px; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow);
}
.player-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.player-close, .player-fav, .player-full {
  border: none; background: var(--card); color: var(--text);
  width: 36px; height: 36px; border-radius: 10px; font-size: 16px; transition: all .15s;
}
.player-close:hover { background: #e5484d; color: #fff; }
.player-fav.on, .player-fav:hover { color: var(--hot); }
.player-title { flex: 1; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage { position: relative; background: #000; aspect-ratio: 16 / 9; max-height: 62vh; }
#gameFrame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: none; background: #000; }
#gameFrame.show { display: block; }
.stage-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; color: var(--text-dim);
}
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.stage-hint { font-size: 12px; opacity: .7; }
.player-meta { padding: 14px 16px 16px; overflow-y: auto; }
.player-desc { font-size: 13.5px; color: var(--text-dim); line-height: 1.7; }
.player-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-size: 12px; color: var(--accent-2); background: rgba(34,211,238,.08);
  border: 1px solid rgba(34,211,238,.25); padding: 3px 11px; border-radius: 999px;
}
.similar { margin-top: 16px; }
.similar h3 { font-size: 14px; margin-bottom: 10px; color: var(--text); }
.similar-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.similar-card {
  flex: 0 0 110px; border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); transition: transform .15s;
}
.similar-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.similar-card .thumb { aspect-ratio: 1/1; }
.similar-card .card-title { font-size: 11px; padding: 6px 8px; }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--line); padding: 26px 22px 34px;
  text-align: center; font-size: 12.5px; color: var(--text-dim); line-height: 1.9;
}
.footer b { color: var(--text); }

/* ---------- standalone game page (Poki-style) ---------- */
.game-page { max-width: 1280px; }
.breadcrumb { font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }
.breadcrumb a { color: var(--accent-2); }
.breadcrumb span { color: var(--text); }
.game-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px;
  align-items: start;
}
.player.solo { width: 100%; margin: 0; }
.game-about { margin-top: 18px; }
.game-about h1 { font-size: 24px; margin-bottom: 10px; }
.game-about .player-desc { max-width: 860px; }
.player-src { margin-top: 10px; font-size: 12.5px; color: var(--text-dim); }
.game-side {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; position: sticky; top: 70px;
}
.side-title { font-size: 15px; margin-bottom: 12px; }
.side-list { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; padding-right: 4px; }
.side-list::-webkit-scrollbar { width: 6px; }
.side-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.side-item {
  display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; column-gap: 10px;
  align-items: center; padding: 6px; border-radius: 10px; color: var(--text);
  transition: background .15s;
}
.side-item:hover { background: var(--card); }
.side-thumb { grid-row: 1 / 3; width: 64px; height: 48px; object-fit: cover; border-radius: 8px; background: var(--card); }
.side-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-cat { font-size: 11px; color: var(--text-dim); }
@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .game-side { position: static; }
  .side-list { max-height: none; flex-direction: row; flex-wrap: wrap; }
  .side-item { flex: 0 0 46%; display: block; }
  .side-thumb { width: 100%; height: auto; aspect-ratio: 4/3; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .catbar { top: 100px; padding: 8px 12px; }
  .main { padding: 14px 12px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
  .hot-card { flex-basis: 168px; }
  .hot-card .thumb { height: 126px; }
  .stage { aspect-ratio: auto; height: 56vh; }
  .fav-top { padding: 8px 12px; font-size: 13px; }
}

/* ---------- login ---------- */
.login-btn {
  background: linear-gradient(135deg, #7c3aed, #5636c7); color: #fff; border: none;
  padding: 9px 18px; border-radius: 20px; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.login-btn:hover { filter: brightness(1.12); }
.login-modal {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 26px 22px; width: min(380px, 92vw); position: relative; margin: auto;
}
.login-modal h3 { font-size: 20px; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }
.login-options { display: flex; flex-direction: column; gap: 10px; }
.login-opt {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.login-opt:hover { background: var(--card-2, rgba(255,255,255,.06)); }
.login-opt .po { width: 18px; height: 18px; border-radius: 4px; display: inline-block; }
.login-opt.apple .po { background: conic-gradient(#fff 0 25%, #ddd 0 50%, #fff 0 75%, #ddd 0); }
.login-opt.google .po { background: conic-gradient(#ea4335 0 25%, #4285f4 0 50%, #34a853 0 75%, #fbbc05 0); border-radius: 50%; }
.login-opt.microsoft .po { background: conic-gradient(#f25022 0 25%, #7fba00 0 50%, #00a4ef 0 75%, #ffb900 0); }
.login-opt.passkey .po { background: linear-gradient(135deg, #7c3aed, #0891b2); border-radius: 50%; }
.login-note { font-size: 11.5px; color: var(--text-dim); margin-top: 14px; line-height: 1.5; }
.login-note a { color: var(--accent, #a78bfa); }

/* ---------- site footer (Poki-style bottom nav) ---------- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 30px; padding: 26px 5vw 18px;
  background: var(--bg-soft);
}
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 24px; }
.footer-col h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: 10px; }
.footer-links { display: flex; flex-direction: column; gap: 7px; }
.footer-links a, .footer-links span { color: var(--text); font-size: 13.5px; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-brand p { margin-top: 10px; font-size: 12.5px; color: var(--text-dim); line-height: 1.6; max-width: 260px; }
.footer-base {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-dim);
}
@media (max-width: 640px) { .footer-cols { grid-template-columns: 1fr 1fr; } }

/* ---------- ad slots ---------- */
.ad-slot { margin: 18px auto; max-width: 980px; min-height: 90px; }
.ad-label { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px; }
.home-ad { max-width: 100%; }

/* ---------- section-more ---------- */
.section-more {
  float: right; font-size: 13px; font-weight: 600; color: var(--accent, #a78bfa);
  text-decoration: none;
}
.section-more:hover { text-decoration: underline; }

/* ---------- blog ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 18px; }
.blog-card {
  display: flex; flex-direction: column; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; color: var(--text); text-decoration: none; transition: transform .15s;
}
.blog-card:hover { transform: translateY(-3px); }
.blog-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--card); }
.blog-card-body { padding: 14px 16px 16px; }
.blog-card-body h2 { font-size: 16px; line-height: 1.35; margin-bottom: 8px; }
.blog-card-body p { font-size: 13px; color: var(--text-dim); line-height: 1.55; }
.blog-date { font-size: 11.5px; color: var(--text-dim); margin-top: 10px; display: block; }
.blog-post { max-width: 780px; margin: 0 auto; display: block; }
.blog-post article h1 { font-size: 26px; line-height: 1.3; margin-bottom: 6px; }
.blog-post article h2 { font-size: 19px; margin: 22px 0 8px; }
.blog-post article h3 { font-size: 16px; margin: 16px 0 6px; }
.blog-post article p { font-size: 14.5px; line-height: 1.7; color: var(--text); margin: 8px 0; }
.blog-picks { max-height: none; flex-direction: row; flex-wrap: wrap; }
.blog-picks .side-item { flex: 0 0 48%; display: block; }
.blog-picks .side-thumb { width: 100%; height: auto; aspect-ratio: 4/3; grid-row: auto; margin-bottom: 6px; }
.blog-side { position: static; margin-top: 24px; }
.btn-link { color: var(--accent, #a78bfa); font-weight: 600; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }

/* ---------- content pages (privacy/terms/...) ---------- */
.content-page { max-width: 780px; margin: 0 auto; display: block; }
.content-page h1 { font-size: 26px; margin-bottom: 4px; }
.content-page h2 { font-size: 18px; margin: 22px 0 8px; }
.content-page p, .content-page li { font-size: 14.5px; line-height: 1.75; color: var(--text); }
.content-page ul { padding-left: 22px; margin: 8px 0; }
.content-page a { color: var(--accent, #a78bfa); }
.content-updated { font-size: 12.5px; color: var(--text-dim); margin-bottom: 18px; }
