/* =====================================================================
   HGAME – giao dien mobile GameFi Web3 (dung chung phong cach voi HBanks)
   - Toan trang BI KHOA truot ngang + doc
   - Chi vung .screen duoc cuon doc ben trong
   - Anh trong /public deu la PNG XAM placeholder, chi can thay file
   - Banner hero: CHI code khung + nut, con lai la anh (khung tu scale theo
     ti le anh banner-hero.png)
   ===================================================================== */

:root {
  --maxw: 440px;                 /* be ngang khung mobile */
  --line: #8a3df0;               /* vien tim cho cac thanh phan */
  --line2: #b46bff;
  --glow: rgba(138, 61, 240, .45);
  --txt: #f3f0ff;
  --muted: #b9aede;
  --up: #2fe6a0;                 /* xanh tang gia */
  --card: rgba(28, 16, 54, .55); /* nen the */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;              /* khoa cuon viewport */
  overscroll-behavior: none;     /* chan rubber-band */
}

body {
  position: fixed;               /* ghim ca giao dien */
  inset: 0;
  color: var(--txt);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  touch-action: none;            /* chan vuot vung ngoai khung */
  /* anh nen PNG cho toan bo web (thay public/bg-app.png de doi nen) */
  background: #07041a url("public/bg-app.png") center top / cover no-repeat;
}

a { text-decoration: none; color: inherit; }
button { border: 0; font: inherit; color: inherit; cursor: pointer; background: none; }
img { display: block; max-width: 100%; }
h1, h2, p { margin: 0; }

/* khung dien thoai can giua tren desktop */
.app {
  position: relative;
  width: min(100vw, var(--maxw));
  height: 100%;
  margin: 0 auto;
}

/* ====== Vung cuon duy nhat ====== */
.screen {
  height: 100%;
  padding: 12px 14px calc(96px + env(safe-area-inset-bottom));
  overflow-y: auto;                 /* cuon doc ben trong */
  overflow-x: hidden;               /* khoa truot ngang */
  overscroll-behavior: contain;     /* khong lan ra ngoai */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;              /* chi cho vuot doc */
}
.screen::-webkit-scrollbar { width: 0; height: 0; }

/* ===================== Khoi hero (1 anh xam) ===================== */
/* Toan bo khoi nam trong anh. CHI 2 chip goc trai duoc code de len.
   Khung tu scale theo ti le anh banner-hero.png. */
.hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
}
.hero-img { width: 100%; height: auto; display: block; }

/* ===== Vi HWallet + the HCoin: overlay GOC PHAI cua anh ===== */
.hero-wallet {
  position: absolute; top: 12px; right: 12px;
  width: min(50%, 215px);
  display: grid; gap: 8px;
}
.wallet-pill {
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: rgba(15,8,34,.55);
  box-shadow: 0 0 10px var(--glow), inset 0 0 14px rgba(138,61,240,.1);
  padding: 7px 10px 6px;
  backdrop-filter: blur(4px);
}
.wallet-pill-top { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.wp-ic { width: 16px; height: 16px; color: var(--line2); flex: 0 0 auto; }
.bell-btn { position: relative; margin-left: auto; width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; }
.bell-ic { width: 18px; height: 18px; color: #e7defc; }
.bell-badge {
  position: absolute; top: -4px; right: -5px;
  min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 99px; background: #ff3b6b; color: #fff;
  font-size: 9px; font-weight: 800; line-height: 15px; text-align: center;
  box-shadow: 0 0 8px rgba(255,59,107,.8);
}
.wallet-pill-addr { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.copy-ic { width: 13px; height: 13px; color: var(--muted); flex: 0 0 auto; }

.balance-card {
  display: flex; align-items: center; gap: 9px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: rgba(15,8,34,.55);
  box-shadow: 0 0 10px var(--glow), inset 0 0 14px rgba(138,61,240,.1);
  padding: 7px 11px;
  backdrop-filter: blur(4px);
}
.balance-coin { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.balance-text { display: grid; line-height: 1.05; }
.balance-text strong { font-size: 19px; font-weight: 900; }
.balance-text small { font-size: 12px; font-weight: 700; color: #f3c14b; margin-top: 2px; }

/* ===== khung chung: nen card, vien tim ===== */
.actions, .game-card, .mkt-card {
  border: 1.5px solid var(--line);
  background: var(--card);
  box-shadow: 0 0 10px var(--glow), inset 0 0 16px rgba(138,61,240,.08);
}

/* ============ Hang nut nhanh ============ */
.actions {
  margin-top: 14px; border-radius: 16px; padding: 14px 4px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
}
.action { display: grid; justify-items: center; gap: 7px; text-align: center; }
.action-ic {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 30%, #a05cff 0 22%, #6a1fd0 82%);
  border: 1.5px solid var(--line2);
  box-shadow: 0 0 12px var(--glow), inset 0 0 8px rgba(255,255,255,.2);
}
.action-ic svg { width: 24px; height: 24px; color: #fff; filter: drop-shadow(0 0 3px rgba(0,0,0,.35)); }
.action strong { font-size: 10.5px; font-weight: 700; line-height: 1.1; }

/* ===== tieu de section ===== */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 2px 10px;
}
.section-head h2 { font-size: 17px; font-weight: 900; letter-spacing: .3px; }
.see-all { font-size: 12px; color: var(--line2); font-weight: 600; }

/* ===== hang truot ngang ===== */
.hscroll {
  display: flex; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.hscroll::-webkit-scrollbar { height: 0; }

/* =================== The game =================== */
.game-card {
  flex: 0 0 158px;
  border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
}
.game-art { position: relative; display: block; }
.game-art img { width: 100%; height: auto; display: block; }
.hot {
  position: absolute; top: 8px; right: 8px;
  padding: 2px 8px; border-radius: 6px;
  background: linear-gradient(#ff4d6d, #d61b46);
  color: #fff; font-size: 10px; font-weight: 900; letter-spacing: .5px;
  box-shadow: 0 0 10px rgba(255,59,107,.7);
}
.game-tags { padding: 9px 10px; font-size: 11px; font-weight: 600; color: var(--muted); }

/* ============== Banner HGAME ARENA ============== */
/* 1 anh nen duy nhat, CHI code nut. Khung tu scale theo ti le anh. */
.arena {
  position: relative;
  margin-top: 14px; border-radius: 16px;
  overflow: hidden;
}
.arena-img { width: 100%; height: auto; display: block; }
/* nut nam ben phai, can giua theo chieu doc */
.arena-btn {
  position: absolute; right: 4%; top: 50%; transform: translateY(-50%);
  height: 13%; min-height: 30px; padding: 0 5%; border-radius: 11px;
  background: linear-gradient(#fff, #e9defc);
  color: #5a18c0; font-size: 13px; font-weight: 900; white-space: nowrap;
  box-shadow: 0 0 12px rgba(180,107,255,.6);
}

/* ================== Thi truong ================== */
.market { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mkt-card { border-radius: 12px; padding: 9px 8px; display: grid; gap: 6px; }
.mkt-top { display: grid; gap: 1px; }
.mkt-top strong { font-size: 13px; font-weight: 800; }
.mkt-up { font-size: 10.5px; font-weight: 800; color: var(--up); }
.spark { width: 100%; height: 28px; }
.spark polyline { fill: none; stroke: var(--up); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px rgba(47,230,160,.6)); }
.mkt-bot { display: flex; align-items: center; gap: 5px; }
.mkt-bot img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.mkt-bot span { font-size: 11px; font-weight: 700; }

/* ============ Luoi tinh nang: moi o la 1 ANH PNG rieng ============ */
/* khung trong, anh tu scale dung ti le (width 100%, height auto) */
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.feat { display: block; border-radius: 14px; overflow: hidden; }
.feat img { width: 100%; height: auto; display: block; }

/* ============== BOTTOM NAV ============== */
.bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around; align-items: flex-end;
  background: linear-gradient(180deg, rgba(18,8,40,.92), rgba(8,4,22,.98));
  border-top: 1px solid #2a1550;
  padding: 8px 8px calc(12px + env(safe-area-inset-bottom));
  backdrop-filter: blur(8px);
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: #6e5aa0; font-size: 11px;
}
.nav-item svg { width: 23px; height: 23px; color: currentColor; }
.nav-item.active { color: var(--line2); }
.nav-item.active svg { filter: drop-shadow(0 0 6px rgba(180,107,255,.7)); }
.nav-center { position: relative; }
/* Nut giua = vong tron, nen la anh PNG trong /public */
.nav-center-circle {
  width: 60px; height: 60px;
  margin-top: -24px;
  border-radius: 50%;
  background-image: url("public/nav-center-btn.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 0 16px rgba(180,107,255,.6);
}

/* =====================================================================
   HIEU UNG NEON CHAY + CHOP tren cac vien tim
   - 1 vet sang tim/trang chay vong quanh vien (conic-gradient xoay)
   - kem nhip "chop" nhe o glow vien
   ===================================================================== */
@property --neon-a {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* cac khoi co vien tim */
.actions, .game-card, .mkt-card, .wallet-pill, .balance-card { position: relative; }

/* vet neon chay doc theo vien (ring tao bang mask) */
.actions::after, .game-card::after, .mkt-card::after,
.wallet-pill::after, .balance-card::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 2px;                 /* do day vet neon = do day vien */
  background: conic-gradient(from var(--neon-a),
    transparent 0deg 55deg,
    rgba(180,107,255,.35) 80deg,
    var(--line2) 104deg,
    #ffffff 118deg,
    var(--line2) 132deg,
    rgba(180,107,255,.35) 156deg,
    transparent 185deg 360deg);
  /* chi giu phan vien, khoet rong ben trong */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  animation: neon-run 2.6s linear infinite;
  pointer-events: none;
  z-index: 3;
  filter: drop-shadow(0 0 4px var(--line2));
}

/* le pha cho moi khoi -> vet chay lech nhau, sinh dong hon */
.wallet-pill::after  { animation-delay: -.3s; }
.balance-card::after { animation-delay: -1.0s; }
.game-card:nth-child(2)::after { animation-delay: -.6s; }
.game-card:nth-child(3)::after { animation-delay: -1.3s; }
.game-card:nth-child(4)::after { animation-delay: -1.9s; }
.mkt-card:nth-child(2)::after { animation-delay: -.7s; }
.mkt-card:nth-child(3)::after { animation-delay: -1.4s; }
.mkt-card:nth-child(4)::after { animation-delay: -2.0s; }

/* nhip "chop" nhe cho glow vien */
.actions, .game-card, .mkt-card, .wallet-pill, .balance-card {
  animation: neon-blink 2.6s ease-in-out infinite;
}
.wallet-pill  { animation-delay: -.3s; }
.balance-card { animation-delay: -1.0s; }
.game-card:nth-child(2) { animation-delay: -.6s; }
.game-card:nth-child(3) { animation-delay: -1.3s; }
.game-card:nth-child(4) { animation-delay: -1.9s; }
.mkt-card:nth-child(2) { animation-delay: -.7s; }
.mkt-card:nth-child(3) { animation-delay: -1.4s; }
.mkt-card:nth-child(4) { animation-delay: -2.0s; }

@keyframes neon-run { to { --neon-a: 360deg; } }

@keyframes neon-blink {
  0%, 100% { box-shadow: 0 0 8px var(--glow), inset 0 0 16px rgba(138,61,240,.08); }
  50%      { box-shadow: 0 0 16px rgba(180,107,255,.7), inset 0 0 18px rgba(138,61,240,.16); }
}

/* ton trong nguoi dung tat hieu ung chuyen dong */
@media (prefers-reduced-motion: reduce) {
  .actions, .game-card, .mkt-card, .wallet-pill, .balance-card { animation: none; }
  .actions::after, .game-card::after, .mkt-card::after,
  .wallet-pill::after, .balance-card::after { animation: none; }
}
