/* =====================================================================
   HFRAM – Nong nghiep cong nghe cao Web3 (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
   - Banner: chi code KHUNG + NUT, phan con lai la ANH (theo ti le anh)
   - Hieu ung vien neon CHAY + CHOP (tone xanh la)
   ===================================================================== */

:root {
  --maxw: 440px;
  --bg: #03140d;
  --green: #22c55e;
  --green2: #16a34a;
  --mint: #6ee7b7;
  --cyan: #2dd4bf;
  --gold: #f5c451;
  --line: rgba(52, 211, 153, .38);
  --glow: rgba(34, 197, 94, .26);
  --neon: #45f08a;          /* vet sang chay tren vien */
  --card: rgba(7, 28, 19, .58);
  --txt: #eaf7ef;
  --muted: #8db9a5;
  --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, 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(34,197,94,.07);
  backdrop-filter: blur(3px);
  border-radius: 15px;
}

/* layout 2 cot - moi cot cao TU NHIEN theo noi dung/anh (full size) */
.duo { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; align-items: start; margin-top: 10px; }
.duo-top { align-items: start; }
.duo-wide { grid-template-columns: minmax(0,1.32fr) minmax(0,1fr); }   /* cot trai rong hon */

/* hang 3 the (tin tuc / thi truong / carbon): TRUOT NGANG - keo de hien */
.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 > .news { width: 266px; }
.trio > .market { width: 206px; }
.trio > .carbon { width: 200px; }

/* nut chung */
.btn-green {
  width: 100%; height: 30px; border-radius: 9px; margin-top: 9px;
  background: linear-gradient(90deg, var(--green2), var(--green));
  color: #042; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  box-shadow: 0 0 12px rgba(34,197,94,.5);
}
.btn-green.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(--mint); font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: rgba(34,197,94,.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: #d8f5e6; box-shadow: 0 0 8px rgba(69,240,138,.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: #d8f5e6; filter: drop-shadow(0 0 6px rgba(69,240,138,.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);
}

/* ======================= 6 dich vu (khung card rieng) ======================= */
.svcrow { margin-top: 10px; padding: 12px 4px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.svc { display: grid; justify-items: center; gap: 6px; text-align: center; }
.svc-ic {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  border: 1.3px solid var(--line); background: rgba(34,197,94,.1);
  box-shadow: 0 0 10px var(--glow);
}
.svc-ic svg { width: 24px; height: 24px; color: var(--green); filter: drop-shadow(0 0 4px rgba(69,240,138,.5)); }
.svc small { font-size: 8px; line-height: 1.15; color: #d6efe1; font-weight: 600; }

/* ======================= Vi HFRAM (thu nho cho vua cot) ======================= */
.wallet { padding: 9px 9px 10px; display: flex; flex-direction: column; }
.wallet .coins { margin-top: auto; }   /* day 3 coin xuong day, cao bang anh cube */
.wallet-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.wallet-title { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 800; color: #d6efe1; }
.eye { width: 13px; height: 8px; border: 2px solid var(--muted); border-radius: 50%; position: relative; display: inline-block; flex: 0 0 auto; }
.eye::after { content: ""; position: absolute; inset: 1.5px 3px; border-radius: 50%; background: var(--muted); }
.manage { font-size: 8px; color: var(--mint); font-weight: 600; flex: 0 0 auto; }
.wallet-label { margin-top: 7px; font-size: 8.5px; color: var(--muted); }
.wallet-balance { margin-top: 2px; font-size: 17px; font-weight: 900; line-height: 1; white-space: nowrap;
  background: linear-gradient(90deg, #c7ffdd, #2dd4bf); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wallet-balance small { font-size: 9px; -webkit-text-fill-color: var(--muted); }
.wallet-usd { margin-top: 4px; font-size: 8.5px; color: var(--gold); }
.wallet-actions { display: flex; justify-content: space-between; gap: 3px; margin-top: 10px; }
.wact { display: grid; justify-items: center; gap: 4px; flex: 1 1 0; min-width: 0; }
.wact-ic {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  border: 1.2px solid var(--line); background: rgba(34,197,94,.12); box-shadow: 0 0 8px var(--glow);
}
.wact-ic svg { width: 15px; height: 15px; color: var(--mint); }
.wact small { font-size: 8px; color: #d6efe1; font-weight: 600; }
.coins { display: flex; gap: 5px; margin-top: 10px; }
.coin {
  flex: 1 1 0; min-width: 0; text-align: center; padding: 6px 2px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(34,197,94,.06);
}
.coin img { width: 20px; height: 20px; border-radius: 50%; margin: 0 auto 3px; }
.coin b { display: block; font-size: 8.5px; color: var(--mint); }
.coin span { display: block; font-size: 9px; font-weight: 800; }
.coin em { display: block; font-style: normal; font-size: 7px; color: var(--muted); }

/* ======================= Blockchain card: 1 ANH PNG + nut overlay ======================= */
.bc { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.bc-img-full { width: 100%; height: auto; display: block; }   /* FULL anh, khong cat */
.bc-btn {
  position: absolute; left: 10px; right: 10px; bottom: 12px; width: auto; margin: 0; z-index: 3;
  height: 34px; font-size: 12px;
}

/* ======================= Banner ======================= */
.banner { overflow: hidden; display: flex; flex-direction: column; }
.banner-img { width: 100%; height: auto; display: block; }   /* FULL anh, khong cat */
.banner-btn {
  position: absolute; left: 12px; bottom: 14px;
  height: 24px; padding: 0 12px; border-radius: 8px;
  background: linear-gradient(90deg, var(--green2), var(--green));
  color: #042; font-size: 10px; font-weight: 800;
  display: inline-flex; align-items: center;
  box-shadow: 0 0 12px rgba(34,197,94,.6);
}

/* ======================= Mang blockchain (net, thu nho) ======================= */
.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: 9.5px; font-weight: 800; color: #d6efe1; letter-spacing: .2px; }
.dot-live { display: inline-flex; align-items: center; gap: 3px; font-size: 8px; color: var(--mint); font-weight: 700; flex: 0 0 auto; white-space: nowrap; }
.dot-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); 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: 6px; margin-top: 8px; }
.net-cell { min-width: 0; border: 1.2px solid var(--line); border-radius: 8px; padding: 5px 6px; background: rgba(34,197,94,.06); }
.netc-ic { display: inline-grid; place-items: center; width: 15px; height: 15px; color: var(--green); margin-bottom: 1px; }
.netc-ic svg { width: 14px; height: 14px; }
.net-cell small { display: block; font-size: 7.5px; color: var(--muted); font-weight: 600; }
.net-cell b { display: block; font-size: 9px; font-weight: 800; white-space: nowrap; margin-top: 1px; }
.net .btn-ghost { margin-top: auto; height: 26px; font-size: 9.5px; }

/* ======================= Tien ich (12 icon) ======================= */
.util { padding: 11px 7px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 2px; align-content: start; }
.ut { display: grid; justify-items: center; gap: 5px; text-align: center; }
.ut-ic {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  border: 1.2px solid var(--line); background: rgba(34,197,94,.09); box-shadow: 0 0 8px var(--glow);
}
.ut-ic svg { width: 21px; height: 21px; color: var(--green); }
.ut small { font-size: 7.5px; line-height: 1.15; color: #d6efe1; font-weight: 600; }

/* ======================= Staking: 1 ANH PNG (FULL) + nut overlay ======================= */
.stake { padding: 0; overflow: hidden; }
.stake-img { width: 100%; height: auto; display: block; }   /* FULL anh, khong cat */
.stake-btn {
  position: absolute; left: 12px; right: 12px; bottom: 14px; width: auto; margin: 0; z-index: 3;
  height: 34px; font-size: 12px;
}

/* ======================= Section head ======================= */
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; gap: 4px; }
.sec-head h2 { font-size: 10.5px; font-weight: 800; color: #d6efe1; letter-spacing: .2px; }
.see-all { font-size: 8.5px; color: var(--mint); font-weight: 600; flex: 0 0 auto; }

/* ======================= H'Mart ======================= */
.hmart { padding: 11px; }
.prods { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; touch-action: pan-x;
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.prods::-webkit-scrollbar { height: 0; }
.prod { flex: 0 0 auto; width: 96px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: rgba(34,197,94,.06); }
.prod img { width: 100%; height: auto; display: block; }
.prod b { display: block; font-size: 9px; font-weight: 700; line-height: 1.2; padding: 5px 6px 0; min-height: 26px; }
.prod span { display: block; font-size: 11px; font-weight: 800; color: var(--green); padding: 2px 6px 7px; }

/* ======================= NFT (anh trai - noi dung phai) ======================= */
.nft { padding: 11px; }
.nft-body { display: flex; gap: 9px; align-items: stretch; }
.nft-img { flex: 0 0 40%; width: 40%; height: auto; align-self: flex-start; border-radius: 10px; object-fit: cover; }
.nft-info { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.nft-name { display: block; font-size: 10.5px; font-weight: 800; line-height: 1.2; }
.nft-id { display: inline-block; align-self: flex-start; font-size: 8px; font-weight: 800; color: var(--mint); background: rgba(34,197,94,.14);
  border: 1px solid var(--line); padding: 2px 7px; border-radius: 99px; margin-top: 4px; }
.nft-meta { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 3px; }
.nft-meta li { font-size: 8px; color: var(--muted); line-height: 1.25; }
.nft-meta b { color: #e7f7ee; font-weight: 700; }
.nft-info .btn-ghost { margin-top: auto; }

/* ======================= Tin tuc ======================= */
.news { padding: 11px; }
.news-item { display: flex; gap: 9px; padding: 9px 0; border-top: 1px solid rgba(52,211,153,.16); }
.news-item:first-of-type { border-top: 0; padding-top: 2px; }
.news-item img { width: 74px; height: 74px; flex: 0 0 74px; border-radius: 9px; object-fit: cover; }
.news-item > div { min-width: 0; display: flex; flex-direction: column; }
.news-item b { font-size: 11px; font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-item p { font-size: 9px; color: var(--muted); line-height: 1.35; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-item em { font-style: normal; font-size: 8.5px; color: var(--mint); margin-top: auto; padding-top: 4px; }

/* ======================= Thi truong ======================= */
.market { padding: 11px; }
.mk-title { font-size: 10.5px; font-weight: 800; color: #d6efe1; margin-bottom: 8px; }
.mk-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.mk-list li { display: flex; align-items: center; gap: 5px; font-size: 9px; }
.mk-list span { flex: 0 0 auto; width: 48px; color: #d6efe1; }
.mk-list b { flex: 1 1 auto; text-align: right; font-weight: 800; font-size: 9.5px; }
.mk-list i { flex: 0 0 auto; width: 40px; text-align: right; font-style: normal; font-size: 8.5px; font-weight: 700; }
.mk-list .up { color: var(--up); }
.mk-list .down { color: var(--down); }
.mk-upd { margin-top: 9px; font-size: 7.5px; color: var(--muted); }

/* ======================= Carbon: 1 ANH PNG (FULL) + nut overlay ======================= */
.carbon { padding: 0; overflow: hidden; }
.carbon-img { width: 100%; height: auto; display: block; }   /* FULL anh, khong cat */
.carbon-btn {
  position: absolute; left: 10px; right: 10px; bottom: 12px; width: auto; margin: 0; z-index: 3;
}

/* ======================= 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(5,26,17,.84), rgba(3,18,12,.98));
  border-top: 1px solid rgba(52,211,153,.3);
  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: #5e8a76; font-size: 8.5px; font-weight: 600; }
.nav-item svg { width: 20px; height: 20px; color: currentColor; }
.nav-item.active { color: var(--green); }
.nav-item.active svg { filter: drop-shadow(0 0 6px rgba(34,197,94,.7)); }
.nav-badge { position: absolute; top: -4px; right: 50%; transform: translateX(16px); min-width: 13px; height: 13px;
  padding: 0 2px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 8px; font-weight: 800;
  line-height: 13px; text-align: center; font-style: normal; }
.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;
  filter: drop-shadow(0 0 12px rgba(34,197,94,.7));
}

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

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

.card::after, .card-banner::after, .btn-green::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.6px;
  background: conic-gradient(from var(--neon-a),
    transparent 0deg 55deg,
    rgba(110,231,183,.35) 80deg,
    var(--neon) 104deg,
    #ffffff 118deg,
    var(--neon) 132deg,
    rgba(45,212,191,.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-green::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(34,197,94,.07); }
  50%      { box-shadow: 0 0 18px rgba(52,211,153,.6), inset 0 0 20px rgba(34,197,94,.14); }
}

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