/* ==========================================================================
   AIGamen — 视觉体系对标 arcadino.com
   --------------------------------------------------------------------------
   设计令牌取自 arcadino.com 主题变量（:root）：
     主色 #e53935 / 次色 #ffc107
     背景 #0f0d12 / 卡片 #1b1820 / 文本 #fff
     标题 Baloo 2，正文 Fredoka，基础字号 16px，圆角 12px
   保留既有类名（.catalog / .play-section / .game-card 等），只重写呈现层；
   模板结构与数据管线不变。旧表格布局（.game-table 一族）已随卡片网格上线移除。
   ========================================================================== */

:root {
  /* 品牌色 */
  --primary: #e53935;
  --primary-rgb: 229, 57, 53;
  --secondary: #ffc107;
  --secondary-rgb: 255, 193, 7;
  /* 原来的 --gradient / --accent 已随「渐变只留一处」的收敛一并退场，
     品牌标记现在是站点图标的同一份 SVG，不再用 CSS 渐变拼出来。 */

  /* 表面 */
  --bg: #0f0d12;
  --bg-rgb: 15, 13, 18;
  --card: #1b1820;
  --card-rgb: 27, 24, 32;
  --card-hover: #241f2b;
  --panel: #16131a;
  --subtle: #221d27;

  /* 文本 */
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, .7);
  --muted: rgba(255, 255, 255, .55);
  --faint: rgba(255, 255, 255, .35);

  /* 线与交互 */
  --border: rgba(255, 255, 255, .1);
  --border-strong: rgba(255, 255, 255, .18);
  --hover-bg: rgba(255, 255, 255, .07);
  --input-bg: rgba(255, 255, 255, .07);
  --glass: rgba(15, 13, 18, .82);

  /* 语义色 */
  --ok: #4caf50;
  --ok-rgb: 76, 175, 80;
  --warn: #ffc107;
  --danger: #e53935;
  --info: #42a5f5;

  /* 排版 */
  --font-heading: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Fredoka', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs: 16px;
  --fs-sm: .8125rem;
  --fs-xs: .75rem;

  /* 尺寸 */
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --header-h: 64px;
  --sidebar-w: 68px;
  --sidebar-expanded: 208px;
  --content-max: 1480px;
  /* 内容列的实际宽度：宽屏时等于 --content-max，窄屏时收窄到两侧各留出侧栏宽度。
     顶栏 / 正文 / 页脚 / 侧栏位置全部引用这一条，保证同一套居中网格。 */
  --content-w: min(var(--content-max), calc(100% - var(--sidebar-w) * 2 - 2rem));
  --shadow: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);

  color-scheme: dark;
}

/* --------------------------------------------------------------- 基础重置 */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  /* 顶部一层极淡的品牌色氛围光 */
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 380px;
  background:
    radial-gradient(60% 100% at 20% 0%, rgba(var(--primary-rgb), .16), transparent 70%),
    radial-gradient(50% 100% at 80% 0%, rgba(var(--secondary-rgb), .08), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.18;
  margin: 0 0 .5em;
  letter-spacing: -.01em;
}

h1 { font-size: clamp(1.85rem, 3.6vw, 2.9rem); }
h2 { font-size: clamp(1.3rem, 2.1vw, 1.75rem); }
h3 { font-size: 1.125rem; }

p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--text);
  text-decoration: none;
  transition: color .18s ease;
}
a:hover { color: var(--secondary); }

:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
  border-radius: 4px;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------- 无障碍工具 */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: -9999px;
  top: 0;
  z-index: 3000;
  background: var(--primary);
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ 骨架 */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 1000;
  display: flex;
  align-items: center;
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  flex: none;
}
/* 品牌标记与站点图标同源：同一份 SVG 几何，页头和标签页看到的是同一个东西 */
.brand::before {
  content: "";
  width: 32px; height: 32px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='15' fill='%23e53935'/%3E%3Cpolygon points='24,14 49,32 24,50' fill='%23ffffff'/%3E%3C/svg%3E") center/contain no-repeat;
  flex: none;
}
.brand:hover { color: var(--text); }

/* 顶栏搜索 */
.global-search {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
  margin: 0;
}
.global-search input {
  width: 100%;
  height: 38px;
  padding: 0 2.4rem 0 2.35rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: var(--fs-sm);
  transition: border-color .18s ease, background .18s ease;
}
.global-search input::placeholder { color: var(--muted); }
.global-search input:focus {
  outline: none;
  border-color: rgba(var(--primary-rgb), .6);
  background: rgba(255, 255, 255, .1);
}
.global-search::before {
  content: "";
  position: absolute;
  left: .85rem; top: 50%;
  width: 14px; height: 14px;
  margin-top: -7px;
  background: currentColor;
  color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") center/contain no-repeat;
  pointer-events: none;
}
.global-search kbd {
  position: absolute;
  right: .55rem; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  color: var(--muted);
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .05rem .3rem;
  pointer-events: none;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
}
.site-header nav a {
  padding: .45rem .85rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.site-header nav a:hover { background: var(--hover-bg); color: var(--text); }
.site-header nav a[aria-current="page"] {
  color: var(--text);
  background: rgba(var(--primary-rgb), .16);
}

/* ------------------------------------------------------- 左侧图标导航栏 */
.left-sidebar {
  position: fixed;
  top: var(--header-h);
  /* 跟着内容列走：贴住内容列左边缘，不钉死在窗口左边。
     宽屏时整个「侧栏 + 内容」作为一个整体居中，窄屏时退回 16px 安全边。 */
  left: max(0px, calc((100% - var(--content-w)) / 2 - var(--sidebar-w)));
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  background: var(--panel);
  border-right: 1px solid var(--border);
  z-index: 900;
  overflow: hidden;
  transition: width .28s cubic-bezier(.4, 0, .2, 1), box-shadow .28s ease;
}
.left-sidebar:hover {
  width: var(--sidebar-expanded);
  box-shadow: 12px 0 32px rgba(0, 0, 0, .45);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: .5rem 0 1.5rem;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-item {
  display: flex;
  align-items: center;
  min-height: 48px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
.sidebar-item:hover { background: var(--hover-bg); color: var(--text); }
.sidebar-item.active {
  color: var(--text);
  background: rgba(var(--primary-rgb), .14);
  box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar-icon {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}

.sidebar-label {
  opacity: 0;
  transition: opacity .18s ease;
  padding-right: 1rem;
  font-size: var(--fs-sm);
}
.left-sidebar:hover .sidebar-label { opacity: 1; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: .5rem .75rem;
  flex: none;
}

/* -------------------------------------------------------------- 主内容区 */
/* 内容列：在视口里居中。两侧至少留出固定侧栏的宽度，
   这样宽屏时左右余量对称，窄屏时内容也不会被侧栏压住。
   顶栏 / 正文 / 页脚共用这一条宽度公式，保证三者左边缘对齐。 */
main.container {
  position: relative;
  z-index: 1;
  max-width: var(--content-w);
  margin-inline: auto;
  padding: calc(var(--header-h) + 1.25rem) 1.5rem 3.5rem;
}

/* ------------------------------------------------------------ 页面引言区 */
.page-intro {
  position: relative;
  padding: .75rem 0 1.5rem;
  margin-bottom: .5rem;
}
.page-intro h1 {
  margin: 0 0 .6rem;
  background: linear-gradient(180deg, #fff 30%, rgba(255, 255, 255, .72));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.intro-copy {
  max-width: 68ch;
  color: var(--text-2);
  font-size: 1rem;
  margin: 0 0 1.1rem;
}

.catalog-summary {
  margin: 0;
  max-width: 62ch;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.catalog-summary a {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
}
.catalog-summary a:hover {
  color: var(--secondary);
  text-decoration-color: currentColor;
}

/* ---------------------------------------------------------------- 按钮 */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  height: 40px;
  padding: 0 1.15rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.button:hover {
  background: rgba(255, 255, 255, .12);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.button:active { transform: translateY(0); }

/* 主按钮用纯色而非渐变：整站的"大胆"只留给品牌标记一处，CTA 靠面积和对比说话 */
.button.primary {
  background: var(--primary);
  border: none;
  color: #fff;
}
.button.primary:hover {
  background: #d32f2f;
  color: #fff;
}
/* 主按钮底色是暖色，琥珀色焦点环对比不足，改用白色 */
.button.primary:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.button.subtle {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
  height: 34px;
  padding: 0 .9rem;
  font-weight: 500;
}
.button.subtle:hover { color: var(--text); background: var(--hover-bg); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: .35rem;
}
.back-link::before { content: "←"; }
.back-link:hover { color: var(--secondary); }

/* ------------------------------------------------------- 区块标题 / 布局 */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 .9rem;
}
.section-heading h2 { margin: 0; }
.section-heading > span {
  font-size: var(--fs-sm);
  color: var(--muted);
  white-space: nowrap;
}
.section-heading > a {
  font-size: var(--fs-sm);
  color: var(--secondary);
}

.catalog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.75rem;
  align-items: start;
}

.browse-section { margin-top: 2.75rem; }
.about-section {
  margin-top: 2.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}
.about-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem 2rem;
}
.about-columns h3 { font-size: 1rem; color: var(--text); margin-bottom: .4rem; }
.about-columns p { color: var(--text-2); font-size: var(--fs-sm); margin: 0; }

/* -------------------------------------------------------------- 筛选栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  padding: .85rem;
  margin-bottom: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-search { flex: 1 1 220px; min-width: 180px; }
.filter-search input {
  width: 100%;
  height: 38px;
  padding: 0 .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: var(--fs-sm);
}
.filter-search input::placeholder { color: var(--muted); }
.filter-search input:focus {
  outline: none;
  border-color: rgba(var(--primary-rgb), .6);
}
.filter-bar select {
  height: 38px;
  padding: 0 2rem 0 .8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--input-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='.6' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  background-size: 14px;
  color: var(--text);
  font-size: var(--fs-sm);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.filter-bar select:focus {
  outline: none;
  border-color: rgba(var(--primary-rgb), .6);
}
.filter-bar select option { background: var(--card); color: var(--text); }

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

.game-card {
  position: relative;
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.game-card:hover,
.game-card:focus-visible {
  border-color: rgba(var(--primary-rgb), .5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  color: var(--text);
}
.game-card[hidden] { display: none; }

.game-card-image {
  position: relative;
  width: 100%;
  padding-bottom: 100%;          /* 1:1，与 arcadino 一致 */
  background: linear-gradient(145deg, #241f2b, #14111a);
  overflow: hidden;
}
.game-card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 悬停浮层：Play Now */
.game-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .7rem;
  background: linear-gradient(to top,
              rgba(8, 6, 10, .8) 0%,
              rgba(8, 6, 10, .45) 60%,
              rgba(8, 6, 10, .25) 100%);
  opacity: 0;
  transition: opacity .25s ease;
  z-index: 2;
}
.game-card:hover .game-card-overlay,
.game-card:focus-visible .game-card-overlay { opacity: 1; }

.hover-content { width: 100%; }

/* 常显标题条：目录站必须能扫读名字，不能全靠 hover */
.game-card-body {
  padding: .5rem .6rem .6rem;
  display: flex;
  flex-direction: column;
  gap: .05rem;
}
.game-card-title {
  font-family: var(--font-heading);
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card:hover .game-card-title { color: var(--secondary); }
.game-card-cat {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hover-play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: 0 1.15rem;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.hover-play-button svg { width: 15px; height: 15px; }

/* 状态角标 */
.game-badge {
  position: absolute;
  top: .5rem;
  left: .5rem;
  z-index: 3;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: .18rem .45rem;
  border-radius: 6px;
  color: #fff;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, .16);
}
.game-badge.badge-play { background: rgba(var(--ok-rgb), .88); border-color: transparent; }
.game-badge.badge-external { background: rgba(var(--secondary-rgb), .9); color: #231a00; border-color: transparent; }
.game-badge.badge-warn { background: rgba(255, 152, 0, .9); color: #241500; border-color: transparent; }
.game-badge.badge-muted { background: rgba(255, 255, 255, .14); }

/* 无封面占位 */
.card-no-image {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  color: var(--faint);
  background: linear-gradient(145deg, #241f2b, #14111a);
}

/* ---------------------------------------------------------- 分类卡片 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: .75rem;
}
.category-card {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .9rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s ease, background .2s ease;
  position: relative;
  overflow: hidden;
}
.category-card:hover {
  border-color: rgba(var(--primary-rgb), .5);
  background: var(--card-hover);
  color: var(--text);
}
.category-card strong {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
}
.category-card span { font-size: var(--fs-sm); color: var(--muted); }

/* ------------------------------------------------------------ 侧边面板 */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}
.sidebar section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.sidebar h2 {
  font-size: .95rem;
  margin: 0 0 .75rem;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.category-list .category-card {
  flex: 1 1 calc(50% - .4rem);
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
}
.category-list .category-card strong { font-size: var(--fs-sm); }
.category-list .category-card span { font-size: var(--fs-xs); }

.catalog-info dl {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0 0 .75rem;
}
.catalog-info dl > div {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: var(--fs-sm);
  padding-bottom: .5rem;
  border-bottom: 1px dashed var(--border);
}
.catalog-info dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.catalog-info dt { color: var(--muted); margin: 0; }
.catalog-info dd { margin: 0; font-weight: 600; }
.catalog-info p { font-size: var(--fs-sm); color: var(--muted); margin: 0; }
.catalog-info kbd {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  background: rgba(255, 255, 255, .1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .05rem .3rem;
}

/* -------------------------------------------------------- 面包屑导航 */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 1rem;
}
.breadcrumbs a { color: var(--text-2); }
.breadcrumbs a:hover { color: var(--secondary); }
.breadcrumbs span[aria-current] { color: var(--text); font-weight: 500; }

/* ------------------------------------------------------ 游戏详情：头部 */
.game-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.75rem;
  align-items: start;
  margin-bottom: 1.5rem;
}
.game-overview { min-width: 0; }
.game-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-bottom: .5rem;
}
.game-heading h1 { margin: 0; }
.game-summary {
  color: var(--text-2);
  font-size: .95rem;
  max-width: 72ch;
  margin-bottom: 1rem;
}
.game-artwork {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 10;
}
.game-artwork img { width: 100%; height: 100%; object-fit: cover; }
.cover-unavailable {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--faint);
  font-size: var(--fs-sm);
}

/* 元数据表 */
.metadata {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .6rem .9rem;
  margin: 0 0 1.1rem;
  padding: .9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.metadata > div { min-width: 0; }
.metadata dt {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin: 0 0 .12rem;
}
.metadata dd {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.metadata dd a { color: var(--secondary); }

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

/* 状态徽章 */
.status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: .22rem .55rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.status.good { color: #9ae6a0; background: rgba(var(--ok-rgb), .14); border-color: rgba(var(--ok-rgb), .32); }
.status.external { color: #ffd666; background: rgba(var(--secondary-rgb), .12); border-color: rgba(var(--secondary-rgb), .3); }
.status.warning { color: #ffb74d; background: rgba(255, 152, 0, .13); border-color: rgba(255, 152, 0, .3); }
.status.neutral { color: var(--text-2); background: rgba(255, 255, 255, .08); border-color: var(--border); }

/* ------------------------------------------------------- 游戏详情：标签 */
.section-tabs {
  display: flex;
  gap: .25rem;
  overflow-x: auto;
  padding: .3rem;
  margin: 0 0 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  scrollbar-width: none;
}
.section-tabs::-webkit-scrollbar { display: none; }
.section-tabs a {
  padding: .45rem .95rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
.section-tabs a:hover { background: var(--hover-bg); color: var(--text); }
.section-tabs a.selected {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ----------------------------------------------------- 游戏详情：播放器 */
.play-section {
  margin-bottom: 2rem;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.player-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #08060a;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.player-stage:fullscreen { aspect-ratio: auto; border-radius: 0; border: 0; }

/* 播放器工具栏（对标 arcadino 的 .game-actions 条） */
.game-toolbar {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.game-toolbar + .player-stage {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-top: 0;
}
.game-toolbar-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  object-fit: cover;
  flex: none;
  border: 1px solid var(--border);
}
.game-toolbar-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.game-toolbar-title {
  font-family: var(--font-heading);
  font-size: .95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-toolbar-developer {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-toolbar-buttons {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.game-toolbar-buttons .button { height: 32px; padding: 0 .8rem; }
.game-toolbar-buttons a {
  font-size: var(--fs-sm);
  color: var(--secondary);
  white-space: nowrap;
}
@media (max-width: 560px) {
  .game-toolbar { flex-wrap: wrap; }
  .game-toolbar-buttons { width: 100%; margin-left: 0; }
}

.game-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #08060a;
}

/* .player-message 来自模板，.player-note 由 site.js 动态插入，二者都不要删 */
.player-message,
.player-note {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: .7rem 0 0;
}
.player-note { color: var(--secondary); }

.player-fallback {
  margin-top: .85rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid rgba(var(--secondary-rgb), .3);
  border-radius: var(--radius);
}
.player-fallback p { margin: 0 0 .75rem; font-size: var(--fs-sm); color: var(--text-2); }
.player-fallback .button { margin-right: .5rem; }

.external-player {
  padding: 2rem 1.5rem;
  text-align: center;
  background:
    radial-gradient(80% 120% at 50% 0%, rgba(var(--primary-rgb), .14), transparent 70%),
    var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.external-player h3 { margin-bottom: .5rem; }
.external-player p { color: var(--text-2); font-size: var(--fs-sm); max-width: 60ch; margin: 0 auto 1rem; }
.small { font-size: var(--fs-sm); }
.muted { color: var(--muted); }

/* --------------------------------------------------- 游戏详情：正文区 */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.75rem;
  align-items: start;
}

.content-section {
  margin-bottom: 2rem;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.content-section h2 {
  font-size: 1.25rem;
  margin-bottom: .75rem;
}
.content-section p {
  color: var(--text-2);
  font-size: .95rem;
  max-width: 72ch;
}
.content-section > p:last-child { margin-bottom: 0; }

/* 步骤列表 */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: .55rem;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: .7rem .9rem .7rem 2.6rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: .7rem;
  top: .62rem;
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), .18);
  color: var(--secondary);
  font-family: var(--font-heading);
  font-size: .75rem;
  font-weight: 700;
}

/* 详情表 */
.details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.details-table th,
.details-table td {
  padding: .6rem .9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.details-table tr:last-child th,
.details-table tr:last-child td { border-bottom: 0; }
.details-table th {
  width: 38%;
  color: var(--muted);
  font-weight: 500;
  background: rgba(255, 255, 255, .025);
}
.details-table td { color: var(--text-2); }
.details-table td a { color: var(--secondary); }

/* FAQ */
.faq-list { display: grid; gap: .5rem; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .15rem .9rem;
  transition: border-color .18s ease;
}
.faq-item[open] { border-color: rgba(var(--primary-rgb), .4); }
.faq-item summary {
  cursor: pointer;
  padding: .7rem 0;
  font-weight: 600;
  font-size: var(--fs-sm);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.1rem;
  color: var(--secondary);
  flex: none;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p {
  margin: 0 0 .8rem;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

/* 相关游戏（侧栏链接） */
.related-section { margin-bottom: 0; }
.related-game {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem .25rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.related-game:last-child { border-bottom: 0; }
.related-game:hover { color: var(--text); }
.related-game > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 更多游戏 */
.more-games-section {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

/* 提示文本 */
.list-note,
.notice {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: .9rem 0 0;
}
.notice {
  padding: .7rem .9rem;
  background: rgba(var(--secondary-rgb), .08);
  border: 1px solid rgba(var(--secondary-rgb), .22);
  border-radius: var(--radius-sm);
  color: var(--text-2);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-state h3 { margin-bottom: .4rem; }
.empty-state p { color: var(--muted); font-size: var(--fs-sm); max-width: 48ch; margin: 0 auto 1rem; }

/* ------------------------------------------------------------- 页脚 */
/* 页脚整块通栏，内容列与正文同一居中网格（原来 margin-left 侧栏宽，导致页脚比正文右偏） */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 3rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
}
.site-footer .container {
  max-width: var(--content-w);
  margin-inline: auto;
  padding: 2rem 1.5rem 2.5rem;
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.25rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.footer-top strong {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
}
.footer-top > a { font-size: var(--fs-sm); color: var(--muted); }
.footer-top > a:hover { color: var(--secondary); }
.footer-categories {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .9rem;
  margin-right: auto;
}
.footer-categories a { font-size: var(--fs-sm); color: var(--text-2); }
.footer-categories a:hover { color: var(--secondary); }
.site-footer p {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0 0 .4rem;
  max-width: 88ch;
}

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 1180px) {
  .catalog-layout { grid-template-columns: minmax(0, 1fr); }
  .catalog-layout .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .catalog-layout .sidebar section { flex: 1 1 280px; }
  .game-header { grid-template-columns: minmax(0, 1fr); }
  .game-artwork { order: -1; aspect-ratio: 16 / 9; }
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-layout .sidebar { position: static; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .left-sidebar { display: none; }
  .site-header nav { display: none; }
  main.container { padding: calc(var(--header-h) + 1rem) 1rem 2.5rem; }
  .global-search { max-width: none; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: .65rem; }
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 560px) {
  .header-inner { padding: 0 .85rem; gap: .6rem; }
  .brand { font-size: 1.15rem; }
  .global-search kbd { display: none; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-intro h1 { font-size: 1.7rem; }
  .filter-bar { padding: .65rem; }
  .filter-search { flex: 1 1 100%; }
  .filter-bar select { flex: 1 1 calc(50% - .3rem); }
  .player-stage { aspect-ratio: 4 / 3; }
  .metadata { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 触摸设备没有 hover：不显示浮层按钮（整张卡都可点），标题条已常显 */
@media (hover: none) {
  .game-card-overlay { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 打印：只留文字与链接 */
@media print {
  .site-header, .left-sidebar, .site-footer, .filter-bar, .game-actions { display: none; }
  main.container { max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
}
