/* 80后游戏 · 像素怀旧风 */
:root {
  --bg: #0b0b14;
  --panel: #14142b;
  --panel2: #1d1d3d;
  --ink: #e8e8f0;
  --muted: #8a8aa8;
  --accent: #ffd23f;
  --accent2: #3fd2ff;
  --pink: #ff3f8e;
  --px-font: "Press Start 2P", "Zpix", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
/* 全站扫描线 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,.12) 2px 4px);
  z-index: 999;
}
a { color: var(--accent2); text-decoration: none; }
img { max-width: 100%; }

/* ---------- 顶栏 ---------- */
.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--px-font);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 2px 2px 0 var(--pink);
  white-space: nowrap;
}
.logo-icon { font-size: 22px; filter: drop-shadow(2px 2px 0 var(--pink)); }
.search-box { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
#q {
  width: 100%;
  padding: 8px 12px;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--accent2);
  border-radius: 0;
  outline: none;
  box-shadow: 3px 3px 0 rgba(63,210,255,.3);
}
#q:focus { border-color: var(--accent); box-shadow: 3px 3px 0 rgba(255,210,63,.35); }
#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel2);
  border: 2px solid var(--accent2);
  box-shadow: 4px 4px 0 rgba(0,0,0,.5);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 200;
}
#search-results a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  color: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
#search-results a:hover, #search-results a.sel { background: var(--panel); color: var(--accent); }
#search-results .r-cat { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- 导航 ---------- */
.site-nav {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  background: var(--panel);
  border-bottom: 1px solid rgba(255,255,255,.07);
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  flex: none;
  padding: 6px 14px;
  color: var(--ink);
  background: var(--panel2);
  border: 2px solid transparent;
  font-size: 14px;
}
.site-nav a:hover { border-color: var(--accent2); color: var(--accent2); }
.site-nav a.active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  box-shadow: 3px 3px 0 var(--pink);
}

main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 40px 8px 24px; }
.hero h1 {
  margin: 0 0 12px;
  font-family: var(--px-font);
  font-size: clamp(26px, 6vw, 44px);
  letter-spacing: 4px;
  color: var(--accent);
  text-shadow: 3px 3px 0 var(--pink), 6px 6px 0 rgba(63,210,255,.35);
}
.tagline { margin: 0; font-size: 18px; color: var(--accent2); }
.hero-sub { margin: 6px 0 0; color: var(--muted); }

.sec-title {
  margin: 36px 0 16px;
  font-size: 20px;
  color: var(--accent);
  border-left: 6px solid var(--pink);
  padding-left: 10px;
}
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.platform-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 8px 20px;
  background: var(--panel);
  border: 2px solid var(--panel2);
  box-shadow: 4px 4px 0 rgba(0,0,0,.45);
  color: var(--ink);
  transition: transform .12s, border-color .12s;
}
.platform-card:hover { transform: translate(-2px,-2px); border-color: var(--accent); }
.p-icon { font-size: 44px; }
.p-name { font-weight: 700; }
.p-count {
  font-size: 12px;
  color: var(--bg);
  background: var(--accent2);
  padding: 1px 8px;
  border-radius: 10px;
}

/* ---------- 游戏卡片 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 2px solid var(--panel2);
  box-shadow: 4px 4px 0 rgba(0,0,0,.45);
  color: var(--ink);
  overflow: hidden;
  transition: transform .12s, border-color .12s;
}
.card:hover { transform: translate(-2px,-2px); border-color: var(--accent); }
.card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--panel2);
}
.card-name {
  padding: 10px 12px 2px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-cat { padding: 0 12px 10px; font-size: 13px; color: var(--muted); }

/* ---------- 列表页 ---------- */
.list-head h1 { font-size: 24px; color: var(--accent); }
.count-badge {
  margin-left: 10px;
  font-size: 13px;
  vertical-align: middle;
  color: var(--bg);
  background: var(--accent2);
  padding: 2px 10px;
  border-radius: 12px;
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 28px;
}
.pg {
  min-width: 40px;
  padding: 8px 12px;
  text-align: center;
  background: var(--panel);
  border: 2px solid var(--panel2);
  color: var(--ink);
  font-size: 15px;
}
a.pg:hover { border-color: var(--accent2); color: var(--accent2); }
.pg.current { background: var(--accent); color: var(--bg); font-weight: 700; box-shadow: 3px 3px 0 var(--pink); }
.pg.gap { border: none; background: none; color: var(--muted); }

/* ---------- 详情页 ---------- */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.game-detail {
  display: flex;
  gap: 24px;
  background: var(--panel);
  border: 2px solid var(--panel2);
  box-shadow: 5px 5px 0 rgba(0,0,0,.45);
  padding: 20px;
}
.game-cover { flex: 0 0 320px; }
.game-cover img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border: 2px solid var(--panel2);
}
.game-info { flex: 1; min-width: 0; }
.game-info h1 { margin: 0 0 12px; font-size: 32px; color: var(--accent); }
.game-tags { display: flex; gap: 8px; margin: 0 0 10px; }
.tag {
  font-size: 14px;
  padding: 2px 10px;
  background: var(--panel2);
  color: var(--accent2);
  border: 1px solid var(--accent2);
}
.tag-sys { color: var(--bg); background: var(--accent2); font-weight: 700; }
.game-desc { color: var(--ink); font-size: 17px; line-height: 1.8; }
.btn-start {
  display: inline-block;
  margin-top: 8px;
  padding: 14px 36px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  color: var(--bg);
  background: var(--accent);
  border: none;
  box-shadow: 4px 4px 0 var(--pink);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.btn-start:hover { filter: brightness(1.08); }
.btn-start:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--pink); }
.play-hint { font-size: 15px; }
.muted { color: var(--muted); }

#player-wrap { margin-top: 20px; display: none; }
#player-wrap:has(.on), #player-wrap.on { display: block; }
#player {
  width: 100%;
  aspect-ratio: 16/10;
  max-height: 80vh;
  background: #000;
  border: 2px solid var(--accent);
  box-shadow: 5px 5px 0 rgba(0,0,0,.5);
}

/* ---------- 页脚 ---------- */
.site-footer {
  text-align: center;
  padding: 24px 16px 32px;
  background: var(--panel);
  border-top: 3px solid var(--accent);
  font-size: 14px;
}
.site-footer p { margin: 4px 0; }

/* ---------- 移动端 ---------- */
@media (max-width: 767px) {
  .site-header { flex-wrap: wrap; gap: 8px; }
  .search-box { max-width: none; flex-basis: 100%; }
  .logo { font-size: 15px; }
  .card-grid, .platform-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .game-detail { flex-direction: column; padding: 14px; }
  .game-cover { flex: none; }
  .btn-start { width: 100%; padding: 16px 0; }
  #player { aspect-ratio: 4/3; }
}

/* ---------- 加载进度覆盖层 ---------- */
.ejs_loading_text { display: none !important; }  /* 隐藏 EmulatorJS 自带小字，数据仍从它读 */
#load-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  z-index: 5;
  transition: opacity .4s;
}
#load-overlay.fade { opacity: 0; pointer-events: none; }
#player-wrap { position: relative; }
.load-title {
  font-family: var(--px-font);
  font-size: 26px;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 3px 3px 0 var(--pink);
}
.load-title::after { content: "…"; animation: load-dots 1.2s steps(4) infinite; }
@keyframes load-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.load-stage { font-size: 15px; color: var(--accent2); min-height: 1.5em; }
.load-bar {
  width: min(520px, 78%);
  height: 28px;
  border: 3px solid var(--accent2);
  background: var(--panel);
  box-shadow: 4px 4px 0 rgba(0,0,0,.5), inset 0 0 12px rgba(63,210,255,.15);
  padding: 4px;
}
.load-fill {
  height: 100%;
  width: 0%;
  transition: width .25s;
  /* 一格格的像素块填充 */
  background: repeating-linear-gradient(90deg,
    var(--accent) 0 14px, rgba(255,210,63,.25) 14px 18px);
  box-shadow: 0 0 10px rgba(255,210,63,.6);
}
.load-fill.indet {
  /* 不确定态：保持当前进度宽度（绝不回退/撑满），用滚动斑纹表示"在忙" */
  min-width: 6%;
  background: repeating-linear-gradient(90deg,
    var(--panel2) 0 14px, var(--accent2) 14px 28px);
  animation: load-crawl .5s linear infinite;
  box-shadow: 0 0 10px rgba(63,210,255,.5);
}
@keyframes load-crawl { to { background-position: 28px 0; } }
.load-pct {
  font-family: var(--px-font);
  font-size: 18px;
  color: var(--ink);
  min-height: 1.4em;
}
#load-overlay.err .load-title { color: var(--pink); text-shadow: 3px 3px 0 rgba(0,0,0,.6); }
#load-overlay.err .load-title::after { content: ""; animation: none; }

/* ---------- READY / START ---------- */
#load-overlay.ready .load-title::after { content: ""; animation: none; }
.load-start {
  padding: 16px 56px;
  font-family: var(--px-font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--bg);
  background: var(--accent);
  border: none;
  box-shadow: 5px 5px 0 var(--pink);
  cursor: pointer;
  animation: start-pulse 1.1s ease-in-out infinite;
}
.load-start:hover { filter: brightness(1.08); }
.load-start:active { transform: translate(3px,3px); box-shadow: 2px 2px 0 var(--pink); }
@keyframes start-pulse { 50% { filter: brightness(1.18); box-shadow: 7px 7px 0 var(--pink); } }

/* ---------- 平台页导语 ---------- */
.cat-intro {
  max-width: 900px;
  margin: 10px 0 28px;
  font-size: 15px;
  line-height: 1.9;
  color: var(--muted);
  border-left: 3px solid var(--panel2);
  padding-left: 12px;
}

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 48px 16px; }
.nf-code {
  margin: 0;
  font-family: var(--px-font);
  font-size: clamp(80px, 18vw, 160px);
  font-weight: 700;
  color: var(--panel2);
  text-shadow: 4px 4px 0 var(--pink), 8px 8px 0 rgba(63,210,255,.3);
  letter-spacing: 12px;
}
.nf-title {
  margin: 8px 0 16px;
  font-family: var(--px-font);
  font-size: 28px;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 3px 3px 0 var(--pink);
}
.nf-text { margin: 6px 0; font-size: 16px; }
.nf-btn { display: inline-block; margin: 24px 0; text-decoration: none; }
.nf-cats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.nf-cats a {
  padding: 6px 14px;
  background: var(--panel);
  border: 2px solid var(--panel2);
  color: var(--ink);
  font-size: 14px;
}
.nf-cats a:hover { border-color: var(--accent2); color: var(--accent2); }

/* 原生广告卡：与平台卡同款式，角落加「广告」标识（合规必需） */
.hall-guest { position: relative; border-style: dashed; }
.card.hall-guest .card-name, .card.hall-guest .card-cat { text-align: center; }

/* ---------- 游玩中的移动端手势防护 ---------- */
/* 禁下拉刷新/边缘回弹：游玩时误触会直接杀掉游戏 */
body.playing { overscroll-behavior: none; }
/* 播放器区域接管全部触摸：不滚页、不缩放、不选字、不弹长按菜单 */
#player-wrap.on {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* ---------- 伪全屏（iPhone 无元素全屏 API，用 CSS 铺满视口兜底） ---------- */
.fs-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1002;
  width: 42px;
  height: 42px;
  font-size: 20px;
  line-height: 1;
  color: #e8e8f0;
  background: rgba(11, 11, 20, .75);
  border: 1px solid var(--panel2);
  border-radius: 4px;
  cursor: pointer;
}
body.pseudo-fs { overflow: hidden; }
body.pseudo-fs #player-wrap.on {
  position: fixed;
  inset: 0;
  z-index: 1000;
  margin: 0;
  background: #000;
}
body.pseudo-fs #player {
  width: 100%;
  height: 100dvh;
  max-height: none;
  aspect-ratio: auto;
  border: none;
  box-shadow: none;
}

/* Turnstile 验票容器（验证通过即移除） */
.ts-holder { margin-top: 8px; min-height: 66px; }

.footer-brand { color: var(--accent); text-decoration: none; }
.site-footer a { color: inherit; }

/* 副标题里的品牌名：像素风，与标题同色系发光但尺寸更小 */
.hero-brand { text-decoration: none;
  font-family: var(--px-font);
  color: var(--accent);
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 var(--pink);
}
