/* Trang tổng hợp game — theo thiết kế game-hub/design/hub-mockup.webp */
:root {
  --blue: #1a73e8;
  --blue-d: #1259c9;
  --ink: #1f2a44;
  --muted: #5d6b85;
  --line: #e6ebf3;
  --card: #fff;
  --page: #f4f7fc;
  --yellow: #ffc83d;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(31, 42, 68, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Nunito", "Segoe UI Rounded", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ── Thanh trên ─────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 20; background: #fff; box-shadow: 0 1px 0 var(--line); }
.topbar-in { max-width: 1480px; margin: 0 auto; padding: 6px 24px; display: flex; align-items: center; gap: 16px; }
.logo img { height: 54px; width: auto; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.nav a {
  display: flex; align-items: center; gap: 6px; padding: 10px 8px 8px; white-space: nowrap;
  text-decoration: none; font-size: 14.5px; font-weight: 600; color: #34405a;
  border-bottom: 3px solid transparent; border-radius: 2px;
}
.nav a span { font-size: 18px; }
.nav a:hover { color: var(--blue); }
.nav a.active { color: var(--blue); border-bottom-color: var(--blue); }
.search {
  display: flex; align-items: center; gap: 8px; width: 250px; padding: 0 14px; height: 42px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}
.search:focus-within { border-color: var(--blue); }
.search svg { width: 18px; height: 18px; fill: none; stroke: #6b7894; stroke-width: 2.2; stroke-linecap: round; flex: none; }
.search input { border: 0; outline: 0; width: 100%; background: transparent; font-size: 14px; }
.btn-login {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 22px; border-radius: 12px; flex: none;
  background: linear-gradient(180deg, #2f86f6, var(--blue)); color: #fff; text-decoration: none; font-weight: 700;
  box-shadow: 0 4px 12px rgba(26, 115, 232, .35);
}
.btn-login:hover { background: var(--blue-d); }
.btn-login svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.2; }

/* ── Banner ─────────────────────────────────────────────── */
.hero { position: relative; background: #8fd0ff; }
.hero img { width: 100%; height: auto; aspect-ratio: 1536 / 314; object-fit: cover; }
/* Nút «Khám phá trò chơi» vẽ sẵn trong ảnh: phủ vùng bấm đúng chỗ nút */
.hero-cta { position: absolute; left: 42%; top: 80%; width: 16%; height: 16%; border-radius: 40px; }
.hero-cta:hover { box-shadow: 0 0 0 4px rgba(255, 255, 255, .7); }

/* ── Phần nội dung ─────────────────────────────────────── */
.sheet {
  position: relative; max-width: 1536px; margin: -16px auto 0; padding: 14px 20px 30px;
  background: var(--page); border-radius: 26px 26px 0 0;
}
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 21px; font-weight: 800; }
.ico { font-size: 24px; }
.badge-new {
  font-size: 10px; font-weight: 900; color: #fff; background: #2fb36b; padding: 6px 7px; border-radius: 50%;
  box-shadow: 0 0 0 3px #d9f5e5;
}
.see-all { color: var(--blue); font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.see-all:hover { text-decoration: underline; }

/* Danh mục */
.cats { display: grid; grid-template-columns: repeat(10, 1fr); gap: 12px; margin-bottom: 18px; }
.cat {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 92px;
  padding: 10px 6px; border: 0; border-radius: 16px; cursor: pointer; background: var(--bg, #fff);
  box-shadow: inset 0 0 0 1px rgba(31, 42, 68, .05), 0 3px 10px rgba(31, 42, 68, .05);
  transition: transform .15s ease;
}
.cat:hover { transform: translateY(-2px); }
.cat-ico { font-size: 36px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .12)); }
.cat-name { font-size: 13.5px; font-weight: 600; line-height: 1.2; text-align: center; }
.cat.on { background: linear-gradient(180deg, #2f86f6, var(--blue)); color: #fff; box-shadow: 0 6px 16px rgba(26, 115, 232, .35); }

.row-2 { display: grid; grid-template-columns: 1.07fr 1fr; gap: 18px; margin-bottom: 18px; }
.featured { display: flex; flex-direction: column; }

/* Nổi bật */
.carousel { position: relative; flex: 1; border-radius: 16px; overflow: hidden; min-height: 220px; }
.slide {
  position: absolute; inset: 0; display: none; text-decoration: none; color: #fff;
  background-size: cover; background-position: center 30%;
}
.slide.on { display: block; }
.slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,0) 30%, rgba(0,0,0,.08) 60%, rgba(0,0,0,.25)); }
.slide-hero { position: absolute; left: 3%; bottom: -4%; height: 104%; width: auto; z-index: 2; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); }
.fruit { position: absolute; width: auto; z-index: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,.25)); animation: bob 3.2s ease-in-out infinite; }
.f0 { height: 26%; left: 27%; top: 8%; }
.f1 { height: 22%; left: 52%; top: 4%; animation-delay: .5s; }
.f2 { height: 24%; left: 72%; top: 10%; animation-delay: 1s; }
.f3 { height: 22%; left: 88%; top: 6%; animation-delay: 1.5s; }
.f4 { height: 20%; left: 39%; top: 2%; animation-delay: 2s; }
@keyframes bob { 50% { transform: translateY(6px) rotate(3deg); } }
.slide-text { position: absolute; left: 30%; right: 3%; top: 31%; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.slide-title {
  font-size: clamp(24px, 2.9vw, 46px); font-weight: 900; line-height: 1; letter-spacing: .5px; white-space: nowrap;
  color: #ffd84a; -webkit-text-stroke: 2px #7a3b0c; paint-order: stroke fill;
  text-shadow: 0 4px 0 #7a3b0c, 0 6px 12px rgba(0,0,0,.35);
}
.slide-sub {
  align-self: flex-start; font-size: clamp(14px, 1.4vw, 20px); font-weight: 800; color: #fff;
  -webkit-text-stroke: 1px #3d2610; paint-order: stroke fill; text-shadow: 0 2px 4px rgba(0,0,0,.6);
}
.slide-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.slide-tags .pill { background: rgba(255, 255, 255, .92); color: #384560; }
.slide-play {
  position: absolute; right: 3%; bottom: 9%; z-index: 3; display: flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 30px; font-weight: 900; font-size: clamp(14px, 1.3vw, 18px); color: #3d2405;
  background: linear-gradient(180deg, #ffe066, #ffb703); box-shadow: 0 4px 0 #c97a00, 0 8px 16px rgba(0,0,0,.25);
}
.slide-play svg { width: 18px; height: 18px; fill: currentColor; }
.slide:hover .slide-play { filter: brightness(1.06); transform: translateY(-1px); }
.arrow {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 4; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.35); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.arrow.prev { left: 10px; } .arrow.next { right: 10px; }
.dots { position: absolute; left: 50%; bottom: 8px; translate: -50% 0; z-index: 4; display: flex; gap: 6px; }
.dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.6); cursor: pointer; }
.dot[aria-current="true"] { background: #fff; width: 18px; border-radius: 4px; }

/* Pill thẻ loại */
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
  background: #eaf2ff; color: var(--blue);
}

/* Game mới nhất */
.new-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.new-card { display: flex; flex-direction: column; }
.new-card .thumb { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 196 / 114; margin-bottom: 8px; }
.new-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tag-new {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; color: #fff;
  background: #ff5a5f;
}
.is-soon .tag-new { background: #8a94a8; }
.new-card h3 { margin: 0 0 3px; font-size: 15.5px; font-weight: 800; }
.new-card p { margin: 0 0 8px; font-size: 13px; color: var(--muted); line-height: 1.35; flex: 1; }
.new-card .pills { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.btn-play {
  display: block; text-align: center; padding: 9px 0; border-radius: 10px; font-weight: 700; font-size: 14px;
  text-decoration: none; color: #fff; background: linear-gradient(180deg, #2f86f6, var(--blue));
}
.btn-play:hover { background: var(--blue-d); }
.btn-play.soon { background: #e7ebf2; color: #7a859b; cursor: default; }

/* Tất cả game */
.all-head { flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.chip {
  padding: 7px 16px; border-radius: 10px; border: 0; background: #eef2f8; color: #34405a; font-size: 13.5px;
  font-weight: 600; cursor: pointer;
}
.chip:hover { background: #e2e9f5; }
.chip[aria-pressed="true"] { background: var(--blue); color: #fff; }
.sort select {
  height: 36px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 13.5px;
  cursor: pointer;
}
.filter-note { margin: -4px 0 12px; font-size: 14px; color: var(--muted); }
.filter-note button { margin-left: 6px; border: 0; background: none; color: var(--blue); font-weight: 700; cursor: pointer; text-decoration: underline; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px 14px; }
.card .thumb { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 167 / 97; margin-bottom: 8px; background: #e9eef6; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.card:not(.is-soon):hover .thumb img { transform: scale(1.05); }
.card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 800; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { color: var(--blue); }
.card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.is-soon .thumb img { filter: saturate(.75) brightness(.95); }
.soon-badge {
  /* góc trên trái: che luôn nhãn «Mới» in sẵn trong vài ảnh cắt từ thiết kế */
  position: absolute; left: 6px; top: 6px; padding: 3px 9px; border-radius: 8px; font-size: 11px; font-weight: 800;
  background: #5b6478; color: #fff;
}
.fav {
  position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: #fff; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.fav svg { width: 16px; height: 16px; fill: none; stroke: #45526e; stroke-width: 2.2; }
.fav.on svg { fill: #ff4d6d; stroke: #ff4d6d; }
.empty { margin: 20px 0 6px; text-align: center; color: var(--muted); }

/* Chân trang */
.foot { text-align: center; padding: 10px 16px 34px; font-size: 14px; color: var(--muted); }
.foot p { margin: 6px 0; }
.foot a { color: var(--blue); }
.foot-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }

/* ── Màn hình hẹp ───────────────────────────────────────── */
@media (max-width: 1400px) {
  .nav a { padding: 10px 5px 8px; font-size: 13.5px; }
  .nav a span { font-size: 16px; }
  .search { width: 190px; }
}
@media (max-width: 1280px) {
  .cats { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 1080px) {
  .topbar-in { flex-wrap: wrap; gap: 8px 14px; padding: 6px 16px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .search { flex: 1; width: auto; }
  .row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .logo img { height: 42px; }
  .btn-login { height: 40px; padding: 0 12px; font-size: 14px; }
  .search { order: 4; flex-basis: 100%; height: 40px; }
  .sheet { padding: 12px 16px 24px; margin-top: -10px; border-radius: 18px 18px 0 0; }
  .cats { display: flex; overflow-x: auto; gap: 10px; margin: 0 -16px 16px; padding: 2px 16px 6px; scrollbar-width: none; }
  .cats::-webkit-scrollbar { display: none; }
  .cat { flex: 0 0 96px; min-height: 86px; }
  .panel { padding: 14px 12px; }
  .panel h2 { font-size: 18px; }
  .topbar { position: static; }
  .carousel { height: 230px; flex: none; }
  .slide-title { white-space: normal; font-size: 26px; }
  .slide-sub { font-size: 14px; }
  .slide-tags { display: none; }
  .slide-hero { left: -2%; height: 80%; }
  .slide-text { left: 34%; top: 12%; }
  .slide-play { right: auto; left: 34%; bottom: 10%; padding: 9px 18px; }
  .f3, .f4 { display: none; }
  .new-list { grid-template-columns: 1fr; }
  .new-card { display: grid; grid-template-columns: 130px 1fr; column-gap: 12px; }
  .new-card .thumb { grid-row: span 4; margin: 0; align-self: start; }
  .new-card .btn-play { justify-self: start; padding: 7px 18px; }
  .chips { margin-left: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; order: 3; }
  .chip { flex: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fruit { animation: none; }
}
