/* 轻量级静态游戏站 — 全局样式
   无外部字体/框架依赖，保证首屏性能与 Core Web Vitals */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #12161f;
  --muted: #5b6472;
  --accent: #2563eb;
  --accent-weak: #eaf0ff;
  --border: #e3e7ee;
  --ok: #15803d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --max: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b23;
    --text: #eef1f6;
    --muted: #9aa4b2;
    --accent: #7aa2ff;
    --accent-weak: #1b2436;
    --border: #262c37;
    --ok: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  font-size: 1.02rem;
}
.brand .logo {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  font-size: 15px;
}
.nav { display: flex; gap: 18px; font-size: .92rem; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 28px; }
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  line-height: 1.22;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
.hero .lede {
  font-size: 1.06rem;
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 22px;
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}
.facts li {
  font-size: .82rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
}
.facts strong { color: var(--text); }
/* 正文内的链接不能只靠颜色区分（WCAG 1.4.1） */
.facts a,
.faq a,
.section-sub a,
.lede a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* AI / 搜索摘要块：位于首屏，便于生成式引擎直接摘录 */
.tldr {
  margin: 18px 0 0;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  max-width: 62ch;
}
.tldr p {
  margin: 0;
  font-size: .92rem;
  line-height: 1.7;
  color: var(--text);
}
.tldr strong { color: var(--accent); }

/* ---------- Section ---------- */
.section { padding: 34px 0; }
.section > .wrap > h2 {
  font-size: 1.32rem;
  margin: 0 0 6px;
  letter-spacing: -.01em;
}
.section-sub {
  color: var(--muted);
  font-size: .94rem;
  margin: 0 0 20px;
}

/* ---------- Game grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h3 { margin: 0; font-size: 1.06rem; }
.card h3 a { color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  font-size: .72rem;
  color: var(--muted);
  background: var(--accent-weak);
  border-radius: 6px;
  padding: 2px 8px;
}
.play {
  margin-top: 8px;
  align-self: flex-start;
  font-weight: 650;
  font-size: .9rem;
}
.play::after { content: " →"; }

/* ---------- FAQ ---------- */
.faq { max-width: 78ch; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  font-weight: 650;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "＋ "; color: var(--accent); }
.faq details[open] summary::before { content: "－ "; }
.faq p { margin: 10px 0 0; color: var(--muted); font-size: .94rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 26px 0 40px;
  color: var(--muted);
  font-size: .86rem;
}
.site-footer p { margin: 6px 0; }
.site-footer a { color: var(--muted); text-decoration: underline; }

/* ---------- Game page shell ---------- */
.game-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.game-top {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.game-top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 12px;
}
.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 40px;
  gap: 14px;
}
.game-main h1 { font-size: 1.3rem; margin: 0; }

/* 可见面包屑：与页面内 BreadcrumbList 结构化数据保持一致 */
.crumb-bar { padding: 8px 0 0; }
.crumb-bar ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  font-size: .82rem;
  color: var(--muted);
}
.crumb-bar li { display: flex; align-items: center; gap: 6px; }
.crumb-bar li + li::before { content: "›"; color: var(--muted); }
.crumb-bar a { color: var(--muted); text-decoration: none; }
.crumb-bar a:hover { color: var(--text); text-decoration: underline; }
.crumb-bar [aria-current="page"] { color: var(--text); font-weight: 600; }
.game-main .hint { color: var(--muted); font-size: .88rem; text-align: center; max-width: 46ch; }

/* 游戏页正文文档区。
   .game-main 是 flex 居中的，所以这里显式 width/max-width + text-align:left，
   让长文按阅读栏宽居中排布，而不是被居中成一团。 */
.game-doc {
  width: 100%;
  max-width: 72ch;
  text-align: left;
  margin-top: 10px;
}
.game-doc h2 { font-size: 1rem; margin: 24px 0 8px; }
.game-doc h2:first-child { margin-top: 0; }
.game-doc p,
.game-doc li {
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.75;
}
.game-doc p { margin: 0 0 10px; }
.game-doc ul,
.game-doc ol { margin: 0 0 10px; padding-left: 1.3em; }
.game-doc li { margin: 5px 0; }
.game-doc strong { color: var(--text); }
.game-doc kbd {
  display: inline-block;
  font-family: inherit;
  font-size: .82em;
  line-height: 1.4;
  padding: 1px 6px;
  margin: 0 1px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}
.game-doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: .9rem;
}
.game-doc th,
.game-doc td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
  color: var(--muted);
}
.game-doc th {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  width: 34%;
}
.game-doc caption {
  caption-side: top;
  text-align: left;
  color: var(--muted);
  font-size: .82rem;
  padding-bottom: 6px;
}
/* 正文链接不能只靠颜色区分（WCAG 1.4.1） */
.game-doc a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.board-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  touch-action: none;
}
canvas { display: block; border-radius: 8px; max-width: 100%; height: auto; }

.hud {
  display: flex;
  gap: 22px;
  font-size: .92rem;
  color: var(--muted);
  flex-wrap: wrap;
  justify-content: center;
}
.hud b { color: var(--text); font-variant-numeric: tabular-nums; }

.btn {
  font: inherit;
  font-weight: 650;
  font-size: .92rem;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(3px);
  border-radius: 8px;
  text-align: center;
  padding: 20px;
}
.overlay[hidden] { display: none; }
.overlay h2 { margin: 0 0 6px; font-size: 1.2rem; }
.overlay p { margin: 0 0 14px; color: var(--muted); }
.board-relative { position: relative; }

@media (max-width: 640px) {
  .hero { padding: 34px 0 18px; }
  .nav { gap: 12px; font-size: .86rem; }
}

/* 无障碍：尊重系统「减少动态效果」偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
