/* =================================================================
   Lite Arcade — 站点样式
   设计约束：零外部请求 / 系统字体栈 / 内联关键样式 / 移动端优先
   ================================================================= */

/* ------------------------------ 设计令牌 ------------------------------ */
:root {
  --bg:            #070a16;
  --bg-soft:       #0b1020;
  --bg-card:       #111a31;
  --bg-elev:       #16203c;
  --line:          #22304f;
  --text:          #e8edf9;
  --text-dim:      #9aa8c7;
  --text-mute:     #6f7f9f;
  --brand:         #6ee7ff;
  --brand-2:       #a78bfa;
  --accent:        #ffd166;
  --danger:        #ff6b81;
  --ok:            #4ade80;
  --radius:        14px;
  --radius-sm:     9px;
  --shadow:        0 10px 30px rgba(0, 0, 0, .45);
  --maxw:          1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

/* ------------------------------ 基础重置 ------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(110, 231, 255, .13), transparent 60%),
    radial-gradient(900px 520px at 92% 4%, rgba(167, 139, 250, .13), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}
img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.9rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.3rem); }
p  { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin-bottom: .3em; }
strong { color: #fff; }
code { font-family: var(--mono); font-size: .92em; background: rgba(110,231,255,.1); color: var(--brand); padding: .12em .4em; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------ 布局容器 ------------------------------ */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 56px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: 28px; }
.section-head p { color: var(--text-dim); margin-bottom: 0; }
.eyebrow {
  display: inline-block; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brand); font-weight: 700; margin-bottom: .6rem;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--brand); color: #04121a;
  padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ------------------------------ 顶栏 ------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 10, 22, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: #fff; font-size: 1.06rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #04121a; font-weight: 900; font-size: .95rem;
}
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a {
  color: var(--text-dim); font-size: .93rem; padding: 7px 11px; border-radius: 8px; font-weight: 600;
}
.nav a:hover { color: #fff; background: var(--bg-elev); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--brand); background: rgba(110,231,255,.1); }

/* ------------------------------ Hero ------------------------------ */
.hero { padding: 60px 0 34px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.badge {
  font-size: .78rem; padding: 4px 11px; border-radius: 999px; font-weight: 700;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text-dim);
}
.badge-brand { border-color: rgba(110,231,255,.4); color: var(--brand); background: rgba(110,231,255,.08); }
.hero h1 { margin-bottom: .45em; }
.hero .lede { font-size: 1.08rem; color: var(--text-dim); max-width: 62ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 11px; font-weight: 700; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer; transition: transform .12s ease, box-shadow .18s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #04121a; box-shadow: 0 8px 22px rgba(110,231,255,.22); }
.btn-ghost { border-color: var(--line); color: var(--text); background: var(--bg-soft); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

/* 答案前置卡片（GEO 核心） */
.answer-card {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.answer-card h2 { font-size: 1.05rem; margin-bottom: .5em; color: var(--brand); }
.answer-card p { margin: 0; color: var(--text-dim); font-size: .98rem; }
.fact-list { margin: 18px 0 0; padding: 0; list-style: none; }
.fact-list li {
  display: flex; gap: 10px; align-items: flex-start; font-size: .93rem;
  padding: 7px 0; border-top: 1px dashed var(--line); color: var(--text-dim); margin: 0;
}
.fact-list li::before { content: "▸"; color: var(--brand); flex: none; }

/* 事实清单：术语 + 定义，便于抓取与引用 */
.fact-dl { margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.fact-dl dt {
  font-size: .82rem; color: var(--brand); font-weight: 700; white-space: nowrap;
  padding-top: 6px; border-top: 1px dashed var(--line);
}
.fact-dl dd {
  margin: 0; font-size: .88rem; color: var(--text-dim);
  padding-top: 6px; border-top: 1px dashed var(--line);
}
@media (max-width: 480px) {
  .fact-dl { grid-template-columns: 1fr; gap: 2px; }
  .fact-dl dd { padding-top: 0; border-top: 0; margin-bottom: 8px; }
}

/* 屏幕阅读器专用文本 */
.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;
}

/* ------------------------------ 统计条 ------------------------------ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 30px; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 14px; text-align: center;
}
.stat b { display: block; font-size: 1.55rem; color: #fff; line-height: 1.2; }
.stat span { font-size: .82rem; color: var(--text-mute); }

/* ------------------------------ 卡片网格 ------------------------------ */
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.card:hover { border-color: rgba(110,231,255,.45); transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.card-thumb {
  aspect-ratio: 16 / 10; display: grid; place-items: center;
  font-size: 2.7rem; background:
    linear-gradient(135deg, rgba(110,231,255,.14), rgba(167,139,250,.14));
  border-bottom: 1px solid var(--line);
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; font-size: 1.05rem; }
.card-body h3 a { color: #fff; }
.card-body h3 a:hover { color: var(--brand); }
.card-body p { margin: 0; font-size: .9rem; color: var(--text-dim); }
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.tag {
  font-size: .74rem; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-elev); color: var(--text-dim); border: 1px solid var(--line);
}
.tag-src { color: var(--brand); border-color: rgba(110,231,255,.35); }
.tag-star { color: var(--accent); border-color: rgba(255,209,102,.35); }

/* ------------------------------ 筛选工具条 ------------------------------ */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 20px; padding: 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-soft);
}
.toolbar label { font-size: .85rem; color: var(--text-mute); }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--text-dim); font-size: .86rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip[aria-pressed="true"] { background: rgba(110,231,255,.14); border-color: var(--brand); color: var(--brand); }
.search {
  flex: 1; min-width: 180px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font-family: inherit; font-size: .9rem;
}
.search:focus { outline: none; border-color: var(--brand); }

/* ------------------------------ 表格 ------------------------------ */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 620px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--bg-elev); color: var(--brand); font-weight: 700; white-space: nowrap; }
td { color: var(--text-dim); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(110,231,255,.045); }

/* ------------------------------ 游戏运行区 ------------------------------ */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.stage {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stage-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.stage-head h1 { font-size: 1.25rem; margin: 0; }
.hud { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.hud-item {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 12px; font-size: .82rem; color: var(--text-dim); white-space: nowrap;
}
.hud-item b { color: #fff; font-variant-numeric: tabular-nums; }
.canvas-box { position: relative; border-radius: 10px; overflow: hidden; background: #05070f; }
canvas { width: 100%; height: auto; display: block; touch-action: none; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: rgba(5, 7, 15, .84); backdrop-filter: blur(3px); padding: 20px;
}
.overlay[hidden] { display: none; }
.overlay h2 { margin-bottom: .3em; }
.overlay p { color: var(--text-dim); margin-bottom: 1em; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.panel {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.panel h2 { font-size: 1rem; margin-bottom: .6em; }
.panel ul { font-size: .9rem; color: var(--text-dim); margin-bottom: 0; padding-left: 1.1em; }
.kbd-rows { display: grid; gap: 8px; }
.kbd-row { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; }
.kbd-row span:first-child { color: var(--text-mute); }
kbd {
  font-family: var(--mono); font-size: .8rem; background: var(--bg-elev);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  padding: 2px 7px; color: var(--text);
}

/* ------------------------------ FAQ ------------------------------ */
.faq { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  cursor: pointer; padding: 15px 18px; font-weight: 700; color: #fff;
  list-style: none; display: flex; justify-content: space-between; gap: 14px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-size: 1.25rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq summary:hover { background: var(--bg-elev); }
.faq .faq-a { padding: 0 18px 16px; color: var(--text-dim); font-size: .93rem; margin: 0; }

/* ------------------------------ 内容排版 ------------------------------ */
.prose { max-width: 78ch; }
.prose h2 { margin-top: 2em; }
.prose h3 { margin-top: 1.5em; }
.prose ul li, .prose ol li { color: var(--text-dim); }
.prose a { text-decoration: underline; }
.note {
  border-left: 3px solid var(--brand); background: var(--bg-soft);
  padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim); font-size: .92rem; margin: 1.5em 0;
}
.source-line { font-size: .82rem; color: var(--text-mute); margin-top: 10px; }
.source-line a { color: var(--text-dim); }

/* ------------------------------ 页脚 ------------------------------ */
.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 40px 0 30px; background: rgba(7,10,22,.6); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
.footer h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-mute); margin-bottom: .8em; }
.footer ul { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.footer li { margin-bottom: .45em; }
.footer a { color: var(--text-dim); }
.footer a:hover { color: var(--brand); }
.footer-bottom {
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: .82rem; color: var(--text-mute);
}

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .game-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .section { padding: 40px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .nav a { padding: 6px 8px; font-size: .87rem; }
  .brand span.brand-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* 高对比度模式：提升文字与描边对比 */
@media (prefers-contrast: more) {
  :root {
    --text: #ffffff;
    --text-dim: #dde5f7;
    --text-mute: #bcc8e2;
    --line: #4a5d86;
  }
  .card, .panel, .stat, .toolbar, .faq, .table-scroll { border-width: 2px; }
  .btn { border-width: 2px; }
}

/* Windows 强制颜色模式 */
@media (forced-colors: active) {
  .card, .chip, .btn, .stat, .panel { border: 1px solid ButtonBorder; }
  .btn-primary { background: ButtonFace; color: ButtonText; }
  .brand-mark { border: 1px solid ButtonBorder; }
}

/* 长列表渲染性能：仅对可能包含数十项的目录网格启用 */
#catalog-grid > .card { content-visibility: auto; contain-intrinsic-size: auto 250px; }

@media print {
  .topbar, .toolbar, .controls, .footer { display: none !important; }
  body { background: #fff; color: #000; }
}
