/* 游戏库 · 对外试玩站 · 黑白主题 */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #737373;
  --card: #ffffff;
  --line: #d9d9d9;
  --line-strong: #8c8c8c;
  --wash: #f5f5f5;
  --accent: #0a0a0a;
  --accent-fg: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08);
  --shadow-lift: 0 10px 28px rgba(0, 0, 0, .18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #f5f5f5;
    --muted: #a3a3a3;
    --card: #111111;
    --line: #2e2e2e;
    --line-strong: #525252;
    --wash: #171717;
    --accent: #f5f5f5;
    --accent-fg: #0a0a0a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-lift: 0 10px 32px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}
a { color: inherit; text-decoration: none; }
img { -webkit-user-drag: none; }

.wrap { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶栏 ---------- */
.top { padding: 28px 0 6px; }
.top h1 { margin: 0; font-size: 24px; letter-spacing: .01em; }
.top .sub { color: var(--muted); font-size: 13px; margin-top: 5px; min-height: 1.2em; }

/* ---------- 筛选栏 ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
input[type="search"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: inherit;
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="search"]:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 10%, transparent); }

.groups { display: flex; flex-direction: column; gap: 8px; }
.group { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.group .g-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.group .g-chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chip {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all .15s;
}
.chip:hover { border-color: var(--line-strong); color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

/* ---------- 卡片网格 ---------- */
main { padding: 14px 0 56px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease;
}
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card.off { opacity: .55; cursor: default; }
a.card.off:hover { transform: none; box-shadow: var(--shadow); }

.iconbox {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wash);
  border-bottom: 1px solid var(--line);
}
.iconbox img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  display: block;
}
.iconbox .fallback {
  font-size: 44px;
  font-weight: 700;
  color: var(--muted);
}
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 7px; }
.card-name {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tagrow { display: flex; gap: 4px; flex-wrap: wrap; }
.tag {
  display: inline-flex;
  align-items: center;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}
.tag.type { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.tag.element { border-style: dashed; }
.tag.more { border-style: dotted; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  padding: 44px 20px;
  text-align: center;
  font-size: 14px;
}

.foot { color: var(--muted); font-size: 12px; padding: 0 0 44px; text-align: center; }

/* ---------- 适配 ---------- */
/* 平板 */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
}
/* 手机 */
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .top { padding: 18px 0 4px; }
  .top h1 { font-size: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .card-body { padding: 8px 9px 10px; gap: 5px; }
  .card-name { font-size: 14px; }
  .tag { font-size: 10px; padding: 1px 7px; max-width: 88px; }
  .groups { gap: 6px; }
  .group { flex-direction: column; align-items: flex-start; gap: 5px; }
  .group .g-chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; }
}
/* 窄带(极窄手机/分屏) */
@media (max-width: 360px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .iconbox .fallback { font-size: 32px; }
}
