/* 跃火 / JumpSpark arcade — v2 presentation layer
   Warm paper + ember accent, coin-stamped DeepSeek scores, full-bleed cover grid. */

:root {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #ffffff;
  --ink: #1d1a16;
  --ink-2: #3b3631;
  --quiet: #5f584f;
  --faint: #746b60;
  --line: #e7e0d5;
  --line-strong: #d3c9ba;
  --accent: #b83a14;
  --accent-ink: #ffffff;
  --accent-wash: rgb(184 58 20 / 0.09);
  --gold: #9c6b12;
  --gold-bg: #f3e6c8;
  --gold-ink: #3f2d06;
  --mark: #fbdcae;
  --shadow-1: 0 1px 2px rgb(29 26 22 / 0.06);
  --shadow-2: 0 12px 28px -14px rgb(29 26 22 / 0.35), 0 2px 6px rgb(29 26 22 / 0.06);
  --radius: 10px;
  --gutter: clamp(16px, 2.2vw, 40px);
  --gap: clamp(16px, 1.35vw, 26px);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --sans: "Inter", "SF Pro Text", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-family: var(--sans);
  font-synthesis-weight: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #141310;
    --surface: #1d1b17;
    --ink: #f2ece2;
    --ink-2: #d8d0c4;
    --quiet: #b3a99b;
    --faint: #9d9487;
    --line: #2d2923;
    --line-strong: #423c33;
    --accent: #ff8a5c;
    --accent-ink: #1a0d06;
    --accent-wash: rgb(255 138 92 / 0.14);
    --gold: #f2c46b;
    --gold-bg: #3a2d12;
    --gold-ink: #ffe6ad;
    --mark: #5b4213;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 16px 34px -16px rgb(0 0 0 / 0.8), 0 2px 8px rgb(0 0 0 / 0.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 150px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
html { touch-action: manipulation; }
svg { display: block; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; box-decoration-break: clone; }

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

.sr {
  position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; inset-block-start: 10px; inset-inline-start: 10px; z-index: 50;
  padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--paper);
  font-weight: 650; text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}
.skip:focus-visible { transform: none; }

/* ------------------------------------------------------------------ header */

.top { position: relative; z-index: 5; }
.masthead,
.toolbar,
.filterbar {
  display: flex; align-items: center;
  padding-inline: var(--gutter);
}

.masthead {
  gap: 14px;
  min-height: 68px;
  padding-block: 12px;
}

.brand {
  display: inline-flex; align-items: center; gap: 11px;
  color: var(--ink); text-decoration: none; min-width: 0;
}
.mark { inline-size: 32px; block-size: 32px; flex: none; }
.mark rect { fill: var(--accent); }
.mark path { fill: var(--paper); }
.brand-name {
  min-inline-size: 0;
  font-family: var(--serif);
  font-size: clamp(18px, 1.55vw, 22px);
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.language {
  margin-inline-start: auto;
  display: inline-flex; align-items: center;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.language[hidden] { display: none; }
.language button {
  min-inline-size: 44px;
  min-block-size: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--quiet);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  transition: background-color 140ms ease, color 140ms ease;
}
.language button:hover { color: var(--ink); }
.language button { flex-shrink: 0; white-space: nowrap; }
.language [aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.language [aria-pressed="true"]:hover { color: var(--paper); }

/* title + count + search row */
.toolbar {
  gap: 16px 22px;
  padding-block: 14px 12px;
  border-block-start: 1px solid var(--line);
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.count {
  margin: 6px 0 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--quiet);
  white-space: nowrap;
}
.count.is-filtered { color: var(--accent); font-weight: 650; }

.search {
  position: relative;
  flex: 1 1 300px;
  display: flex; align-items: center;
  max-inline-size: 440px;
  margin-inline-start: auto;
  min-block-size: 44px;
  padding: 0 46px 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.search:hover { border-color: var(--quiet); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search-icon {
  position: absolute; inset-inline-start: 12px; inset-block-start: 50%;
  inline-size: 17px; block-size: 17px;
  translate: 0 -50%;
  fill: none; stroke: var(--quiet); stroke-width: 1.7; stroke-linecap: round;
  pointer-events: none;
}
.search input {
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  color: var(--ink);
}
.search input::placeholder { color: var(--quiet); }
.search input::-webkit-search-cancel-button,
.search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.clear {
  position: absolute; inset-inline-end: 5px; inset-block-start: 50%;
  translate: 0 -50%;
  inline-size: 34px; block-size: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--quiet);
}
.clear:hover { background: var(--accent-wash); color: var(--ink); }
.clear svg { inline-size: 16px; block-size: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.clear[hidden] { display: none; }

/* genre chips */
.filterbar {
  padding-block: 4px 10px;
  border-block-end: 1px solid var(--line);
}
.filters {
  display: flex;
  gap: 8px;
  inline-size: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding-block: 2px 8px;
  scroll-padding-inline: var(--gutter);
  mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 28px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 28px), transparent);
}
.filters::-webkit-scrollbar { height: 4px; }
.filters::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.filters button {
  flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  min-block-size: 36px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.filters button::after {
  content: attr(data-count);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}
.filters button:hover { border-color: var(--ink); }
.filters [aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.filters [aria-pressed="true"]::after { color: var(--paper); opacity: 0.66; }

/* -------------------------------------------------------------------- grid */

#main { min-block-size: 60vh; }
.catalog { padding-inline: calc(2 * var(--gutter)); padding-block: clamp(18px, 2vw, 28px) 56px; }

.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 276px), 1fr));
  gap: clamp(18px, 1.5vw, 30px) var(--gap);
}

.game {
  container-type: inline-size;
  --cover-aspect: 16 / 9;
  position: relative;
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}


.cover {
  position: relative;
  display: block;
  aspect-ratio: var(--cover-aspect);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--cover-color, #222);
  box-shadow: var(--shadow-1);
  isolation: isolate;
  transition: box-shadow 220ms ease, transform 220ms ease;
}
.cover::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 2;
  box-shadow: inset 0 0 0 1px rgb(29 26 22 / 0.12);
  border-radius: inherit;
  pointer-events: none;
}
.cover-frame { position: absolute; inset: 0; display: block; }
.cover img {
  inline-size: 100%; block-size: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 45%;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity 420ms ease, transform 520ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cover img.is-loaded { opacity: 1; transform: none; }

/* The complete cover is the launch link. */
.cover-play {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 3;
  display: inline-grid;
  place-items: center;
  translate: -50% -50%;
  min-block-size: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgb(23 20 17 / 0.88);
  color: #fff;
  font-size: 13px;
  font-weight: 680;
  white-space: nowrap;
  pointer-events: none;
}
.cover { text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .cover-play { opacity: 0; transition: opacity 160ms ease; }
  .cover:hover .cover-play, .cover:focus-visible .cover-play { opacity: 1; }
}

.game-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.description {
  margin: 5px 0 0;
  color: var(--quiet);
  font-size: 14px;
  line-height: 1.55;
  min-block-size: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.game-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  margin-block-start: 12px;
}
.game-identity, .game-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.game-stats {
  align-items: flex-end;
  text-align: end;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.genre, .player-count, .rating-score > span {
  color: var(--quiet);
  font-size: 11.5px;
  line-height: 1.35;
}
.rating-score {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1;
}
.rating-value {
  font-size: 21px;
  font-weight: 720;
  color: var(--ink);
}
@container (max-width: 205px) {
  .rating-value { font-size: 17px; }
  .rating-score > span, .player-count, .genre { font-size: 10px; }
}

.cover:focus-visible { outline-offset: 3px; }

.text-cover {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 14px;
  overflow-wrap: anywhere;
  text-align: center;
  color: #f4efdf;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  background:
    radial-gradient(ellipse at 72% 18%, rgb(255 255 255 / 0.16), transparent 62%),
    var(--cover-color, #2b2f38);
}

/* ---------------------------------------------------------- empty & footer */

.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding-block: clamp(48px, 8vw, 96px);
  text-align: center;
  color: var(--quiet);
}
.empty[hidden] { display: none; }
.empty p { margin: 0; font-size: 16px; }
.empty button {
  min-block-size: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
}
.empty button:hover { border-color: var(--ink); }
.noscript { padding: 40px var(--gutter); }

.foot {
  border-block-start: 1px solid var(--line);
}
.foot-inner {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px;
  padding: 22px var(--gutter) 30px;
  color: var(--quiet);
  font-size: 12.5px;
}
.foot-inner p { margin: 0; }
.foot-brand {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.foot-brand span { color: var(--faint); font-weight: 400; }
body.is-leaving .game .cover { cursor: progress; }

/* --------------------------------------------------------------- responsive */

@media (min-width: 1280px) {
  .games { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .games { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
  .description { font-size: 13.5px; }
}

@media (max-width: 720px) {
  html { scroll-padding-top: 170px; }
  .masthead { min-height: 58px; padding-block: 10px; }
  .mark { inline-size: 28px; block-size: 28px; }
  .brand-name { font-size: 17px; }

  .toolbar {
    flex-wrap: wrap;
    gap: 6px 12px;
    padding-block: 10px;
    align-items: baseline;
  }
  .title { font-size: 26px; }
  .count { margin: 0; order: 3; }
  .search {
    order: 4;
    flex-basis: 100%;
    max-inline-size: none;
    margin: 6px 0 2px;
    align-self: center;
  }
  .filters {
    gap: 6px;
    padding-block: 0 10px;
  }
  .filters button { min-block-size: 34px; padding: 0 11px; font-size: 13px; }
}

@media (max-width: 560px) {
  :root { --gutter: 14px; --gap: 12px; }
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px var(--gap); }
  .cover { border-radius: 8px; }
  .game-summary { margin-block-start: 9px; }
  .game-title { font-size: 15.5px; }
  .description {
    margin-block-start: 3px;
    font-size: 13px;
    line-height: 1.5;
    min-block-size: 0;
    -webkit-line-clamp: 2;
  }
  .foot-inner { padding-block: 18px 26px; }
}

@media (max-width: 350px) {
  .games { grid-template-columns: 1fr; }
  .description { -webkit-line-clamp: 3; }
}

/* ------------------------------------------------- accessibility switches */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .game:hover .cover, .cover { transform: none !important; }
}

@media (forced-colors: active) {
  .cover { border: 1px solid CanvasText; }
  .mark rect { fill: CanvasText; }
  .mark path { fill: Canvas; }
  .language { border: 1px solid CanvasText; }
  .filters [aria-pressed="true"] { border: 2px solid Highlight; }
  .cover-play { border: 1px solid ButtonText; background: ButtonFace; color: ButtonText; }
}
