:root {
  --bg: #0d0f14;
  --bg-elevated: #161923;
  --bg-card: #1a1e2b;
  --border: #2a2f3f;
  --text: #eef0f5;
  --text-dim: #9aa0b4;
  --accent: #7c5cff;
  --accent-2: #38e0c8;
  --danger: #ff5c7a;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: rgba(13,15,20,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .5px;
  white-space: nowrap;
}
.brand .dot {
  width: 12px; height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transform: rotate(45deg);
}
.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.search-wrap input {
  width: 100%;
  padding: 10px 16px 10px 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap svg {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  opacity: .5;
}
.header-spacer { flex: 1; }
.header-tag {
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Hero ---------- */
.hero {
  padding: 56px 28px 32px;
  text-align: center;
  background:
    radial-gradient(ellipse 600px 300px at 20% 0%, rgba(124,92,255,.18), transparent),
    radial-gradient(ellipse 600px 300px at 80% 0%, rgba(56,224,200,.14), transparent);
}
.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  margin: 0 0 12px;
  font-weight: 800;
  letter-spacing: .5px;
}
.hero p {
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.7;
}

/* ---------- Category chips ---------- */
.chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 28px 8px;
  max-width: 1280px;
  margin: 0 auto;
}
.chip {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active {
  background: linear-gradient(135deg, var(--accent), #5a3fe0);
  color: #fff;
  border-color: transparent;
}

/* ---------- Grid ---------- */
.grid-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 28px 64px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
  font-size: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  cursor: pointer;
  position: relative;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.card .thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-elevated);
}
.card .thumb-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.card:hover .thumb-wrap img { transform: scale(1.06); }
.badge {
  position: absolute;
  top: 10px; left: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  color: var(--text);
}
.badge.maintenance { background: var(--danger); color: #fff; }
.badge.paid { background: var(--accent-2); color: #06231f; }
.card.disabled { cursor: not-allowed; }
.card.disabled .thumb-wrap img { filter: grayscale(1) brightness(.5); }
.play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13,15,20,0);
  opacity: 0;
  transition: opacity .18s, background .18s;
}
.card:hover .play-overlay { opacity: 1; background: rgba(13,15,20,.25); }
.play-overlay .play-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.play-overlay .play-btn svg { width: 18px; height: 18px; margin-left: 3px; fill: #0d0f14; }

.card-body { padding: 12px 14px 14px; }
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tag {
  font-size: 11px;
  color: var(--accent-2);
  background: rgba(56,224,200,.1);
  padding: 2px 8px;
  border-radius: 999px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.8;
}

/* ---------- Player page ---------- */
.player-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.back-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.back-btn:hover { color: var(--text); border-color: var(--accent); }
.player-title { flex: 1; min-width: 0; }
.player-title h1 { font-size: 16px; margin: 0; font-weight: 700; }
.player-title p { font-size: 12px; margin: 2px 0 0; color: var(--text-dim); }
.player-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.source-link { color: var(--text-dim); font-weight: 500; }
.btn {
  font-size: 13px; font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #5a3fe0);
  border-color: transparent;
  color: #fff;
}

.stage-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - 61px);
  background: #000;
}
.stage-wrap iframe {
  width: 100%; height: 100%;
  border: 0;
  display: block;
}
.stage-fallback, .stage-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 20px;
}
.stage-loading { color: var(--text-dim); font-size: 13px; }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.stage-fallback img { width: 72px; opacity: .5; border-radius: 12px; }
.stage-fallback h2 { font-size: 16px; margin: 0; }
.stage-fallback p { font-size: 13px; color: var(--text-dim); max-width: 340px; }

.related-section {
  padding: 28px;
  max-width: 1280px;
  margin: 0 auto;
}
.related-section h3 { font-size: 15px; margin: 0 0 14px; }

@media (max-width: 640px) {
  .site-header { padding: 12px 16px; gap: 12px; }
  .brand span.label { display: none; }
  .header-tag { display: none; }
  .hero { padding: 36px 16px 20px; }
  .chip-row, .grid-section, .related-section { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .player-title p { display: none; }
}

/* ---------- Generated pages (home / game / list / text) ---------- */
.top-nav { display: flex; gap: 16px; font-size: 13px; color: var(--text-dim); }
.top-nav a:hover { color: var(--text); }
.search-row { max-width: 1280px; margin: 0 auto; padding: 8px 28px 0; }
.search-row .search-wrap { max-width: 520px; }
.section-title { font-size: 18px; margin: 0 0 14px; }
.chip-row a.chip { display: inline-flex; }

.featured { max-width: 1280px; margin: 0 auto; padding: 0 28px; }
.featured-card {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 0;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: border-color .18s, box-shadow .18s;
}
.featured-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.featured-card img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16/9; }
.featured-body { padding: 28px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.featured-body .eyebrow { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent-2); }
.featured-body h2 { margin: 0; font-size: 26px; }
.featured-body h2 small { display: block; font-size: 13px; font-weight: 500; color: var(--text-dim); margin-top: 4px; }
.featured-body p { color: var(--text-dim); font-size: 14px; line-height: 1.7; margin: 0; }
.featured-body .btn { align-self: flex-start; margin-top: 6px; }

.breadcrumbs { max-width: 1280px; margin: 0 auto; padding: 14px 28px 0; font-size: 12px; color: var(--text-dim); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs span { margin: 0 4px; }

.game-page .player-header { border-top: 1px solid var(--border); }
.game-page .player-title h1 { font-size: 20px; }
.game-page .player-title p a:hover { color: var(--text); text-decoration: underline; }
.game-page .stage-wrap { height: min(72vh, 720px); }

.article { max-width: 860px; margin: 0 auto; padding: 32px 28px 8px; line-height: 1.75; font-size: 15px; }
.article h1 { font-size: clamp(24px, 3vw, 34px); margin: 0 0 16px; line-height: 1.25; }
.article h2 { font-size: 20px; margin: 32px 0 10px; }
.article h3 { font-size: 16px; margin: 24px 0 8px; }
.article p { margin: 0 0 14px; color: #d5d8e2; }
.article .lede { font-size: 17px; color: var(--text); }
.article ol, .article ul { padding-left: 22px; margin: 0 0 14px; color: #d5d8e2; }
.article li { margin-bottom: 6px; }
.article a { color: var(--accent-2); }
.article a:hover { text-decoration: underline; }
.article code { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.article .faq dt { font-weight: 700; margin-top: 14px; }
.article .faq dd { margin: 4px 0 0; color: #d5d8e2; }
.embed-box {
  width: 100%; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; resize: vertical;
}
.meta-row { font-size: 13px; color: var(--text-dim); }
.link-cloud a {
  display: inline-block; margin: 0 8px 8px 0; padding: 5px 12px; font-size: 13px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; color: var(--text);
}
.link-cloud a:hover { border-color: var(--accent); text-decoration: none; }
.home-copy { padding-top: 0; }
.post-list { list-style: none; padding: 0; }
.post-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.grid-section > h1 { font-size: clamp(24px, 3vw, 34px); margin: 8px 0 8px; }
.grid-section > .lede { color: var(--text-dim); max-width: 860px; line-height: 1.7; margin: 0 0 20px; }
.grid-section > .lede a { color: var(--accent-2); }
.footer-links { margin-bottom: 12px; }
.footer-links a:hover { color: var(--text); }
.related-section h2 { font-size: 17px; margin: 24px 0 14px; }

@media (max-width: 760px) {
  .top-nav { display: none; }
  .featured { padding: 0 16px; }
  .featured-card { grid-template-columns: 1fr; }
  .featured-body { padding: 18px; }
  .search-row, .breadcrumbs { padding-left: 16px; padding-right: 16px; }
  .article { padding: 24px 16px 8px; }
  .game-page .stage-wrap { height: 62vh; }
  .game-page .player-title p { display: block; }
}

/* ---------- Platform support ---------- */
/* Device badges on the cards, and the spec table on each game page. Both are fed
   by the platforms / input fields in js/games-data.js, which are checked with
   tools/check-platforms.mjs rather than taken from the game's own blurb. */
.plat {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.plat-mobile { color: var(--accent-2); border-color: rgba(56,224,200,.35); }
.filter-row { padding-top: 2px; }
.filter-row .chip { font-weight: 500; cursor: pointer; font-family: inherit; }

.spec {
  /* Lines up with .article, which is the column the rest of the page reads in. */
  width: calc(100% - 56px);
  max-width: 860px;
  margin: 24px auto 0;
  border-collapse: collapse;
  font-size: 14px;
  color: var(--text-dim);
  text-align: left;
}
.spec caption {
  text-align: left;
  padding: 0 0 8px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.spec th, .spec td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.spec th { width: 150px; font-weight: 600; color: var(--text); white-space: nowrap; }
.spec td a { color: var(--accent-2); }
.spec td a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .spec { width: calc(100% - 32px); }
  .spec th { width: 108px; }
}

/* ---------- Cited source post ---------- */
/* A game we found through its author's post gets the post quoted on its page.
   Static markup on purpose: no X widget script, no avatar hotlinking, no
   third-party cookies, and it still renders if X blocks embeds tomorrow. */
.xpost {
  margin: 0 0 18px;
  padding: 16px 18px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.xpost blockquote { margin: 0; }
.xpost-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.xpost-avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #5a3fe0);
  color: #fff; font-weight: 700; font-size: 16px;
}
.xpost-who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.xpost-name { font-weight: 700; color: var(--text); font-size: 14px; }
.xpost-handle { color: var(--text-dim); font-size: 13px; }
.xpost-logo { width: 17px; height: 17px; margin-left: auto; fill: var(--text-dim); flex: none; }
.xpost .xpost-text { margin: 0 0 10px; color: #d5d8e2; font-size: 15px; line-height: 1.6; white-space: pre-line; }
.xpost figcaption { font-size: 13px; color: var(--text-dim); border-top: 1px solid var(--border); padding-top: 10px; }
.xpost figcaption a { color: var(--text-dim); }
.xpost figcaption a:hover { color: var(--accent-2); text-decoration: underline; }

/* ---------- Astra index (/astra/) ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.astra-controls {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between; margin: 4px 0 18px;
}
.astra-controls .chip-row { margin: 0; flex: 1 1 420px; }
.astra-search { flex: 0 1 300px; }
.astra-search input {
  width: 100%; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text); font-size: 14px; outline: none;
}
.astra-search input:focus { border-color: var(--accent); }

.astra-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.astra-row {
  display: flex; gap: 20px; align-items: baseline; justify-content: space-between;
  padding: 16px 4px; border-bottom: 1px solid var(--border);
}
.astra-row[hidden] { display: none; }
.astra-main { min-width: 0; }
.astra-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.astra-title a { color: var(--text); }
.astra-title a:hover { color: var(--accent-2); }
.astra-blurb { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.astra-meta {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end;
  gap: 5px; text-align: right; font-size: 12px; color: var(--text-dim);
}
.astra-kind {
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px;
  font-size: 11px; letter-spacing: .02em; white-space: nowrap;
}
.astra-kind-playable { border-color: var(--accent-2); color: var(--accent-2); }
.astra-kind-comparison, .astra-kind-workflow { opacity: .8; }
.astra-by { white-space: nowrap; }
.astra-play { color: var(--accent-2); white-space: nowrap; }
.astra-play:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .astra-row { flex-direction: column; gap: 8px; align-items: flex-start; }
  .astra-meta { flex-direction: row; flex-wrap: wrap; align-items: center; text-align: left; gap: 10px; }
}
