/* Ant Games portal: shared styles for index.html and play.html. No external fonts or assets. */
:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --panel: #161a23;
  --panel-2: #1d222d;
  --line: #262c39;
  --text: #e8ebf2;
  --dim: #9aa3b5;
  --faint: #6b7487;
  --accent: #ffb23f;
  --accent-2: #4fd6c8;
  --radius: 12px;
  --bar: 58px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  height: var(--bar); padding: 0 20px;
  background: rgba(11, 13, 18, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.14em; font-size: 15px; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand b { color: var(--accent); font-weight: 800; }
.brand i { font-style: normal; }
/* Chinese: no tracking between characters, no forced capitals, a little more line height */
html[lang^="zh"] body { line-height: 1.6; }
html[lang^="zh"] .brand { letter-spacing: 0.08em; font-size: 17px; }
html[lang^="zh"] .about h2, html[lang^="zh"] .bar h1, html[lang^="zh"] .btn { letter-spacing: 0; }
html[lang^="zh"] .about h2 { font-size: 13px; }
.btn.lang { padding: 0 11px; gap: 6px; }
.btn.lang b { font-weight: 700; }
.note { margin: 0 0 14px; padding: 9px 12px; border: 1px solid #4a3a1c; border-radius: 9px; background: #1b1710; color: #e9cf9c; font-size: 13.5px; }
.bar .grow { flex: 1; min-width: 0; }
.search {
  flex: 1; max-width: 420px; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 16px; height: 16px; flex: none; color: var(--faint); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }
.search input::placeholder { color: var(--faint); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 13px; letter-spacing: 0.03em;
}
.btn:hover { background: var(--panel-2); border-color: #364055; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1205; }
.btn.primary:hover { filter: brightness(1.08); }

/* ---------- index ---------- */
.wrap { max-width: 1480px; margin: 0 auto; padding: 22px 20px 60px; }
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.chip {
  height: 32px; padding: 0 13px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); color: var(--dim);
  cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: #364055; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #0b0d12; }
.chip small { opacity: 0.6; font-weight: 600; margin-left: 5px; }
.sort { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 13px; }
.sort select {
  height: 32px; padding: 0 8px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 13px;
}
.count { color: var(--faint); font-size: 13px; margin: 0 0 14px; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.card {
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: #3b465c; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); }
.card .shot { position: relative; aspect-ratio: 16 / 9; background: #07080c; overflow: hidden; }
.card .shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.card:hover .shot img { transform: scale(1.04); }
.card .genre {
  position: absolute; left: 10px; top: 10px;
  padding: 3px 9px; border-radius: 6px;
  background: rgba(8, 10, 14, 0.78); backdrop-filter: blur(4px);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
}
.card .new {
  position: absolute; right: 10px; top: 10px;
  padding: 3px 8px; border-radius: 6px; background: var(--accent-2); color: #04211e;
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
}
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.card h3 { margin: 0; font-size: 16px; letter-spacing: 0.04em; }
.card p { margin: 0; color: var(--dim); font-size: 13px; line-height: 1.4; }
.empty { padding: 60px 0; text-align: center; color: var(--faint); }
.foot { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; }

/* ---------- play ---------- */
.play-main { padding: 14px 20px 60px; }
.stage-wrap { display: flex; justify-content: center; }
.stage {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
  width: min(100%, calc((100vh - var(--bar) - 30px) * 16 / 9));
  aspect-ratio: 16 / 9;
}
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.stage:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; border-radius: 0; }
.bar h1 { margin: 0; font-size: 16px; letter-spacing: 0.1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .tagline { color: var(--faint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.about { max-width: 1180px; margin: 26px auto 0; display: grid; gap: 28px; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.about h2 { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.about p { margin: 0 0 14px; color: #cfd5e2; }
.about ul { margin: 0 0 18px; padding-left: 18px; color: #cfd5e2; }
.about li { margin: 3px 0; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tag { padding: 3px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.tag.genre { color: var(--accent); border-color: #4a3a1c; }
.controls { width: 100%; border-collapse: collapse; }
.controls td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13.5px; }
.controls td:first-child { color: var(--dim); padding-right: 16px; width: 46%; }
.more { max-width: 1480px; margin: 40px auto 0; }
.more h2 { margin: 0 0 14px; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.missing { max-width: 560px; margin: 90px auto; text-align: center; color: var(--dim); }
.missing h1 { color: var(--text); letter-spacing: 0.06em; }

@media (max-width: 820px) {
  .about { grid-template-columns: 1fr; }
  .bar .tagline { display: none; }
  .bar h1 { flex: 1; min-width: 0; }
  .brand span { display: none; }
}
@media (max-width: 820px) {
  /* a narrow screen gets the genres as one row to swipe through, not a wall of chips above the games */
  .toolbar { flex-wrap: nowrap; gap: 10px; }
  .chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; padding: 2px 0;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; scroll-snap-align: start; }
  .sort { flex: none; font-size: 0; gap: 0; }
}
@media (max-width: 560px) {
  .bar { padding: 0 12px; gap: 10px; }
  .wrap { padding: 16px 12px 40px; }
  .grid { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .card .body { padding: 9px 10px 11px; }
  .card h3 { font-size: 14px; }
  .card p { display: none; }
  .play-main { padding: 0 0 40px; }
  .stage { border-radius: 0; border-left: 0; border-right: 0; }
  .about, .more { padding: 0 14px; }
  .btn span { display: none; }
}
/* a tall, narrow screen: give the game the whole window instead of a 16:9 letterbox */
@media (max-aspect-ratio: 1/1) {
  .stage { width: 100%; aspect-ratio: auto; height: calc(100dvh - var(--bar)); }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card .shot img { transition: none; }
  .card:hover { transform: none; }
}

/* a phone: the search field takes the room the spacer would, beside the language button */
@media (max-width: 560px) {
  .bar .search + .grow { display: none; }
  .search { max-width: none; }
}
