/* ============================================================
   Minimal H5 Game Portal — home
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e7e9ee;
  --line-2: #f0f1f4;
  --tx: #16181d;
  --tx-2: #6b7280;
  --tx-3: #9aa1ac;
  --ac: #2f6bff;
  --r: 12px;
  --r-s: 9px;
  --wrap: 640px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--tx);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Image wrappers are <span>s — must be blockified or height/max-height would
   not apply and the raw image height would leak through. */
.fcard-img,
.qpcard-img,
.edcard-img,
.spotcard-img,
.gcard-img {
  display: block;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

[v-cloak] {
  display: none !important;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 14px;
}

/* ── shared: section head ──────────────────────────────── */
.sh {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 0 11px;
}

.sh-bar {
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: var(--ac);
  flex: none;
}

.sh-t {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.sh-x {
  margin-left: auto;
  font-size: 13px;
  color: var(--tx-2);
}

/* ── shared: label chip ────────────────────────────────── */
.chip {
  display: inline-block;
  font-size: 11.5px;
  line-height: 1.7;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--line-2);
  color: var(--tx-2);
  white-space: nowrap;
}

/* ── 1) header ─────────────────────────────────────────── */
.hd {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.hd-in {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
}

.hd-logo {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  background: var(--tx);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hd-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hd-btn {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--r-s);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx-2);
}

.hd-btn:active {
  background: var(--line-2);
}

/* ── 2) search ─────────────────────────────────────────── */
.srch {
  padding: 12px 0 2px;
}

.srch-in {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 4px 4px 4px 13px;
  transition: border-color .16s;
}

.srch-in:focus-within {
  border-color: var(--ac);
}

.srch-in input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 15px;
  height: 34px;
  color: var(--tx);
}

.srch-in input::placeholder {
  color: var(--tx-3);
}

.srch-in button {
  flex: none;
  height: 34px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--tx);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.srch-in button:active {
  opacity: .82;
}

/* ── 3) category chips ─────────────────────────────────── */
.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 11px 0 3px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.cats::-webkit-scrollbar {
  display: none;
}

.cat {
  flex: none;
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13.5px;
  color: var(--tx-2);
  transition: background .16s, color .16s, border-color .16s;
}

.cat.on {
  background: var(--tx);
  border-color: var(--tx);
  color: #fff;
  font-weight: 600;
}

.cat i {
  font-style: normal;
  margin-left: 5px;
  font-size: 12px;
  color: var(--tx-3);
}

.cat.on i {
  color: rgba(255, 255, 255, .6);
}

/* ── 4) featured carousel ──────────────────────────────── */
.feat {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.feat::-webkit-scrollbar {
  display: none;
}

.fcard {
  position: relative;
  flex: 0 0 82%;
  max-width: 420px;
  scroll-snap-align: start;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--line-2);
}

.fcard-img {
  height: 160px;
  background: var(--line-2);
}

.fcard-shade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62%;
  background: linear-gradient(180deg, rgba(8, 10, 16, 0) 0%, rgba(8, 10, 16, .74) 100%);
  pointer-events: none;
}

.fcard-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.fcard-n {
  max-width: 100%;
  color: #fff;
  font-size: 15px;
  font-weight: 640;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.chip-on {
  background: rgba(255, 255, 255, .92);
  color: var(--tx);
}

.fdots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding-top: 11px;
}

.fdot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d3d7dd;
  transition: width .2s, border-radius .2s;
}

.fdot.on {
  width: 15px;
  border-radius: 3px;
  background: var(--tx);
}

/* ── 5) top games list ─────────────────────────────────── */
.top-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
}

.top-row + .top-row {
  border-top: 1px solid var(--line-2);
}

.top-row:active {
  background: #fafbfc;
}

.top-rank {
  flex: none;
  width: 24px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--tx-3);
  font-variant-numeric: tabular-nums;
}

.top-rank.hit {
  color: var(--ac);
}

.top-thumb {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 9px;
  overflow: hidden;
  background: var(--line-2);
}

.top-body {
  flex: 1;
  min-width: 0;
}

.top-nm {
  display: block;
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-lb {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--tx-3);
}

.top-go {
  flex: none;
  font-size: 13px;
  font-weight: 640;
  color: var(--ac);
}

/* ── 6) categories grid ────────────────────────────────── */
.catgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.catcard {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 9px 11px;
  text-align: left;
}

.catcard:active {
  background: #fafbfc;
}

.catcard-ic {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: var(--line-2);
}

.catcard-b {
  flex: 1;
  min-width: 0;
}

.catcard-nm {
  display: block;
  font-size: 14px;
  font-weight: 640;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catcard-cn {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--tx-3);
}

.catcard-arw {
  flex: none;
  color: var(--tx-3);
  font-size: 16px;
}

/* ── 7) quick picks ────────────────────────────────────── */
.qp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.qpcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.qpcard:active {
  background: #fafbfc;
}

.qpcard-img {
  height: 120px;
  background: var(--line-2);
}

.qpcard-b {
  padding: 9px 11px 11px;
}

.qpcard-n {
  display: block;
  font-size: 13.5px;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qpcard-m {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.qpcard-go {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 640;
  color: var(--ac);
}

/* ── 8) new releases ───────────────────────────────────── */
.newlist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.newrow {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
}

.newrow:active {
  background: #fafbfc;
}

.newrow-img {
  width: 76px;
  height: 58px;
  flex: none;
  border-radius: 9px;
  overflow: hidden;
  background: var(--line-2);
}

.newrow-b {
  flex: 1;
  min-width: 0;
}

.newrow-tag {
  display: inline-block;
  font-size: 10.5px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--ac);
  color: #fff;
  font-weight: 700;
  letter-spacing: .04em;
}

.newrow-n {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  font-weight: 640;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.newrow-d {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--tx-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.newrow-arw {
  flex: none;
  color: var(--tx-3);
  font-size: 18px;
}

/* ── 9) editors' choice ────────────────────────────────── */
.edlist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.edcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.edcard:active {
  background: #fafbfc;
}

.edcard-img {
  height: 140px;
  background: var(--line-2);
}

.edcard-b {
  padding: 9px 10px 11px;
}

.edcard-n {
  display: block;
  font-size: 13.5px;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edcard-stars {
  display: block;
  margin-top: 4px;
  color: #f5a524;
  font-size: 12.5px;
  letter-spacing: 1px;
}

.edcard-stars .off {
  color: #e2e5ea;
}

/* ── 10) recently played ───────────────────────────────── */
.recent {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.rrow {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
}

.rrow + .rrow {
  border-top: 1px solid var(--line-2);
}

.rrow:active {
  background: #fafbfc;
}

.rrow-thumb {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 9px;
  overflow: hidden;
  background: var(--line-2);
}

.rrow-n {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rrow-lb {
  flex: none;
  font-size: 12px;
  color: var(--tx-3);
}

/* ── 11) spotlight ─────────────────────────────────────── */
.spotlist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spotcard {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--line-2);
}

.spotcard-img {
  height: 160px;
  background: var(--line-2);
}

.spotcard-shade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64%;
  background: linear-gradient(180deg, rgba(8, 10, 16, 0) 0%, rgba(8, 10, 16, .78) 100%);
  pointer-events: none;
}

.spotcard-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.spotcard-n {
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.spotcard-d {
  color: rgba(255, 255, 255, .86);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

/* ── 12) all games grid ─────────────────────────────────- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.gcard:active {
  background: #fafbfc;
}

.gcard-img {
  height: 110px;
  background: var(--line-2);
}

.gcard-b {
  padding: 8px 10px 10px;
}

.gcard-n {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gcard-m {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gcard-no {
  margin-left: auto;
  font-size: 11px;
  color: var(--tx-3);
  font-variant-numeric: tabular-nums;
}

/* ── 7) pager ──────────────────────────────────────────── */
.more-wrap {
  padding: 18px 0 2px;
}

.more {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--tx);
}

.more:active {
  background: var(--line-2);
}

/* ── 8) filtered view ─────────────────────────────────── */
.fv {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 0 11px;
}

.fv-back {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  color: var(--tx-2);
  flex: none;
}

.fv-back:active {
  background: var(--line-2);
}

.fv-t {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fv-c {
  flex: none;
  font-size: 12.5px;
  color: var(--tx-3);
  font-variant-numeric: tabular-nums;
}

/* ── 9) loading / empty ────────────────────────────────── */
.ld {
  padding: 64px 0;
  text-align: center;
  color: var(--tx-3);
  font-size: 13px;
  letter-spacing: .04em;
}

.ld-spin {
  width: 20px;
  height: 20px;
  margin: 0 auto 11px;
  border: 2px solid var(--line);
  border-top-color: var(--ac);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty {
  padding: 56px 0;
  text-align: center;
}

.empty p {
  font-size: 22px;
  margin-bottom: 8px;
  opacity: .5;
}

.empty span {
  font-size: 14px;
  color: var(--tx-3);
}

/* ── 10) footer ────────────────────────────────────────── */
.ft {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 18px 0 calc(20px + env(safe-area-inset-bottom));
}

.ft-in {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ft-b {
  font-size: 14px;
  font-weight: 650;
}

.ft-l {
  margin-left: auto;
  display: flex;
  gap: 14px;
}

.ft-l a {
  font-size: 13px;
  color: var(--tx-2);
}

/* ── 11) back to top ───────────────────────────────────── */
.totop {
  position: fixed;
  right: 14px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(20, 24, 40, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx-2);
  z-index: 60;
}

.totop:active {
  background: var(--line-2);
}

/* ── 12) responsive ────────────────────────────────────── */
@media (min-width: 700px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .catgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .edlist {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .fcard {
    flex: 0 0 46%;
  }
}

@media (max-width: 360px) {
  .grid {
    gap: 10px;
  }

  .fcard {
    flex: 0 0 88%;
  }
}
