/* ============ WASM Arcade — 暖黄像素怀旧风 ============ */
:root {
  --bg: #fdf3d8;            /* 奶油底 */
  --bg-soft: #fff9ea;       /* 卡片底 */
  --bg-deep: #fbe6ae;       /* 深一档的黄 */
  --ink: #4a2f0f;           /* 深棕文字 */
  --ink-dim: #93743f;       /* 弱化棕 */
  --yellow: #f5a800;        /* 主暖黄 */
  --orange: #ff7b2e;        /* 橙色强调 */
  --red: #e5484d;
  --green: #3f9e46;
  --blue: #2f6fd0;
  --pink: #d84a8f;
  --border: #4a2f0f;        /* 像素描边 */
  --shadow: 4px 4px 0 #4a2f0f;
  --radius: 0;              /* 像素风不要圆角 */
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  /* 细像素格纹理 */
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(74, 47, 15, 0.025) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(74, 47, 15, 0.025) 3px 4px);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  image-rendering: pixelated;
}

h1, h2, h3, .logo, .section-title, .cat-count, .cover-label {
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

img, svg { max-width: 100%; display: block; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--bg-deep);
  border-bottom: 4px solid var(--border);
  box-shadow: 0 4px 0 rgba(74, 47, 15, 0.15);
}

.logo {
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
  text-shadow: 2px 2px 0 var(--yellow);
}
.logo-mark { color: var(--orange); }
.logo-accent { color: var(--orange); }

.cat-nav { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }

.nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-soft);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 var(--border);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  transition: transform .1s;
}
.nav-chip:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--border); }
.nav-chip:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--border); }

/* 像素小元素已移除（用户反馈：遮挡文字） */
.chip-square { display: none; }

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

#game-search {
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: 0;
  color: var(--ink);
  padding: 7px 12px;
  font-size: 0.85rem;
  min-width: 160px;
  box-shadow: inset 2px 2px 0 rgba(74, 47, 15, 0.12);
}
#game-search::placeholder { color: var(--ink-dim); }
#game-search:focus { outline: 3px solid var(--orange); outline-offset: 0; }

.btn-surprise {
  background: var(--yellow);
  color: var(--ink);
  border: 2px solid var(--border);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--border);
  padding: 7px 12px;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-surprise:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--border); }
.btn-surprise:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--border); }

/* ---------- hero（像素街机大厅背景图） ---------- */
.hero {
  text-align: center;
  padding: 96px 20px 72px;
  max-width: none;
  margin: 0 auto;
  position: relative;
  background:
    linear-gradient(rgba(253, 243, 216, 0.55), rgba(253, 243, 216, 0.72)),
    url("../assets/hero-bg.jpg") center / cover no-repeat;
  border-bottom: 4px solid var(--border);
  image-rendering: auto;
}
.hero h1 {
  font-size: clamp(1.2rem, 4vw, 2.4rem);
  line-height: 1.6;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--yellow), 6px 6px 0 rgba(74, 47, 15, 0.35);
}
.hero-accent { color: var(--orange); }
.hero-sub {
  margin-top: 22px;
  font-size: 1.15rem;
  color: var(--ink);
  font-weight: 700;
}
.hero-tag {
  margin-top: 10px;
  color: var(--ink);
  max-width: 640px;
  margin-inline: auto;
  font-weight: 600;
}

/* ---------- section titles ---------- */
.section-title {
  font-size: 1rem;
  margin-bottom: 28px;
  display: inline-block;
  background: var(--yellow);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--border);
  padding: 10px 16px;
}

section { max-width: 1200px; margin: 0 auto; padding: 48px 20px; }
.section-title { margin-left: 0; }

/* ---------- category cards ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

.cat-card {
  background: var(--bg-soft);
  border: 3px solid var(--border);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .12s;
}
.cat-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--border); }

.cat-card h2 { font-size: 0.78rem; }
.cat-card[data-color="purple"] h2, .cat-card[data-color="purple"] .cat-count { color: var(--blue); }
.cat-card[data-color="green"]  h2, .cat-card[data-color="green"]  .cat-count { color: var(--green); }
.cat-card[data-color="red"]    h2, .cat-card[data-color="red"]    .cat-count { color: var(--red); }
.cat-card[data-color="blue"]   h2, .cat-card[data-color="blue"]   .cat-count { color: var(--blue); }
.cat-card[data-color="pink"]   h2, .cat-card[data-color="pink"]   .cat-count { color: var(--pink); }

.cat-card p { color: var(--ink-dim); font-size: 0.88rem; flex: 1; }

.cat-thumb {
  height: 90px;
  border: 2px solid var(--border);
  background-size: 8px 8px;
  background-image:
    repeating-linear-gradient(45deg, rgba(74,47,15,0.12) 0 4px, transparent 4px 8px);
  background-color: var(--bg-deep);
}
.cat-thumb--gta       { background-color: #ffd9a0; }
.cat-thumb--minecraft { background-color: #d8ecc2; }
.cat-thumb--neogeo    { background-color: #ffc9b8; }
.cat-thumb--arcade    { background-color: #cfe3f7; }
.cat-thumb--flash     { background-color: #f7cfe2; }

.cat-count { font-size: 0.6rem; }

/* ---------- featured ---------- */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.featured-card {
  background: var(--bg-soft);
  border: 3px solid var(--border);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.featured-cover {
  height: 150px;
  display: grid;
  place-items: center;
  border: 2px solid var(--border);
  background-size: 8px 8px;
  background-image:
    repeating-linear-gradient(45deg, rgba(74,47,15,0.1) 0 4px, transparent 4px 8px);
}
.cover-label { font-size: 0.85rem; color: var(--ink); text-shadow: 2px 2px 0 var(--bg); }
.cover-gta       { background-color: #ffd9a0; }
.cover-minecraft { background-color: #d8ecc2; }
.cover-neogeo    { background-color: #ffc9b8; }
.cover-arcade    { background-color: #cfe3f7; }

.featured-meta h3 { font-size: 0.72rem; margin-bottom: 8px; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 0;
  border: 2px solid var(--border);
  background: var(--bg-deep);
  color: var(--ink);
  margin-right: 4px;
  font-weight: 700;
}
.tag-purple { background: #cfe3f7; }
.tag-green  { background: #d8ecc2; }
.tag-red    { background: #ffc9b8; }
.tag-blue   { background: #cfe3f7; }

.btn-play {
  align-self: flex-start;
  background: var(--orange);
  color: #fff;
  border: 3px solid var(--border);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 10px 20px;
  font-weight: 800;
  font-size: 0.8rem;
  font-family: "Press Start 2P", monospace;
  cursor: pointer;
  text-shadow: 2px 2px 0 rgba(74, 47, 15, 0.5);
}
.btn-play:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--border); }
.btn-play:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--border); }
.btn-play[disabled] { opacity: .55; cursor: default; transform: none; }

.demo-slot { overflow: hidden; border: 2px solid var(--border); }
.demo-slot iframe { width: 100%; aspect-ratio: 16 / 10; border: 0; }

/* ---------- game page ---------- */
.game-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 20px;
}
.game-page h1 { font-size: 1rem; margin-bottom: 20px; line-height: 1.6; }
.game-frame {
  position: relative;
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 rgba(74, 47, 15, 0.25);
  background: var(--bg-deep);
  overflow: hidden;
}
.game-frame iframe {
  display: block;
  width: 100%;
  height: min(75vh, 700px);
  border: 0;
  background: #111;
}
.game-frame:fullscreen iframe { height: 100vh; }
.btn-fs {
  position: absolute;
  right: 10px; bottom: 10px;
  background: var(--yellow);
  color: var(--ink);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 var(--border);
  font-family: "Press Start 2P", monospace;
  font-size: 0.6rem;
  padding: 8px 12px;
  cursor: pointer;
  opacity: 0.85;
}
.btn-fs:hover { opacity: 1; transform: translate(-1px, -1px); }
.game-frame:fullscreen .btn-fs { z-index: 10; }
/* H2 段落排版 */
.game-page h2 {
  font-family: "Press Start 2P", "Courier New", monospace;
  font-size: 0.72rem;
  margin: 32px 0 14px;
  padding-left: 12px;
  border-left: 5px solid var(--yellow);
  line-height: 1.8;
}
.game-page ul { margin: 0 0 12px 20px; color: var(--ink); }
.game-page li { margin-bottom: 8px; }
.game-page details summary { font-weight: 700; }
.game-page p { color: var(--ink); max-width: 760px; margin-bottom: 12px; }
.game-page .section-title { margin-top: 28px; font-size: 0.8rem; }
.game-license { font-size: 0.85rem; color: var(--ink-dim); margin-top: 12px; }
.game-license a { color: var(--orange); }
.related-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.related-list a {
  display: block; padding: 10px 14px; background: var(--bg-soft);
  border: 2px solid var(--border); box-shadow: 3px 3px 0 var(--border);
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.9rem;
}
.related-list a:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--border); color: var(--orange); }

/* ---------- library ---------- */
.lib-group { margin-bottom: 40px; }
.lib-group h3 { font-size: 0.8rem; margin-bottom: 14px; }

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.game-card {
  background: var(--bg-soft);
  border: 3px solid var(--border);
  border-radius: 0;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition: transform .12s;
  display: block;
}
.game-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--border); }
.game-card.is-hidden { display: none; }

.game-thumb {
  height: 100px;
  display: grid;
  place-items: center;
  font-family: "Press Start 2P", monospace;
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  text-shadow: 2px 2px 0 var(--bg);
  background-size: 8px 8px;
  background-image:
    repeating-linear-gradient(45deg, rgba(74,47,15,0.1) 0 4px, transparent 4px 8px);
  overflow: hidden;
}
.game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
  display: block;
}
.game-card[data-color="purple"] .game-thumb { background-color: #cfe3f7; }
.game-card[data-color="green"]  .game-thumb { background-color: #d8ecc2; }
.game-card[data-color="red"]    .game-thumb { background-color: #ffc9b8; }
.game-card[data-color="blue"]   .game-thumb { background-color: #cfe3f7; }
.game-card[data-color="pink"]   .game-thumb { background-color: #f7cfe2; }

.game-info { padding: 10px 12px 12px; border-top: 2px solid var(--border); }
.game-info h4 { font-size: 0.88rem; line-height: 1.3; }
.game-info span { font-size: 0.72rem; color: var(--ink-dim); }

#search-empty { color: var(--ink-dim); padding: 20px 0; }

/* ---------- about / mobile ---------- */
.about p, .mobile p { color: var(--ink); max-width: 760px; margin-bottom: 12px; }

/* ---------- how ---------- */
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.how-card {
  background: var(--bg-soft);
  border: 3px solid var(--border);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 20px;
}
.how-icon {
  font-size: 1.6rem;
  display: inline-grid;
  place-items: center;
  width: 52px; height: 52px;
  background: var(--yellow);
  border: 3px solid var(--border);
  box-shadow: 3px 3px 0 var(--border);
}
.how-card h3 { margin: 12px 0 6px; font-size: 0.72rem; }
.how-card p { color: var(--ink-dim); font-size: 0.9rem; }

/* ---------- compare table ---------- */
.table-wrap { overflow-x: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-soft);
  border: 3px solid var(--border);
  box-shadow: var(--shadow);
  min-width: 520px;
}
.compare-table th, .compare-table td { padding: 12px 16px; text-align: left; border-bottom: 2px solid var(--bg-deep); }
.compare-table thead th { background: var(--yellow); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 3px solid var(--border); }
.compare-table tbody th { font-weight: 700; color: var(--ink-dim); white-space: nowrap; }
.compare-table .good { color: var(--green); font-weight: 800; }
.compare-table .bad  { color: var(--red); font-weight: 800; }
.compare-table tbody tr:last-child th, .compare-table tbody tr:last-child td { border-bottom: none; }

/* ---------- compat ---------- */
.compat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.compat-item {
  background: var(--bg-soft);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}
.compat-item span { color: var(--green); font-size: 0.78rem; white-space: nowrap; font-weight: 800; }
.compat-item span::before { content: "■ "; }
.compat-note { margin-top: 14px; color: var(--ink-dim); font-size: 0.9rem; }

/* ---------- faq ---------- */
.faq-list details {
  background: var(--bg-soft);
  border: 3px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.faq-list summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 800;
  list-style: none;
}
.faq-list summary::before { content: "▶ "; color: var(--orange); }
.faq-list details[open] summary::before { content: "▼ "; }
.faq-list details p { padding: 0 18px 14px 36px; color: var(--ink-dim); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 4px solid var(--border);
  background: var(--bg-deep);
  padding: 36px 20px;
  text-align: center;
}
.footer-links { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.footer-links a { color: var(--ink); text-decoration: none; font-size: 0.88rem; font-weight: 700; }
.footer-links a:hover { color: var(--orange); }
.footer-disclaimer { color: var(--ink-dim); font-size: 0.78rem; max-width: 820px; margin: 0 auto 14px; }
.footer-copyright { color: var(--ink-dim); font-size: 0.82rem; }

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .4s ease, transform .4s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .site-header { gap: 10px; }
  .header-actions { width: 100%; }
  #game-search { flex: 1; min-width: 0; }
  .hero { padding: 64px 16px 48px; }
  section { padding: 36px 16px; }
}
