/* ============================================================
   PlayHub · 纯客户端网页游戏平台
   暗色 + 红色科技风 / 卡片布局 / 响应式
   ============================================================ */

:root {
  --bg: #08090d;
  --bg-soft: #0d0f16;
  --panel: rgba(20, 22, 31, 0.82);
  --panel-solid: #141621;
  --panel-hover: #1a1d2a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 90, 110, 0.35);
  --text: #ebedf5;
  --text-dim: #b6bdce;
  --muted: #838ba1;
  --accent: #ff3b57;
  --accent-2: #ff7a3d;
  --accent-3: #ffd166;
  --success: #3ddc97;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 68px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(255, 59, 87, 0.16), transparent 62%),
    radial-gradient(760px 520px at 92% 4%, rgba(255, 122, 61, 0.09), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(90, 60, 180, 0.08), transparent 65%),
    var(--bg);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

::selection { background: rgba(255, 59, 87, 0.35); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: #2b2f3e; border-radius: 10px; border: 2px solid var(--bg-soft); }
::-webkit-scrollbar-thumb:hover { background: #3a4054; }

.container { width: min(1200px, calc(100% - 40px)); margin: 0 auto; }

/* ---------------- 顶部导航 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(8, 9, 13, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 18px; letter-spacing: 0.3px; }

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 22px rgba(255, 59, 87, 0.38);
  font-size: 19px;
  color: #fff;
}

.brand span:last-child { background: linear-gradient(90deg, #fff, #ffb4a0); -webkit-background-clip: text; background-clip: text; color: transparent; }

.main-nav { display: flex; align-items: center; gap: 6px; margin-right: auto; }

.main-nav a {
  padding: 8px 15px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 14px;
  transition: 0.2s;
}

.main-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.main-nav a.active { color: #fff; background: rgba(255, 59, 87, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 59, 87, 0.28); }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 17px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.18s, background 0.18s, border-color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.18); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 26px rgba(255, 59, 87, 0.28);
}
.btn-primary:hover { box-shadow: 0 12px 32px rgba(255, 59, 87, 0.42); background: linear-gradient(135deg, #ff5069, #ff8b52); }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 15px; border-radius: 13px; }
.btn-danger { color: #ff9aa8; border-color: rgba(255, 59, 87, 0.3); }
.btn-danger:hover { background: rgba(255, 59, 87, 0.14); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 16px;
  transition: 0.2s;
}
.icon-btn:hover { color: #fff; border-color: var(--border-strong); background: rgba(255, 59, 87, 0.12); }
.icon-btn.is-active { color: #fff; background: rgba(255, 59, 87, 0.2); border-color: var(--border-strong); }

/* ---------------- 通用区块 ---------------- */
.section { padding: 64px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-kicker { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 2.4px; text-transform: uppercase; }
.section-title { margin: 6px 0 4px; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.25; letter-spacing: -0.5px; }
.section-sub { margin: 0; color: var(--muted); font-size: 14px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
}

.tag-hot { background: rgba(255, 59, 87, 0.14); border-color: rgba(255, 59, 87, 0.35); color: #ff9aab; }

/* ---------------- 首页 Hero ---------------- */
.hero { padding: 78px 0 48px; }

.hero-inner {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 54px;
  align-items: center;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 59, 87, 0.1);
  border: 1px solid rgba(255, 59, 87, 0.3);
  color: #ff9fb0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 59, 87, 0.16); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(255, 59, 87, 0); } }

.hero h1 {
  margin: 22px 0 16px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1.08;
  letter-spacing: -2.5px;
  font-weight: 900;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(110deg, #fff 10%, #ff8a76 45%, var(--accent) 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.hero-lead { max-width: 540px; color: var(--text-dim); font-size: 16px; line-height: 1.85; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.stat-row { display: flex; flex-wrap: wrap; gap: 34px; margin-top: 42px; }
.stat-item strong { display: block; font-size: 28px; line-height: 1.1; font-weight: 800; color: #fff; }
.stat-item span { font-size: 12px; color: var(--muted); letter-spacing: 1px; }

/* Hero 右侧装饰 */
.hero-visual { position: relative; min-height: 380px; display: grid; place-items: center; }
.orbit {
  position: absolute; width: 330px; height: 330px; border-radius: 50%;
  border: 1px solid rgba(255, 59, 87, 0.2);
  box-shadow: inset 0 0 70px rgba(255, 59, 87, 0.07);
}
.orbit:nth-child(2) { width: 240px; height: 240px; border-color: rgba(255, 122, 61, 0.22); animation: spin 26s linear infinite; border-style: dashed; }
.orbit:nth-child(3) { width: 150px; height: 150px; border-color: rgba(255, 255, 255, 0.12); }
@keyframes spin { to { transform: rotate(360deg); } }

.orbit-core {
  position: relative; z-index: 2;
  width: 128px; height: 128px;
  display: grid; place-items: center;
  border-radius: 32px;
  background: linear-gradient(135deg, #ff3b57, #ff7a3d);
  box-shadow: 0 24px 70px rgba(255, 59, 87, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-size: 56px;
  transform: rotate(-8deg);
}

.float-card {
  position: absolute;
  z-index: 3;
  padding: 10px 15px;
  border-radius: 13px;
  background: rgba(22, 24, 34, 0.9);
  border: 1px solid var(--border);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
  animation: float 5s ease-in-out infinite;
}
.float-card b { color: #fff; font-size: 13px; }
.float-card .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.float-card.f1 { top: 26px; left: 4px; }
.float-card.f2 { bottom: 76px; right: -6px; animation-delay: 1.3s; }
.float-card.f3 { bottom: 16px; left: 18px; animation-delay: 2.4s; }
@keyframes float { 50% { transform: translateY(-10px); } }

/* ---------------- 分类条 ---------------- */
.category-strip { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  font-size: 13px;
  transition: 0.18s;
}
.chip:hover { color: #fff; border-color: var(--border-strong); transform: translateY(-1px); }
.chip.active { color: #fff; background: linear-gradient(135deg, rgba(255, 59, 87, 0.28), rgba(255, 122, 61, 0.18)); border-color: var(--border-strong); }
.chip small { margin-left: 6px; color: var(--muted); font-size: 11px; }

/* ---------------- 筛选栏 ---------------- */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 16px;
  margin-bottom: 22px;
}
.search-box { position: relative; flex: 1 1 260px; }
.search-box input {
  width: 100%; height: 44px;
  padding: 0 16px 0 42px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  outline: none;
  transition: 0.2s;
}
.search-box input:focus { border-color: var(--border-strong); box-shadow: 0 0 0 3px rgba(255, 59, 87, 0.09); }
.search-box input::placeholder { color: #666e82; }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; }

.filter-bar select {
  height: 44px;
  padding: 0 34px 0 14px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  outline: none;
}
.result-count { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; }
.result-count b { color: #fff; }

/* ---------------- 游戏卡片 ---------------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
  gap: 18px;
}

.game-card {
  position: relative;
  display: flex; flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s;
  cursor: pointer;
}
.game-card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: 0 22px 46px rgba(0, 0, 0, 0.5); }

.card-cover {
  position: relative;
  height: 118px;
  padding: 15px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(120px 80px at 85% 15%, rgba(255, 255, 255, 0.16), transparent),
    linear-gradient(135deg, hsl(var(--hue) 78% 38%), hsl(calc(var(--hue) + 42) 70% 22%));
  overflow: hidden;
}
.card-cover::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.5;
}
.card-cover .cover-top, .card-cover .cover-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; }
.cover-glyph { font-size: 30px; filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.35)); }
.cover-category { padding: 3px 9px; border-radius: 7px; background: rgba(0, 0, 0, 0.32); color: #fff; font-size: 11px; font-weight: 700; }
.cover-index { font-size: 11px; letter-spacing: 1.5px; color: rgba(255, 255, 255, 0.7); font-weight: 700; }

.card-body { padding: 16px 16px 15px; display: flex; flex-direction: column; flex: 1; }
.card-title { margin: 0 0 7px; font-size: 16px; font-weight: 800; line-height: 1.35; color: #fff; }
.card-desc { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.card-foot .link { color: #ff8fa0; font-size: 13px; font-weight: 700; }
.card-foot .meta { color: #697089; font-size: 11px; }

.card-fav {
  position: absolute; z-index: 4; top: 12px; right: 12px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 15px;
  transition: 0.2s;
}
.card-fav:hover { background: rgba(255, 59, 87, 0.7); transform: scale(1.08); }
.card-fav.is-active { background: var(--accent); border-color: transparent; }

.empty-state {
  grid-column: 1 / -1;
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state .big { font-size: 42px; margin-bottom: 10px; }

/* ---------------- 介绍页 ---------------- */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 22px 0 0; color: var(--muted); font-size: 13px; }
.breadcrumb a:hover { color: #fff; }
.breadcrumb .sep { opacity: 0.4; }

.intro-hero { margin-top: 18px; padding: 34px; display: grid; grid-template-columns: 210px 1fr; gap: 32px; }
.intro-cover {
  min-height: 210px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 78px;
  background: radial-gradient(120px 120px at 70% 20%, rgba(255,255,255,.18), transparent), linear-gradient(135deg, hsl(var(--hue) 78% 38%), hsl(calc(var(--hue) + 42) 70% 20%));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 18px 40px rgba(0,0,0,.35);
}
.intro-main h1 { margin: 6px 0 10px; font-size: clamp(28px, 4vw, 44px); line-height: 1.2; letter-spacing: -1px; }
.intro-summary { color: var(--text-dim); font-size: 15px; line-height: 1.8; max-width: 720px; }
.intro-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 24px; }
.fact { padding: 18px; border-radius: 14px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border); }
.fact label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.fact a { color: #ff9aab; font-size: 13px; word-break: break-all; }
.fact a:hover { text-decoration: underline; }
.fact span { font-size: 14px; }

.history-list { display: flex; flex-wrap: wrap; gap: 9px; }
.history-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.035);
  font-size: 13px;
}
.history-item:hover { border-color: var(--border-strong); }
.history-item time { color: var(--muted); font-size: 11px; }

/* ---------------- 游戏页 ---------------- */
/* 游戏页：左统计 6 / 中游戏 12 / 右说明 6（row = 24） */
.play-grid { display: grid; grid-template-columns: 6fr 12fr 6fr; gap: 16px; align-items: start; }
.play-col { min-width: 0; }
.play-stats { padding: 18px; }
.play-board-panel { padding: 18px; width: 100%; }
.play-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.play-head h2 { margin: 0; font-size: 19px; }
.play-head .sub { color: var(--muted); font-size: 12px; }

/* ---------------- 沉浸式整宽布局（大画布游戏） ---------------- */
/* 顶部：分数条  中部：游戏占满 row 24  底部：玩法说明 / 当前游戏 / 成绩 / 存储 */
body.layout-immersive .play-grid {
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 14px;
}
body.layout-immersive .play-stats { grid-column: 1 / -1; padding: 12px 16px; }
body.layout-immersive .score-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 0;
}
body.layout-immersive .score-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  text-align: left;
}
body.layout-immersive .score-box label { font-size: 12px; letter-spacing: 1px; }
body.layout-immersive .score-box strong { margin-top: 0; font-size: 24px; }
body.layout-immersive .play-board-panel { grid-column: 1 / -1; padding: 14px 16px; }
body.layout-immersive .play-side {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}
body.layout-immersive .play-frame { min-height: 420px; }

/* 左栏统计：竖排三个指标 */
.score-row { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 0; }
.score-box { padding: 20px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); text-align: center; }
.score-box label { display: block; color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.score-box strong { display: block; margin-top: 6px; font-size: 28px; color: #fff; }
.score-box.best strong { color: var(--accent-3); }

.board-wrap { position: relative; }
.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: #10121b;
  border: 1px solid var(--border);
  touch-action: none;
}
.cell { aspect-ratio: 1; border-radius: 11px; background: rgba(255, 255, 255, 0.045); display: grid; place-items: center; font-weight: 800; font-size: clamp(18px, 4vw, 30px); color: #fff; }
.cell.has-tile { animation: pop 0.16s ease-out; }
@keyframes pop { from { transform: scale(0.82); } to { transform: scale(1); } }
.cell[data-v="2"] { background: #232739; color: #d9deec; }
.cell[data-v="4"] { background: #30354c; }
.cell[data-v="8"] { background: linear-gradient(135deg, #8a3a4c, #a04a52); }
.cell[data-v="16"] { background: linear-gradient(135deg, #b54558, #d05a4a); }
.cell[data-v="32"] { background: linear-gradient(135deg, #d24c60, #ff7a45); }
.cell[data-v="64"] { background: linear-gradient(135deg, #e85a52, #ff9a45); }
.cell[data-v="128"] { background: linear-gradient(135deg, #ff6a48, #ffb347); box-shadow: 0 0 20px rgba(255, 106, 72, 0.3); }
.cell[data-v="256"] { background: linear-gradient(135deg, #ff4f6d, #ffc04a); box-shadow: 0 0 26px rgba(255, 79, 109, 0.4); }
.cell[data-v="512"] { background: linear-gradient(135deg, #ff3b57, #ffd166); box-shadow: 0 0 30px rgba(255, 59, 87, 0.5); }
.cell[data-v="1024"] { background: linear-gradient(135deg, #ff2d68, #ffe08a); font-size: clamp(15px, 3vw, 23px); }
.cell[data-v="2048"] { background: linear-gradient(135deg, #ff2046, #ffe9a8); color: #1a0d12; font-size: clamp(15px, 3vw, 23px); box-shadow: 0 0 40px rgba(255, 59, 87, 0.6); }

.board-overlay {
  position: absolute; inset: 12px;
  z-index: 5;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(8, 9, 13, 0.84);
  backdrop-filter: blur(4px);
  text-align: center;
}
.board-overlay.hidden { display: none; }
.board-overlay h3 { margin: 0 0 4px; font-size: 24px; }
.board-overlay p { margin: 0 0 18px; color: var(--text-dim); }

.play-controls { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.play-tip { margin-top: 14px; color: var(--muted); font-size: 12px; text-align: center; }

/* 右栏：玩法说明等信息单列排布 */
.play-side { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 0; align-items: start; }
.side-panel { padding: 16px; }
.side-panel h3 { margin: 0 0 14px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.side-panel h3::before { content: ""; width: 3px; height: 15px; border-radius: 2px; background: var(--accent); }
.side-panel p, .side-panel li { color: var(--text-dim); font-size: 13px; line-height: 1.8; }
.side-panel ul { margin: 0; padding-left: 18px; }
.side-panel ol { margin: 0; padding-left: 18px; }
kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 2px;
  border-radius: 5px; border: 1px solid var(--border); background: rgba(255,255,255,.06);
  font-size: 11px; color: #fff; text-align: center;
}

.record-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.record-table th { color: var(--muted); font-size: 11px; font-weight: 600; text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--border); }
.record-table td { padding: 9px 6px; border-bottom: 1px solid rgba(255,255,255,.045); color: var(--text-dim); }
.record-table td:nth-child(2) { color: #fff; font-weight: 700; }
.record-table tr:last-child td { border-bottom: none; }

/* ---------------- 数据管理弹窗 ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(4, 5, 9, 0.78);
  backdrop-filter: blur(7px);
}
.modal-backdrop.hidden { display: none; }
.modal {
  width: min(560px, 100%);
  max-height: 88vh; overflow-y: auto;
  padding: 26px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #12141d;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 21px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { display: grid; gap: 16px; }

.data-stat { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.data-stat div { padding: 12px 8px; text-align: center; border-radius: 11px; background: rgba(255,255,255,.04); border: 1px solid var(--border); }
.data-stat b { display: block; font-size: 20px; color: #fff; }
.data-stat span { font-size: 11px; color: var(--muted); }

.upload-zone {
  display: grid; place-items: center; gap: 6px;
  min-height: 116px; padding: 18px;
  border-radius: 13px;
  border: 1.5px dashed rgba(255, 59, 87, 0.4);
  background: rgba(255, 59, 87, 0.05);
  color: var(--text-dim);
  text-align: center;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}
.upload-zone:hover, .upload-zone.dragover { background: rgba(255, 59, 87, 0.13); border-color: var(--accent); }
.upload-zone .up-icon { font-size: 25px; }
.upload-zone input { display: none; }
.upload-zone b { color: #fff; }

.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.notice { padding: 11px 13px; border-radius: 10px; background: rgba(61, 220, 151, 0.08); border: 1px solid rgba(61, 220, 151, 0.22); color: #92e6c2; font-size: 12px; }
.notice.warn { background: rgba(255, 209, 102, 0.07); border-color: rgba(255, 209, 102, 0.22); color: #f2d58c; }

/* Toast */
.toast-wrap { position: fixed; z-index: 200; bottom: 24px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast {
  padding: 11px 18px; border-radius: 11px;
  background: #1c1f2b; border: 1px solid var(--border);
  box-shadow: 0 12px 34px rgba(0,0,0,.5);
  color: #fff; font-size: 13px;
  animation: toast-in 0.22s ease-out;
}
.toast.ok { border-color: rgba(61,220,151,.4); }
.toast.err { border-color: rgba(255,59,87,.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------------- 页脚 ---------------- */
.site-footer { margin-top: 60px; padding: 28px 0 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.site-footer a { color: #ff9aab; }
/* 备案信息独占一行，法定编号保持原文 */
.site-footer .site-beian { flex-basis: 100%; }
.site-footer .site-beian a { color: var(--muted); text-decoration: underline; }
.site-footer .site-beian a:hover { color: #ff9aab; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 18px; }
  .hero-visual { min-height: 300px; }
  .intro-hero { grid-template-columns: 1fr; padding: 22px; }
  .intro-cover { min-height: 150px; font-size: 56px; }
  .play-layout { grid-template-columns: 1fr; }
  .play-side { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container { width: min(100% - 28px, 1200px); }
  .site-header .container { gap: 10px; }
  .brand { font-size: 16px; }
  .brand-mark { width: 30px; height: 30px; font-size: 16px; }
  .main-nav { gap: 0; }
  .main-nav a { padding: 7px 9px; font-size: 13px; }
  .header-actions .btn span { display: none; }
  .hero { padding: 50px 0 32px; }
  .hero h1 { letter-spacing: -1.5px; }
  .stat-row { gap: 22px; }
  .section { padding: 46px 0; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card-cover { height: 88px; padding: 11px; }
  .cover-glyph { font-size: 24px; }
  .card-body { padding: 12px; }
  .card-title { font-size: 14px; }
  .card-desc { font-size: 12px; min-height: 38px; }
  .result-count { width: 100%; margin-left: 0; }
  .data-stat { grid-template-columns: repeat(2, 1fr); }
  .play-board-panel { padding: 15px; }
  .board { gap: 7px; padding: 9px; }
  .cell { border-radius: 8px; }
}

/* ---------------- PlayHub 商业化增补 ---------------- */
.lang-select {
  height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.lang-select:focus { border-color: var(--border-strong); }

/* 广告位 */
.ad-slot {
  min-height: 90px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
}
.ad-demo {
  border: 1px dashed rgba(255, 122, 61, 0.35);
  background: rgba(255, 122, 61, 0.05);
  color: rgba(255, 190, 150, 0.75);
  text-align: center;
  font-size: 12px;
  letter-spacing: 1px;
}
.ad-demo small { display: block; font-size: 10px; opacity: 0.55; margin-top: 2px; }
/* 未投广告时容器为空，直接隐藏，避免占位留白 */
[data-ad-slot]:empty { display: none; }
.ad-top { margin-bottom: 20px; }
/* 游戏页顶部广告紧贴游戏区，减少前置留白 */
body[data-page="game"] .ad-top { margin-bottom: 12px; }
.ad-sidebar { margin: 18px 0 0; }
.ad-footer { margin-top: 24px; }

/* 游戏承载iframe */
.play-frame-wrap {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  background: #0f1119;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.play-frame {
  display: block;
  width: 100%;
  /* 仅作加载前初始高度，载入后由 JS 按游戏内容自适应 */
  height: 420px;
  min-height: 320px;
  border: 0;
  background: #0f1119;
}
.play-loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted); font-size: 13px;
  background: #0f1119;
}
.play-loading.hidden { display: none; }
.play-controls .btn[hidden] { display: none; }

/* 游戏卡片封面上的分类角标 */
.card-cover .cover-category { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }

@media (max-width: 640px) {
  .lang-select { max-width: 86px; padding: 0 4px; }
  .header-actions { gap: 6px; }
}

/* ============================================================
   H5 移动端完整适配（手机优先，<= 640px）
   ============================================================ */
.mobile-tabbar { display: none; }

@media (max-width: 640px) {
  /* 页面给底部 Tab 留空间 */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

  /* 顶部导航精简：只留品牌 + 语言 */
  .site-header { height: 56px; }
  .site-header .container { justify-content: space-between; gap: 8px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 32px; height: 32px; font-size: 17px; }
  .main-nav { display: none; }
  .header-actions { margin-left: auto; }
  .header-actions .btn { display: none; }
  .lang-select { height: 36px; max-width: 104px; font-size: 12px; }

  /* 底部 Tab 导航 */
  .mobile-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(10, 11, 16, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
  }
  .mobile-tabbar a, .mobile-tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; border: 0; background: none; color: var(--muted);
    font-size: 11px; font-weight: 600; cursor: pointer;
    min-height: 56px;
  }
  .mobile-tabbar .ti { font-size: 19px; line-height: 1; }
  .mobile-tabbar a.active { color: var(--accent); }
  .mobile-tabbar a.active .ti { filter: drop-shadow(0 0 7px rgba(255,59,87,.6)); }

  /* 广告位缩小 */
  .ad-top { margin-bottom: 10px; }
  .ad-slot { min-height: 60px; }
  .ad-demo { font-size: 11px; }

  /* Hero 精简：隐藏装饰动画，内容前置 */
  .hero { padding: 30px 0 14px; }
  .hero-inner { gap: 0; }
  .hero-visual { display: none; }
  .hero h1 { margin: 16px 0 10px; font-size: clamp(34px, 10vw, 48px); }
  .hero-lead { font-size: 14px; line-height: 1.7; }
  .hero-actions { margin-top: 22px; gap: 10px; }
  .hero-actions .btn { flex: 1; min-height: 46px; padding: 0 12px; }
  .stat-row { gap: 26px; margin-top: 26px; }
  .stat-item strong { font-size: 23px; }

  /* 区块间距 */
  .section { padding: 30px 0; }
  .section-title { font-size: 24px; }
  .section-sub { font-size: 13px; }

  /* 卡片两列 */
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-cover { height: 76px; padding: 9px; }
  .cover-glyph { font-size: 22px; }
  .cover-category { font-size: 10px; padding: 2px 6px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 14px; margin-bottom: 4px; }
  .card-desc { font-size: 11px; min-height: 34px; -webkit-line-clamp: 2; }
  .card-foot { margin-top: 8px; padding-top: 8px; }
  .card-foot .link, .card-foot .meta { font-size: 11px; }
  .card-fav { width: 34px; height: 34px; top: 8px; right: 8px; }

  /* 筛选栏 */
  .filter-bar { padding: 11px; gap: 9px; }
  .search-box input { height: 46px; font-size: 16px; }
  .filter-bar select { height: 46px; font-size: 14px; }
  .category-strip { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-right: -14px; }
  .chip { flex: 0 0 auto; min-height: 38px; padding: 8px 13px; font-size: 13px; }

  /* 介绍页 */
  .breadcrumb { padding-top: 14px; font-size: 12px; }
  .intro-hero { padding: 16px; gap: 16px; margin-top: 12px; }
  .intro-cover { min-height: 128px; font-size: 52px; border-radius: 13px; }
  .intro-main h1 { font-size: 28px; }
  .intro-summary { font-size: 14px; }
  .intro-actions .btn { flex: 1; min-height: 46px; padding: 0 12px; font-size: 14px; }
  .fact-grid { gap: 10px; margin-top: 16px; }
  .fact { padding: 13px; }
  .fact a { font-size: 12px; }

  /* 游戏页：H5 只显示中间游戏区，左右统计与说明隐藏 */
  .play-grid { grid-template-columns: 1fr; gap: 12px; }
  .play-stats, .play-side { display: none; }
  .play-board-panel { padding: 13px; }
  .play-head h2 { font-size: 17px; }
  .play-head .btn { min-height: 40px; }
  .score-row { gap: 7px; }
  .score-box { padding: 9px 5px; }
  .score-box label { font-size: 10px; }
  .score-box strong { font-size: 19px; }
  .play-frame { height: 380px; min-height: 320px; }
  .play-controls .btn { flex: 1; min-height: 46px; }
  .play-tip { font-size: 11px; }
  .play-side { gap: 12px; margin-top: 14px; }
  .side-panel { padding: 16px; }
  .side-panel h3 { font-size: 15px; }
  .side-panel p, .side-panel li { font-size: 13px; }
  .record-table { font-size: 12px; }
  .record-table th, .record-table td { padding: 7px 4px; }

  /* 沉浸式布局：H5 顶部保留分数条（紧凑），底部说明折叠为一列 */
  body.layout-immersive .play-stats { display: block; padding: 10px 12px; }
  body.layout-immersive .score-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  body.layout-immersive .score-box {
    display: block; padding: 8px 6px; text-align: center;
  }
  body.layout-immersive .score-box label { font-size: 10px; }
  body.layout-immersive .score-box strong { margin-top: 3px; font-size: 19px; }
  body.layout-immersive .play-side { display: grid; grid-template-columns: 1fr; gap: 12px; }
  body.layout-immersive .play-frame { min-height: 340px; }

  /* 弹窗全屏化 */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .data-stat { gap: 7px; }
  .data-stat div { padding: 10px 5px; }
  .data-stat b { font-size: 18px; }
  .upload-zone { min-height: 100px; }
  .modal-actions .btn { flex: 1; min-height: 46px; }

  /* 页脚 */
  .site-footer { margin-top: 26px; padding-bottom: 20px; }
}

@media (max-width: 360px) {
  .game-grid { gap: 8px; }
  .card-desc { font-size: 10px; }
  .hero-actions .btn { font-size: 13px; }
  .score-box strong { font-size: 17px; }
}
