:root {
  --bg: #101014;
  --surface: #1b1b22;
  --surface-2: #24242e;
  --text: #f2f3f7;
  --text-dim: #9aa0ad;
  --primary: #ff7847;
  --primary-soft: rgba(255, 120, 71, .15);
  --violet: #6c5ce7;
  --border: #2c2c38;
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(16, 16, 20, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: none;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-right: auto; }
.menu-btn { display: none; }
@media (max-width: 1023px) { .menu-btn { display: flex; } }

.logo { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.logo-icon { display: block; border-radius: 9px; }
.logo-text { font-size: 21px; font-weight: 800; letter-spacing: -.5px; }
.logo-text em { font-style: normal; color: var(--primary); }

.searchbox {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--text-dim);
  transition: border-color .15s;
}
.searchbox:focus-within { border-color: var(--primary); }
.searchbox input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  min-width: 0;
}

.topbar-btn {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 17px;
  flex-shrink: 0;
}
.topbar-btn:active { border-color: var(--primary); color: var(--primary); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 桌面/平板：三栏网格，搜索框绝对居中 */
@media (min-width: 641px) {
  .topbar-inner {
    display: grid;
    grid-template-columns: 1fr minmax(0, 520px) 1fr;
    align-items: center;
  }
  .topbar-left { justify-self: start; margin-right: 0; }
  .searchbox { width: 100%; max-width: none; justify-self: center; }
  .topbar-actions { justify-self: end; }
}

.lang-select {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 10px;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.lang-select:hover, .lang-select:focus { border-color: var(--primary); color: var(--text); }

/* ---------- 导航 tab ---------- */
.tabs {
  max-width: none;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- 分类 chips ---------- */
.chips-wrap { border-top: 1px solid var(--border); }
.chips {
  max-width: none;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: all .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 主体 ---------- */
.container {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 16px 20px 40px;
}

/* 游戏详情页保持窄栏居中（阅读体验），首页通栏 */
.game-page { max-width: 1200px; }

.section-title {
  font-size: 20px;
  font-weight: 800;
  margin: 26px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title:first-child { margin-top: 4px; }

.empty-tip {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 0;
  font-size: 15px;
}

.load-more {
  display: block;
  margin: 18px auto 0;
  padding: 11px 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
  transition: all .15s;
}
.load-more:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 左滑抽屉菜单 ---------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 99;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 272px;
  max-width: 82vw;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 100;
  transform: translateX(-105%);
  transition: transform .25s ease;
  overflow-y: auto;
  padding: 14px 12px 20px;
  scrollbar-width: none;
}
.drawer::-webkit-scrollbar { display: none; }
.drawer.open { transform: translateX(0); }
body.drawer-lock { overflow: hidden; }

.drawer-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 11px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  text-align: left;
  transition: background .15s;
}
.drawer-item svg { color: var(--primary); flex-shrink: 0; }
.drawer-item:hover, .drawer-item:active { background: var(--surface-2); }
.drawer-item.active { color: var(--primary); }
.drawer-item .cnt { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-dim); }

.drawer-sep { height: 1px; background: var(--border); margin: 10px 6px; }

/* ---------- 左侧分类栏（桌面端） ---------- */
.side-nav { display: none; }

@media (min-width: 1024px) {
  body { padding-left: 60px; }
  .chips-wrap { display: none; }

  .side-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    padding: 12px 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 60;
  }
  .side-nav::-webkit-scrollbar { display: none; }

  .side-item {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    transition: all .15s;
  }
  .side-item svg { display: block; }
  .side-item:hover { background: var(--surface-2); color: var(--text); }
  .side-item.active { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
}

/* ---------- 精选大卡横滑区 ---------- */
.feature-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 8px;
}
.feature-strip::-webkit-scrollbar { display: none; }

.feature-card {
  position: relative;
  flex: 0 0 auto;
  width: 380px;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.feature-card .feature-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.feature-card:hover .feature-bg { transform: scale(1.04); }

.feature-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 30px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .82));
}
.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, .25);
  flex-shrink: 0;
}
.feature-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feature-count { margin-top: 1px; font-size: 12px; font-weight: 700; color: var(--primary); }
.feature-bar > div { min-width: 0; }

.view-more {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
}
.view-more:hover { color: var(--primary); }

/* ---------- 快捷横滑条 ---------- */
.quick-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 14px;
}
.quick-strip::-webkit-scrollbar { display: none; }

.quick-tile {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
}
.quick-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.quick-my {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px 9px;
  background: linear-gradient(135deg, var(--primary), #ffb347);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  border: none;
  text-align: left;
}

/* ---------- 游戏卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.grid.featured { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.game-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform .15s ease, border-color .15s ease;
  display: block;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: #3a3a48;
}

.game-card .thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.game-card .card-body { padding: 10px 12px; }
.game-card .card-title {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-card .card-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-sub .dot { width: 6px; height: 6px; border-radius: 50%; background: #34c759; display: inline-block; flex-shrink: 0; }

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}
.badge.new { background: #34c759; }
.card-thumb-wrap { position: relative; }

/* ---------- 游戏详情页 ---------- */
.game-page .player-wrap { margin-bottom: 20px; }

.player-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.player-head h1 { font-size: 20px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.back-btn {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  flex-shrink: 0;
  white-space: nowrap;
}
.back-btn:hover { color: var(--primary); }

.player-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 17px;
  color: var(--text-dim);
  transition: all .15s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn.fav-on { color: #ff4757; border-color: #ff4757; }

.player-frame {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 78vh;
  box-shadow: var(--shadow);
}
/* 竖屏游戏：按游戏自身比例（--ar 由 JS 设置），以高度为基准居中，桌面/移动视觉一致 */
.player-frame.portrait {
  aspect-ratio: var(--ar, 9 / 16);
  width: auto;
  height: min(78vh, 760px);
  max-width: 100%;
  margin: 0 auto;
}
.player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.player-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 2;
}
.player-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(6px) brightness(.45);
}
.play-btn {
  position: relative;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  padding: 14px 38px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(255, 120, 71, .45);
  transition: transform .15s;
}
.play-btn:hover { transform: scale(1.06); }

.card-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 22px;
  margin-bottom: 10px;
}
.card-panel h2 { font-size: 16px; margin: 16px 0 6px; }
.card-panel h2:first-of-type { margin-top: 12px; }
.card-panel p { font-size: 14px; color: var(--text-dim); line-height: 1.7; overflow-wrap: anywhere; }

.game-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-tag {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}

/* ---------- 原创编辑内容 ---------- */
.cat-intro {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.75;
  max-width: 900px;
  margin: -4px 0 16px;
}

.category-guide {
  padding-top: 0;
  padding-bottom: 34px;
}
.category-guide h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 16px 0 4px;
  color: var(--text);
}
.category-guide p {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.75;
  max-width: 900px;
}

#editorial p {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}

/* ---------- 静态内容页 ---------- */
.static-page { max-width: 860px; }
.static-page .card-panel { padding: 30px 34px; }
.static-page h1 { font-size: 26px; margin-bottom: 10px; }
.static-page h2 { font-size: 17px; margin: 22px 0 8px; }
.static-page p { margin-bottom: 10px; }
.static-page a { color: var(--primary); }
.page-updated { font-size: 12px !important; opacity: .8; }

@media (max-width: 640px) {
  .static-page .card-panel { padding: 20px 18px; }
  .static-page h1 { font-size: 21px; }
}

/* ---------- 页脚 ---------- */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 26px 16px;
}
.footer-links { display: flex; justify-content: center; gap: 22px; margin-bottom: 10px; }
.footer-links a { font-size: 13px; color: var(--text-dim); }
.footer-links a:hover { color: var(--primary); }
.footer-note, .footer-copy { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .topbar-inner { gap: 8px; padding: 10px 12px; }
  .logo-icon { width: 30px; height: 30px; }
  .logo-text { font-size: 17px; }

  /* 搜索框收进图标，点击展开成整行 */
  .searchbox {
    display: none;
    order: 10;
    flex-basis: 100%;
    max-width: none;
  }
  .topbar.search-open .topbar-inner { flex-wrap: wrap; }
  .topbar.search-open .searchbox { display: flex; }
  .topbar-btn { display: flex; }

  .tab { padding: 9px 11px; font-size: 14px; }
  .container { padding: 12px 12px 32px; }

  .quick-tile { width: 76px; height: 76px; border-radius: 14px; }

  .feature-card { width: 82vw; }

  .grid, .grid.featured {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .game-card { border-radius: 12px; }
  .game-card .thumb { aspect-ratio: 1 / 1; }
  .game-card .card-body { padding: 7px 8px; }
  .game-card .card-title { font-size: 12px; }
  .game-card .card-sub { font-size: 10px; }
  .badge { font-size: 9px; padding: 2px 6px; top: 6px; left: 6px; }

  .section-title { font-size: 16px; margin: 20px 0 10px; }

  .player-head { flex-wrap: wrap; gap: 8px; }
  .player-head h1 { font-size: 16px; flex-basis: 100%; order: 3; white-space: normal; }
  .player-frame { border-radius: 12px; }
  /* 移动端竖屏游戏满宽显示，贴近原生 App 观感 */
  .player-frame.portrait {
    width: 100%;
    height: auto;
    aspect-ratio: var(--ar, 9 / 16);
    max-height: 76vh;
  }
  .card-panel { padding: 14px 16px; }
  .footer-links { gap: 14px; flex-wrap: wrap; }
}

@media (min-width: 641px) and (max-width: 900px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .grid.featured { grid-template-columns: repeat(3, 1fr); }
}
