/* =====================================================================
   BUDDHA – Blockchain Luong Tu Web4 (giao dien mobile)
   - Toan trang BI KHOA truot ngang + doc; chi .screen cuon doc ben trong
   - Anh trong /public deu la PNG XAM placeholder, chi can thay file
   - Header: TOAN BO la 1 ANH PNG, chi code NUT + O TONG TAI SAN len tren
   - Hieu ung vien neon CHAY + CHOP (tone VANG / GOLD)
   ===================================================================== */

:root {
  --maxw: 440px;
  --bg: #0a0820;
  --gold: #f5c451;
  --gold2: #d4a438;
  --amber: #ffb347;
  --cyan: #4dd8e0;
  --blue: #3b82f6;
  --purple: #a855f7;
  --line: rgba(245, 196, 81, .38);
  --glow: rgba(245, 196, 81, .22);
  --neon: #ffd700;          /* vet sang chay tren vien */
  --card: rgba(14, 12, 40, .62);
  --txt: #f0ece4;
  --muted: #a89e8a;
  --up: #34d399;
  --down: #ef4444;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  position: fixed; inset: 0;
  color: var(--txt);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  touch-action: none;
  background: var(--bg) 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, h3, h4, p { margin: 0; }

.app { position: relative; width: min(100vw, var(--maxw)); height: 100%; margin: 0 auto; }
.screen {
  height: 100%;
  padding: 12px 11px calc(86px + env(safe-area-inset-bottom));
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.screen::-webkit-scrollbar { width: 0; height: 0; }

/* ===== khung the chung ===== */
.card, .card-banner {
  position: relative;
  border: 1.5px solid var(--line);
  background-color: var(--card);
  box-shadow: 0 0 12px var(--glow), inset 0 0 18px rgba(245,196,81,.06);
  backdrop-filter: blur(3px);
  border-radius: 15px;
}

/* layout 2 cot */
.duo { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; align-items: start; margin-top: 10px; }
.duo-bot { align-items: stretch; }

/* cot phai trong duo */
.right-col { display: flex; flex-direction: column; justify-content: center; gap: 10px; }

/* hang 3 the: TRUOT NGANG */
.trio { display: flex; gap: 9px; margin-top: 10px; align-items: flex-start;
  overflow-x: auto; overflow-y: hidden; touch-action: pan-x;
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.trio::-webkit-scrollbar { height: 0; }
.trio > * { flex: 0 0 auto; }
.trio > .bds { width: 210px; height: 188px; }
.trio > .net { width: 230px; }
.trio > .stake { width: 148px; height: 188px; }   /* Chieu cao bang BDS (188px), chieu rong scale theo anh (148px) */

/* nut chung */
.btn-gold {
  width: 100%; height: 30px; border-radius: 9px; margin-top: 9px;
  background: linear-gradient(90deg, var(--gold2), var(--gold));
  color: #2a1800; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  box-shadow: 0 0 12px rgba(245,196,81,.5);
}
.btn-gold.sm { height: 26px; font-size: 10px; }
.btn-ghost {
  width: 100%; height: 28px; border-radius: 9px; margin-top: 9px;
  border: 1px solid var(--line); color: var(--amber); font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: rgba(245,196,81,.08);
}
.btn-ghost.sm { height: 24px; font-size: 9.5px; margin-top: 7px; }

/* ======================= Header: 1 ANH PNG + overlay ======================= */
.hero-head { position: relative; }
.hero-head-img { width: 100%; height: auto; display: block; }   /* theo ti le anh */

/* menu / chuong de len tren anh (dat theo %) */
.menu-btn { position: absolute; top: 3.5%; left: 2%; z-index: 3;
  display: grid; gap: 5px; align-content: center; width: 26px; height: 30px; }
.menu-btn span { width: 22px; height: 2.4px; border-radius: 99px; background: #f0ece4; box-shadow: 0 0 8px rgba(255,215,0,.7); }
.bell-btn { position: absolute; top: 3%; right: 2%; z-index: 3; width: 32px; height: 32px; display: grid; place-items: center; }
.bell-btn svg { width: 21px; height: 21px; color: #f0ece4; filter: drop-shadow(0 0 6px rgba(255,215,0,.6)); }
.bell-badge {
  position: absolute; top: -2px; right: -2px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 99px; background: #ef4444; color: #fff; font-size: 9px; font-weight: 800;
  line-height: 15px; text-align: center; box-shadow: 0 0 8px rgba(239,68,68,.8);
}

/* ===== O tong tai san (overlay len anh header) – thu nho 70% ===== */
.total-asset {
  position: absolute; left: 12%; right: 12%; bottom: 6%;
  background: rgba(14, 12, 40, .68);
  border: 1.2px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 12px var(--glow);
  z-index: 3;
}
.ta-row { display: flex; align-items: center; gap: 6px; }
.ta-label { font-size: 7px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.eye { width: 10px; height: 6px; border: 1.5px solid var(--muted); border-radius: 50%; position: relative; display: inline-block; flex: 0 0 auto; }
.eye::after { content: ""; position: absolute; inset: 1px 2px; border-radius: 50%; background: var(--muted); }
.ta-balance { margin-top: 3px; font-size: 15px; font-weight: 900; line-height: 1; white-space: nowrap;
  background: linear-gradient(90deg, #ffd700, #ffb347); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ta-balance small { font-size: 8px; -webkit-text-fill-color: var(--muted); }
.ta-bot { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; }
.ta-usd { font-size: 7px; color: var(--muted); }
.ta-onchain {
  font-size: 6px; font-weight: 800; color: var(--cyan);
  background: rgba(77,216,224,.12); border: 1px solid rgba(77,216,224,.3);
  padding: 1px 6px; border-radius: 99px;
}

/* ======================= 8 dich vu (2 hang x 4 cot) – moi o la 1 ANH PNG vuong ======================= */
.svcrow { margin-top: 10px; padding: 10px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.svc-box {
  aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  border: 1.3px solid var(--line); background: rgba(245,196,81,.06);
  box-shadow: 0 0 10px var(--glow);
  display: grid; place-items: center;
}
.svc-box img { width: 100%; height: 100%; object-fit: cover; display: block; }


/* ======================= Blockchain card (cot trai) ======================= */
.blockchain { padding: 10px 9px; display: flex; flex-direction: column; }
.bc-title { font-size: 10px; font-weight: 800; color: var(--gold); letter-spacing: .2px; }
.bc-sub { font-size: 7px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.bc-tags { font-size: 6.5px; color: var(--cyan); margin-top: 2px; font-weight: 600; }

.oc-head { margin-top: 8px; }
.oc-head h4 { font-size: 9px; font-weight: 800; color: #e8dfc8; letter-spacing: .2px; }
.oc-balance { margin-top: 3px; font-size: 15px; font-weight: 900; line-height: 1;
  background: linear-gradient(90deg, #ffd700, #ffb347); -webkit-background-clip: text; background-clip: text; color: transparent; }
.oc-balance small { font-size: 8px; -webkit-text-fill-color: var(--muted); }
.oc-usd { margin-top: 2px; font-size: 8px; color: var(--gold); }

/* coins (hang ngang, 4 coin) */
.coins { display: flex; gap: 4px; margin-top: 8px; }
.coin {
  flex: 1 1 0; min-width: 0; text-align: center; padding: 5px 2px; border-radius: 8px;
  border: 1px solid var(--line); background: rgba(245,196,81,.05);
}
.coin img { width: 18px; height: 18px; border-radius: 50%; margin: 0 auto 2px; }
.coin b { display: block; font-size: 7px; color: var(--amber); }
.coin span { display: block; font-size: 7.5px; font-weight: 800; }
.coin em { display: block; font-style: normal; font-size: 6px; color: var(--muted); }

/* wallet actions (4 nut tron) */
.wallet-actions { display: flex; justify-content: space-between; gap: 3px; margin-top: 8px; }
.wact { display: grid; justify-items: center; gap: 3px; flex: 1 1 0; min-width: 0; }
.wact-ic {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1.2px solid var(--line); background: rgba(245,196,81,.1); box-shadow: 0 0 8px var(--glow);
}
.wact-ic svg { width: 14px; height: 14px; color: var(--amber); }
.wact small { font-size: 7px; color: #e8dfc8; font-weight: 700; }

/* ======================= Quantum Node (cot phai, tren) ======================= */
.qnode { padding: 10px; text-align: center; }
.qn-title { font-size: 9px; font-weight: 800; color: var(--cyan); letter-spacing: .3px; }
.qn-count { margin-top: 6px; font-size: 28px; font-weight: 900; line-height: 1;
  background: linear-gradient(180deg, #4dd8e0, #3b82f6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.qn-count small { display: block; font-size: 9px; font-weight: 700; -webkit-text-fill-color: var(--muted); margin-top: 3px; }

/* ======================= Quantum Security (cot phai, duoi) ======================= */
.qsec { padding: 10px; }
.qs-title { font-size: 9px; font-weight: 800; color: var(--gold); letter-spacing: .2px; margin-bottom: 7px; }
.qs-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.qs-list li { display: flex; align-items: center; gap: 5px; font-size: 8px; font-weight: 700; color: #e8dfc8; }
.qs-list svg { width: 13px; height: 13px; flex: 0 0 13px; color: var(--cyan); filter: drop-shadow(0 0 3px rgba(77,216,224,.5)); }

/* ======================= Banner BDS: ANH PNG + nut overlay ======================= */
.bds { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.bds-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bds-btn {
  position: absolute; left: 10px; right: 10px; bottom: 12px; width: auto; margin: 0; z-index: 3;
  height: 28px; border-radius: 8px; font-size: 10px; font-weight: 800;
  background: linear-gradient(90deg, var(--gold2), var(--gold));
  color: #2a1800;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 12px rgba(245,196,81,.6);
}

/* ======================= Mang blockchain ======================= */
.net { padding: 10px; display: flex; flex-direction: column; }
.net-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.net-head h3 { font-size: 9px; font-weight: 800; color: #e8dfc8; letter-spacing: .2px; }
.dot-live { display: inline-flex; align-items: center; gap: 3px; font-size: 7.5px; color: var(--up); font-weight: 700; flex: 0 0 auto; white-space: nowrap; }
.dot-live i { width: 5px; height: 5px; border-radius: 50%; background: var(--up); box-shadow: 0 0 6px var(--up); animation: blink-dot 1.4s ease-in-out infinite; }
@keyframes blink-dot { 50% { opacity: .25; } }
.net-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 7px; }
.net-cell { min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 4px 5px; background: rgba(245,196,81,.05); }
.netc-ic { display: inline-grid; place-items: center; width: 14px; height: 14px; color: var(--gold); margin-bottom: 1px; }
.netc-ic svg { width: 12px; height: 12px; }
.net-cell small { display: block; font-size: 6.5px; color: var(--muted); font-weight: 600; }
.net-cell b { display: block; font-size: 8px; font-weight: 800; white-space: nowrap; margin-top: 1px; }
.net .btn-ghost { margin-top: auto; height: 24px; font-size: 9px; }

/* ======================= Staking: ANH PNG + nut overlay (giong BDS) ======================= */
.stake { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.stake-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stake-btn {
  position: absolute; left: 10px; right: 10px; bottom: 12px; width: auto; margin: 0; z-index: 3;
  height: 28px; border-radius: 8px; font-size: 10px; font-weight: 800;
  background: linear-gradient(90deg, var(--gold2), var(--gold));
  color: #2a1800;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 12px rgba(245,196,81,.6);
}

/* ======================= DAO + mini services ======================= */
.dao { padding: 10px; display: flex; flex-direction: column; }
.dao-title { font-size: 10px; font-weight: 800; color: var(--gold); letter-spacing: .2px; }
.dao-desc { font-size: 7.5px; color: var(--muted); margin-top: 3px; }
.dao-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.dao-stats > div { text-align: center; }
.dao-stats small { display: block; font-size: 7px; color: var(--muted); font-weight: 600; }
.dao-stats b { display: block; font-size: 12px; font-weight: 900; margin-top: 2px; }
.dao .btn-ghost { margin-top: auto; }

/* mini card grid (4 icon PNG, 2x2 cuon ngang) */
.mini-grid {
  display: grid;
  grid-template-rows: auto auto;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.mini-grid::-webkit-scrollbar { display: none; }

.mini-grid .svc-box {
  height: 64px; /* Tang gap doi size */
  width: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 0 6px var(--glow);
}
/* Kích thước chính xác theo tỷ lệ ảnh thực tế tránh bị sập layout */
.mini-grid .svc-box:nth-child(1) { aspect-ratio: 334 / 200; }
.mini-grid .svc-box:nth-child(2) { aspect-ratio: 314 / 194; }
.mini-grid .svc-box:nth-child(3) { aspect-ratio: 340 / 196; }
.mini-grid .svc-box:nth-child(4) { aspect-ratio: 314 / 202; }

.mini-grid .svc-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  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(10,8,32,.84), rgba(6,4,20,.98));
  border-top: 1px solid rgba(245,196,81,.25);
  padding: 7px 4px calc(10px + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
}
.nav-item { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #5e5a4e; font-size: 8.5px; font-weight: 700; letter-spacing: .2px; }
.nav-item svg { width: 20px; height: 20px; color: currentColor; }
.nav-item.active { color: var(--gold); }
.nav-item.active svg { filter: drop-shadow(0 0 6px rgba(245,196,81,.7)); }
.nav-center { position: relative; flex: 0 0 auto; }
.nav-center-hex {
  width: 56px; height: 56px; margin-top: -26px; border-radius: 50%;
  background: url("public/nav-center-btn.png") center / cover no-repeat;
  overflow: hidden;
  clip-path: circle(50%);
  box-shadow: none;
  filter: none;
}

/* =====================================================================
   HIEU UNG VIEN NEON CHAY + CHOP (tone VANG / GOLD)
   ===================================================================== */
@property --neon-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.card, .card-banner, .btn-gold { position: relative; }

.card::after, .card-banner::after, .btn-gold::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.6px;
  background: conic-gradient(from var(--neon-a),
    transparent 0deg 55deg,
    rgba(255,179,71,.35) 80deg,
    var(--neon) 104deg,
    #ffffff 118deg,
    var(--neon) 132deg,
    rgba(212,164,56,.5) 156deg,
    transparent 185deg 360deg);
  -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.8s linear infinite;
  pointer-events: none; z-index: 5;
  filter: drop-shadow(0 0 4px var(--neon));
}
.card:nth-of-type(2)::after { animation-delay: -.5s; }
.card:nth-of-type(3)::after { animation-delay: -1s; }
.card:nth-of-type(4)::after { animation-delay: -1.5s; }
.card:nth-of-type(5)::after { animation-delay: -2s; }
.btn-gold::after { padding: 1.3px; }

.card, .card-banner { animation: neon-blink 2.8s ease-in-out infinite; }
.card:nth-of-type(2) { animation-delay: -.5s; }
.card:nth-of-type(3) { animation-delay: -1s; }
.card:nth-of-type(4) { animation-delay: -1.5s; }
.card:nth-of-type(5) { animation-delay: -2s; }

@keyframes neon-run { to { --neon-a: 360deg; } }
@keyframes neon-blink {
  0%, 100% { box-shadow: 0 0 10px var(--glow), inset 0 0 16px rgba(245,196,81,.06); }
  50%      { box-shadow: 0 0 18px rgba(255,215,0,.45), inset 0 0 20px rgba(245,196,81,.12); }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card-banner { animation: none; }
  .card::after, .card-banner::after, .btn-gold::after, .dot-live i { animation: none; }
}
