/* ============================================================
   EGAME Showcase — 一比一复刻对标页（showcase.blackwhite.games）
   Palette 刻意无彩色：品牌就是黑白，强调只靠字重、字号与 105° 斜线。
   版式度量（1180 容器 / 290 卡宽 / clamp 字阶 / 斜线发丝线）逐项对齐。
   ------------------------------------------------------------
   NOTE: 字体走本仓库自托管（/static/fonts.css），没有外链请求。
   ============================================================ */

:root {
  --paper:      #F7F7F4;
  --surface:    #FFFFFF;
  --surface-2:  #EFEFEA;
  --text:       #0B0B0D;
  --text-dim:   #6C6E75;
  --text-faint: #9B9DA3;
  --hair:       #DCDCD6;
  --hair-soft:  #E8E8E2;
  --invert-bg:  #0B0B0D;
  --invert-fg:  #F7F7F4;

  --tilt: -1.2deg;
  --measure: 63ch;

  --step--1: clamp(0.76rem, 0.74rem + 0.1vw, 0.82rem);
  --step-0:  clamp(0.97rem, 0.94rem + 0.15vw, 1.06rem);
  --step-1:  clamp(1.18rem, 1.1rem + 0.35vw, 1.4rem);
  --step-2:  clamp(1.5rem, 1.34rem + 0.7vw, 2rem);
  --step-3:  clamp(2rem, 1.6rem + 1.8vw, 3.2rem);
  --step-4:  clamp(2.9rem, 1.9rem + 4.6vw, 6.6rem);

  /* Archivo/Newsreader 没有中日韩字形，CJK 走系统字体逐字回退 */
  --cjk:     "PingFang SC", "PingFang TC", "Hiragino Sans GB", "Microsoft YaHei",
             "Microsoft JhengHei", "Noto Sans CJK SC", "Noto Sans CJK TC", sans-serif;
  --display: "Archivo", "Helvetica Neue", Arial, var(--cjk);
  --prose:   "Newsreader", Georgia, "Times New Roman", var(--cjk), serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, var(--cjk), monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--prose);
  font-size: var(--step-0);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: clamp(1.15rem, 4vw, 3.5rem); }

/* ---------- shared type roles ---------- */
.eyebrow {
  font-family: var(--display);
  font-variation-settings: "wdth" 112, "wght" 650;
  font-size: var(--step--1);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0;
}
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; }
h1 { font-variation-settings: "wdth" 118, "wght" 820; font-size: var(--step-4); line-height: 0.94; letter-spacing: -0.025em; }
h2 { font-variation-settings: "wdth" 115, "wght" 780; font-size: var(--step-3); line-height: 1.02; letter-spacing: -0.018em; }
h3 { font-variation-settings: "wdth" 112, "wght" 700; font-size: var(--step-1); line-height: 1.15; letter-spacing: -0.008em; }
.lede { font-size: var(--step-1); line-height: 1.5; max-width: var(--measure); color: var(--text); margin: 0; font-weight: 300; }
.lede em { font-style: italic; }
p { max-width: var(--measure); margin: 0; }
.dim { color: var(--text-dim); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* CJK 不需要负字距，字重也要更实 */
:root[lang^="zh"] h1,
:root[lang^="zh"] h2,
:root[lang^="zh"] h3 { letter-spacing: 0; font-weight: 700; }
:root[lang^="zh"] h1 { line-height: 1.12; }
:root[lang^="zh"] h2 { line-height: 1.2; }
:root[lang^="zh"] body,
:root[lang^="zh"] p,
:root[lang^="zh"] .lede { line-height: 1.85; }
:root[lang^="zh"] .lede { font-weight: 400; }
:root[lang^="zh"] .eyebrow { letter-spacing: 0.18em; }
:root[lang^="zh"] .card .blurb { max-width: 26em; }
:root[lang^="zh"] .lede em { font-style: normal; font-weight: 600; }

/* 斜线发丝线 —— 整页的结构签名 */
.rule {
  height: 1px; background: var(--hair); border: 0; margin: 0;
  transform: skewY(var(--tilt)); transform-origin: left center;
}

/* ---------- hero ---------- */
.hero { padding-block: clamp(2.6rem, 7vh, 5rem) clamp(2.5rem, 6vh, 4.5rem); }
.hero-top { display: flex; flex-wrap: wrap; gap: 1.1rem 2rem; align-items: center; justify-content: space-between; }

.mark {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--display);
  font-variation-settings: "wdth" 120, "wght" 850;
  font-size: var(--step-1);
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.mark-glyph {
  width: 1.15em; height: 1.15em; border-radius: 0.26em;
  background: linear-gradient(105deg, var(--text) 0 47%, transparent 47% 100%);
  box-shadow: inset 0 0 0 1.6px var(--text);
  flex: none;
}

/* ---------- locale / status toggle ---------- */
.langs { display: flex; border: 1px solid var(--hair); }
.langs button, .langs span {
  appearance: none; background: none; border: 0;
  border-left: 1px solid var(--hair);
  font-family: var(--display);
  font-variation-settings: "wdth" 108, "wght" 640;
  font-size: 0.73rem; letter-spacing: 0.08em;
  color: var(--text-dim); cursor: pointer;
  padding: 0.58em 0.85em; line-height: 1;
  transition: background 160ms ease, color 160ms ease;
}
.langs > *:first-child { border-left: 0; }
.langs button:hover { color: var(--text); }
.langs button[aria-pressed="true"], .langs span[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-fg); }
.langs button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.hero .eyebrow { margin-top: clamp(1.9rem, 4.5vh, 3rem); }
.hero h1 { margin-top: 0.7rem; }
.hero h1 .split {
  background: linear-gradient(105deg, var(--text) 0 49.4%, var(--text-faint) 49.4% 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero .lede { margin-top: clamp(1.3rem, 3vh, 2rem); }

.facts {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: clamp(2.2rem, 5vh, 3.4rem);
  background: var(--hair);
  border: 1px solid var(--hair);
}
.fact { background: var(--paper); padding: 1.05rem 1.15rem 1.15rem; }
.fact dt {
  font-family: var(--display);
  font-variation-settings: "wdth" 108, "wght" 620;
  font-size: 0.7rem; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--text-dim); margin: 0 0 0.5rem;
}
.fact dd {
  margin: 0; font-family: var(--display);
  font-variation-settings: "wdth" 116, "wght" 800;
  font-size: var(--step-2); line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.fact dd small { font-variation-settings: "wdth" 108, "wght" 600; font-size: 0.42em; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); display: block; margin-top: 0.5rem; line-height: 1.35; }

/* ---------- sections ---------- */
.section { padding-block: clamp(3.2rem, 8vh, 5.5rem); }
.section-head { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: clamp(2rem, 5vh, 3rem); }

/* ---------- game cards ---------- */
.games { display: grid; gap: clamp(1rem, 2.2vw, 1.6rem); grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hair);
  padding: clamp(1.2rem, 2.2vw, 1.7rem);
  transition: background 260ms ease, border-color 260ms ease, color 260ms ease;
  overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 0 49.7%, currentColor 49.7% 49.9%, transparent 49.9% 100%);
  opacity: 0.09; transition: opacity 260ms ease;
}
.card:hover, .card:focus-within {
  background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg);
}
.card:hover::after, .card:focus-within::after { opacity: 0.22; }
.card:hover .dim, .card:focus-within .dim,
.card:hover .spec dt, .card:focus-within .spec dt,
.card:hover .chip, .card:focus-within .chip { color: inherit; opacity: 0.72; }
.card:hover .chip, .card:focus-within .chip { border-color: currentColor; }
.card:hover .spec, .card:focus-within .spec { border-color: color-mix(in srgb, currentColor 24%, transparent); }
.card:hover .spec > div + div, .card:focus-within .spec > div + div { border-color: color-mix(in srgb, currentColor 18%, transparent); }

.card-tile {
  width: clamp(104px, 25%, 132px); aspect-ratio: 3 / 4;
  margin-bottom: 1.15rem; flex: none; border-radius: 10px; overflow: hidden;
}
.card-tile img { display: block; width: 100%; height: 100%; object-fit: contain; }

.card-title { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.chip {
  font-family: var(--display);
  font-variation-settings: "wdth" 106, "wght" 620;
  font-size: 0.63rem; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--text-dim); border: 1px solid var(--hair); padding: 0.24em 0.55em;
  transition: color 260ms ease, border-color 260ms ease; white-space: nowrap;
}
.card .blurb { font-size: var(--step--1); line-height: 1.55; margin-top: 0.75rem; max-width: 42ch; }

.spec {
  margin: 1.25rem 0 0; border-top: 1px solid var(--hair);
  font-family: var(--mono); font-size: 0.735rem; line-height: 1.45;
  transition: border-color 260ms ease;
}
.spec > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.5rem 0;
}
.spec > div + div { border-top: 1px solid var(--hair-soft); transition: border-color 260ms ease; }
.spec dt { color: var(--text-dim); letter-spacing: 0.03em; text-transform: uppercase; font-size: 0.66rem; transition: color 260ms ease; }
.spec dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

.card-actions { margin-top: auto; padding-top: 1.35rem; display: flex; flex-direction: column; gap: 0.6rem; }
.play {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  width: 100%;
  font-family: var(--display);
  font-variation-settings: "wdth" 112, "wght" 740;
  font-size: 0.83rem; letter-spacing: 0.055em; text-transform: uppercase;
  text-decoration: none; color: inherit;
  background: transparent;
  border: 1.5px solid currentColor; padding: 0.72em 0.95em;
  /* <button> 默认 line-height:normal，会比对标站的 <a> 矮 6px；显式对齐 */
  line-height: 1.62;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}
.play .arw { transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.play:hover, .play:focus-visible { background: currentColor; }
.play:hover .lbl, .play:focus-visible .lbl,
.play:hover .arw, .play:focus-visible .arw { color: var(--surface); mix-blend-mode: normal; }
.card:hover .play:hover .lbl, .card:hover .play:focus-visible .lbl,
.card:hover .play:hover .arw, .card:hover .play:focus-visible .arw { color: var(--invert-bg); }
.play:hover .arw, .play:focus-visible .arw { transform: translateX(3px); }
.play[disabled] { opacity: 0.55; cursor: progress; }

.url { font-family: var(--mono); font-size: 0.665rem; color: var(--text-dim); overflow-wrap: break-word; text-decoration: none; transition: color 260ms ease; }
.url:hover { color: var(--text); }
.card:hover .url, .card:focus-within .url { color: inherit; opacity: 0.6; }

/* ---------- platform / integration ---------- */
.cols { display: grid; gap: clamp(1.8rem, 4vw, 3.2rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); }
.block h3 { margin-bottom: 0.85rem; }
.block p { font-size: var(--step--1); line-height: 1.6; color: var(--text-dim); }

.deck { list-style: none; margin: 0.9rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.deck li { font-family: var(--mono); font-size: 0.735rem; line-height: 1.5; padding-left: 1.25rem; position: relative; color: var(--text-dim); }
.deck li::before {
  content: ""; position: absolute; left: 0; top: 0.5em;
  width: 0.6rem; height: 0.6rem;
  background: linear-gradient(105deg, var(--text) 0 47%, transparent 47% 100%);
  box-shadow: inset 0 0 0 1.2px var(--text);
}
.deck li b { color: var(--text); font-weight: 600; }

.tbl-scroll { overflow-x: auto; margin-top: 1.5rem; }
table { border-collapse: collapse; width: 100%; min-width: 620px; font-family: var(--mono); font-size: 0.75rem; }
caption { text-align: left; font-family: var(--display); font-variation-settings: "wdth" 108, "wght" 620; font-size: var(--step--1); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); padding-bottom: 0.9rem; }
th, td { text-align: left; padding: 0.68rem 0.9rem 0.68rem 0; border-bottom: 1px solid var(--hair-soft); vertical-align: top; }
thead th { border-bottom: 1px solid var(--hair); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); font-weight: 500; }
tbody th { font-weight: 600; white-space: nowrap; }
td { font-variant-numeric: tabular-nums; color: var(--text-dim); }
td.num { text-align: right; padding-right: 0; color: var(--text); }

.note { font-size: var(--step--1); line-height: 1.6; color: var(--text-dim); border-left: 2px solid var(--hair); padding-left: 1.1rem; max-width: var(--measure); }

/* ---------- close ---------- */
.close { padding-block: clamp(3.2rem, 8vh, 5rem) clamp(3rem, 7vh, 4.5rem); }
.close-grid { display: grid; gap: clamp(1.6rem, 4vw, 3rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin-top: 2rem; }
.step .n {
  font-family: var(--display); font-variation-settings: "wdth" 118, "wght" 820;
  font-size: var(--step-2); line-height: 1; display: block; margin-bottom: 0.6rem;
  font-variant-numeric: tabular-nums;
}
.step p { font-size: var(--step--1); color: var(--text-dim); line-height: 1.6; }
.step a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

footer { padding-block: 2rem 3.5rem; display: flex; flex-wrap: wrap; gap: 0.9rem 2rem; justify-content: space-between; align-items: baseline; }
footer .mono { font-size: 0.7rem; color: var(--text-faint); letter-spacing: 0.02em; }

a:focus-visible, .card:focus-within { outline: 2px solid var(--text); outline-offset: 3px; }

/* 窄屏：标题自然折行，并补上指标条奇数格留下的空档 */
@media (max-width: 620px) {
  h1 br, h2 br { display: none; }
  .fact:last-child { grid-column: 1 / -1; }
  .hero-top { gap: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* 开局失败提示（对标站没有这一段，但 demo 必须有反馈；保持同一套黑白语言） */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  z-index: 50;
  max-width: min(88vw, 460px);
  padding: 0.7rem 1rem;
  transform: translate(-50%, 14px);
  background: var(--invert-bg);
  color: var(--invert-fg);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }
