:root {
  --bg: #0b0e17;
  --card: #141a2a;
  --text: #eef2ff;
  --muted: #9aa3b8;
  --accent: #ffd36b;
  --bar-h: 46px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- Trang chủ ---------- */
#home { max-width: 1100px; margin: 0 auto; padding: 24px 16px 40px; }
.hero { text-align: center; padding: 26px 0 14px; }
.hero h1 {
  font-size: clamp(30px, 5vw, 46px); margin: 0 0 10px; letter-spacing: .5px;
  background: linear-gradient(90deg, #ffd36b, #ff9f43); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); margin: 0 auto; font-size: 15px; max-width: 620px; line-height: 1.5; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-top: 26px; }
.card {
  background: var(--card); border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; text-align: left; padding: 0; color: inherit; font: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); border-color: rgba(255, 211, 107, .6); box-shadow: 0 14px 34px rgba(0, 0, 0, .45); outline: none; }
.thumb {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: radial-gradient(circle at 30% 30%, var(--c1), transparent 60%), linear-gradient(135deg, #1b2238, #0b0e17);
  display: flex; align-items: center; justify-content: center;
}
.thumb .emoji { font-size: 72px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .6)); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .tag {
  position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, .62); border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.body h2 { margin: 0; font-size: 18px; }
.body p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; flex: 1; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--accent); }
.meta .rank { flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .rank small { color: var(--muted); font-size: 11.5px; }
.meta .trophy { flex: none; margin-left: auto; cursor: pointer; font-size: 15px; line-height: 1; padding: 6px 7px; border-radius: 9px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.meta .trophy:hover { background: rgba(255, 255, 255, .2); }
.card { cursor: pointer; }
.play { background: linear-gradient(135deg, #ffd36b, #ff9f43); color: #201300; border-radius: 10px; padding: 8px 14px; font-weight: 800; font-size: 13px; white-space: nowrap; }
footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 44px; }
footer a { color: var(--muted); }

/* ---------- Khung chơi game ---------- */
#player { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; }
#bar {
  height: var(--bar-h); flex: none; display: flex; align-items: center; gap: 6px; padding: 0 8px;
  padding-top: env(safe-area-inset-top); background: #0f1424; border-bottom: 1px solid rgba(255, 255, 255, .1);
  overflow-x: auto; scrollbar-width: none;
}
#bar::-webkit-scrollbar { display: none; }
#bar button {
  background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .15); border-radius: 9px;
  padding: 6px 10px; font-size: 13px; white-space: nowrap; flex: none; line-height: 1.2;
}
#bar button:hover { background: rgba(255, 255, 255, .16); }
#switcher { display: flex; gap: 6px; }
#switcher .chip.active { background: var(--accent); color: #201300; border-color: transparent; font-weight: 800; }
.spacer { flex: 1; }
#frame { flex: 1; border: 0; width: 100%; height: 100%; background: #0a0d17; }
#player.nobar #bar { display: none; }
#btn-show {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 5;
  background: rgba(15, 20, 36, .85); color: #fff; border: 1px solid rgba(255, 255, 255, .25); border-left: 0;
  border-radius: 0 10px 10px 0; padding: 10px 8px; font-size: 14px; opacity: .75;
}
#player.nobar #btn-show { display: block !important; }

@media (max-width: 560px) {
  #home { padding: 16px 12px 32px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .thumb .emoji { font-size: 60px; }
  #bar .t, #switcher .chip .t { display: none; }
  #bar button { padding: 6px 9px; font-size: 15px; }
}
.thumb .tag.hot { background: linear-gradient(135deg, #ff5a3c, #ff9f43); border-color: rgba(255, 255, 255, .35); color: #fff; box-shadow: 0 4px 14px rgba(255, 90, 60, .45); }
.race { display: inline-block; margin-top: 14px; font: inherit; font-size: 13.5px; color: #ffe3c2; cursor: pointer; background: linear-gradient(135deg, rgba(255, 90, 60, .18), rgba(255, 159, 67, .18)); border: 1px solid rgba(255, 140, 80, .45); border-radius: 999px; padding: 7px 16px; max-width: 100%; }
.race:hover { background: linear-gradient(135deg, rgba(255, 90, 60, .3), rgba(255, 159, 67, .3)); }
.race b { color: #ffb36b; }
@media (max-width: 560px) { .race span { display: none; } }
/* danh sách game tĩnh (seo.py sinh) – cho Google và người xem cuối trang */
.seo-links { margin: 46px auto 0; max-width: 1100px; color: var(--muted); font-size: 13px; }
.seo-links h2 { font-size: 15px; color: var(--text); margin: 0 0 10px; }
.seo-links ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px 22px; }
.seo-links li { line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.seo-links a { color: var(--accent); font-weight: 700; text-decoration: none; margin-right: 4px; }
.seo-links a:hover { text-decoration: underline; }
@media (max-width: 520px) { .seo-links ul { grid-template-columns: 1fr; } }

/* ---------- Nút đổi ngôn ngữ ---------- */
.hero { position: relative; }
.lang-btn {
  position: absolute; top: 0; right: 0; font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); color: var(--text); border: 1px solid rgba(255, 255, 255, .18);
}
.lang-btn:hover { border-color: var(--accent); }
.lang-chip { font: inherit; font-size: 12.5px; padding: 0 10px; height: 32px; border-radius: 9px; background: rgba(255, 255, 255, .08); color: var(--text); border: 1px solid rgba(255, 255, 255, .14); margin-right: 6px; }
@media (max-width: 520px) { .lang-btn { position: static; margin-bottom: 8px; } }
