/* =====================================================================
   AVALON – Kiến tạo tương lai xanh (giao dien mobile Web3)
   - 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 (hero + carbon): chi code KHUNG + NUT, phan con lai la ANH;
     khung scale dung ti le anh (dung aspect-ratio theo file PNG).
   ===================================================================== */

:root {
  --maxw: 440px;
  --bg: #050a18;
  --cyan: #38c6ff;
  --blue: #2b7dff;
  --green: #2fe88a;
  --purple: #a96bff;
  --amber: #ffb547;
  --line: rgba(70,160,255,.40);
  --glow: rgba(56,150,255,.30);
  --neon: #5fd3ff;      /* vet sang chay tren vien */
  --card: rgba(10,20,42,.55);
  --txt: #eaf3ff;
  --muted: #9fb4d6;
}

* { 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;
  /* anh nen PNG cho TOAN BO web (thay public/bg-app.png de doi nen) */
  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, ul { margin: 0; padding: 0; list-style: none; }

.app {
  position: relative;
  width: min(100vw, var(--maxw));
  height: 100%;
  margin: 0 auto;
}

/* ====== Vung cuon duy nhat ====== */
.screen {
  height: 100%;
  padding: 12px 12px calc(126px + 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: nen mo, vien neon ===== */
.card, .card-banner, .eco-card {
  border: 1.5px solid var(--line);
  background-color: var(--card);
  box-shadow: 0 0 12px var(--glow), inset 0 0 18px rgba(40,120,220,.10);
  backdrop-filter: blur(3px);
}

/* ===================== TOP BANNER (gop header + hero) =====================
   1 tam ANH PNG lon, KHONG VIEN. Tran het be ngang + cham mep tren.
   Khung scale dung ti le anh banner-top.png (600 x 272) -> thay anh cung
   ti le se vua khit. Chi cac NUT duoi day duoc code, noi tren anh. */
.topbanner {
  position: relative;
  margin: -12px -12px 0;      /* full-bleed, KHONG vien */
  overflow: hidden;
}
/* anh hien dung TI LE GOC cua file PNG ban dang (khong cat, khong ep) */
.topbanner-img { width: 100%; height: auto; display: block; }

/* nut menu (goc trai tren) */
.tb-menu {
  position: absolute; top: 6%; left: 4%;
  display: grid; gap: 5px; align-content: center;
  width: 38px; height: 38px;
}
.tb-menu span { width: 26px; height: 3px; border-radius: 99px; background: #eaf3ff; box-shadow: 0 0 8px rgba(120,200,255,.8); }

/* nut chuong (goc phai tren) */
.tb-bell {
  position: absolute; top: 6%; right: 14%;
  width: 38px; height: 38px; display: grid; place-items: center;
}
.tb-bell svg { width: 24px; height: 24px; color: #eaf3ff; filter: drop-shadow(0 0 6px rgba(120,200,255,.6)); }
.tb-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 17px; height: 17px; padding: 0 3px;
  border-radius: 99px; background: var(--purple); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
  box-shadow: 0 0 8px rgba(169,107,255,.8);
}

/* avatar (goc phai tren) */
.tb-avatar {
  position: absolute; top: 4%; right: 3%;
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  border: 1.5px solid var(--cyan); box-shadow: 0 0 12px var(--glow); padding: 0;
}
.tb-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* nut "Kham pha cong nghe" */
.tb-explore {
  position: absolute; left: 46%; bottom: 3%;
  height: 24px; padding: 0 13px; border-radius: 15px;
  background: linear-gradient(90deg, rgba(30,30,70,.85), rgba(60,30,110,.85));
  border: 1px solid rgba(169,107,255,.7);
  color: #f1ecff; font-size: 8.4px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px;
  box-shadow: 0 0 14px rgba(169,107,255,.45);
}
.tb-explore i, .cb-btn i, .ghost-btn i, .see-all { font-style: normal; }

/* ===================== LUOI 2 COT ===================== */
.grid2 { display: flex; gap: 10px; margin-top: 12px; align-items: flex-start; }
.grid2-bottom { margin-top: 12px; }
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.col-left { flex: 1.62; }
.col-right { flex: 1; }

.card { border-radius: 14px; }
.pad { padding: 12px; }
.center { text-align: center; align-items: center; display: flex; flex-direction: column; gap: 6px; }

.card-title { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--cyan); }
.card-title.left { text-align: left; width: 100%; }
.muted { color: var(--muted); }
.sm { font-size: 11px; }
.xs { font-size: 9.5px; line-height: 1.5; }
.ok { color: var(--green); font-size: 12px; font-weight: 700; }
.mono { font-size: 10px; font-weight: 700; color: #cfe2ff; letter-spacing: .3px; word-break: break-all; }

/* ===================== The vi ===================== */
.wallet { position: relative; padding: 14px; overflow: hidden; }
.wallet-head { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--muted); }
.eye { width: 17px; height: 11px; border: 2px solid var(--muted); border-radius: 50%; position: relative; }
.eye::after { content: ""; position: absolute; inset: 2px 5px; border-radius: 50%; background: var(--muted); }
.wallet-balance { margin-top: 10px; font-size: 27px; font-weight: 900; line-height: 1; }
.wallet-balance small { font-size: 13px; font-weight: 800; color: var(--muted); }
.wallet-usd { margin-top: 6px; font-size: 12.5px; color: var(--green); font-weight: 700; }
.wallet-spark { width: 70%; height: 40px; margin-top: 12px; filter: drop-shadow(0 0 5px rgba(47,232,138,.6)); }
.wallet-art { position: absolute; right: 8px; bottom: 8px; width: 78px; height: auto; opacity: .95; }

/* ============ 4 nut nhanh ============ */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 14px 6px; }
.action { display: grid; justify-items: center; gap: 6px; text-align: center; }
.action-ic {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 0 12px var(--glow), inset 0 0 8px rgba(255,255,255,.12);
}
.action-ic svg { width: 24px; height: 24px; color: #fff; filter: drop-shadow(0 0 3px rgba(0,0,0,.35)); }
.ic-green  { background: radial-gradient(circle at 50% 30%, #4dffa1, #0f9a5a); }
.ic-blue   { background: radial-gradient(circle at 50% 30%, #5cb6ff, #1a5fd6); }
.ic-purple { background: radial-gradient(circle at 50% 30%, #c79bff, #7d39e0); }
.ic-amber  { background: radial-gradient(circle at 50% 30%, #ffd27a, #e08a14); }
.action strong { font-size: 10.5px; font-weight: 700; }

/* ============ icon tinh nang (TRUOT NGANG khi nhieu o) ============ */
.features {
  display: flex; gap: 8px; padding: 12px 10px;
  overflow-x: auto; overflow-y: hidden;
  touch-action: pan-x; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.features::-webkit-scrollbar { height: 0; }
.feature { flex: 0 0 auto; width: 52px; display: grid; justify-items: center; gap: 5px; text-align: center; }
.feature-ic {
  width: 46px; border-radius: 12px; overflow: hidden;
  background: rgba(30,60,120,.35); border: 1px solid var(--line);
  box-shadow: 0 0 8px var(--glow);
}
/* icon theo TI LE GOC cua file PNG */
.feature-ic img { width: 100%; height: auto; display: block; }
.feature strong { font-size: 9px; font-weight: 700; line-height: 1.15; color: #d7e6ff; }

/* ============ Banner carbon: khung scale theo ti le ANH (360 x 150) ============ */
.carbon-banner {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
}
/* anh theo TI LE GOC cua file PNG; nut "Tham gia ngay" noi tren anh */
.cb-img { width: 100%; height: auto; display: block; }
.cb-btn {
  position: absolute; left: 12px; bottom: 6px;
  height: 21px; padding: 0 10px; border-radius: 6px;
  background: linear-gradient(90deg, rgba(15,40,30,.85), rgba(10,30,22,.85));
  border: 1px solid var(--green);
  color: #eaffef; font-size: 7.7px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px;
  box-shadow: 0 0 12px rgba(47,232,138,.45);
}

/* ============ 2 o Quantum = ANH PNG nguyen khoi (theo ti le anh) + khung neon ============ */
.box-frame {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.box-img { width: 100%; height: auto; display: block; }

/* ============ O su menh = ANH PNG nguyen khoi + nut "Tim hieu them" ============ */
.mission-box {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.mb-img { width: 100%; height: auto; display: block; }
.mb-btn {
  position: absolute; left: 8%; right: 8%; bottom: 2.5%;
  height: 22px; border-radius: 7px;
  background: linear-gradient(90deg, rgba(30,30,70,.85), rgba(60,30,110,.85));
  border: 1px solid rgba(169,107,255,.7);
  color: #f1ecff; font-size: 8px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  box-shadow: 0 0 14px rgba(169,107,255,.45);
}
.mb-btn i { font-style: normal; }

/* ============ art chung trong cot phai ============ */
.art-md { width: 96px; height: auto; filter: drop-shadow(0 0 10px var(--glow)); }

/* ============ Network status ============ */
.netlist { display: grid; gap: 9px; margin: 10px 0 12px; }
.netlist li { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.netlist b { color: #eaf3ff; font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-purple { background: var(--purple); box-shadow: 0 0 6px var(--purple); }
.dot-green  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-blue   { background: var(--blue); box-shadow: 0 0 6px var(--blue); }
.dot-amber  { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

.ghost-btn {
  width: 100%; height: 30px; border-radius: 8px;
  border: 1px solid var(--cyan); color: var(--cyan);
  background: rgba(40,120,220,.12);
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}

/* ============ Danh muc dau tu ============ */
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sec-head h2 { font-size: 13px; font-weight: 800; }
.see-all { font-size: 10.5px; color: var(--cyan); }
.port-row {
  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;
}
.port-row::-webkit-scrollbar { height: 0; }
.port {
  flex: 0 0 auto; width: 118px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 7px;
  background: rgba(20,40,80,.30); display: grid; gap: 3px; justify-items: start;
}
.port-coin { width: 26px; border-radius: 50%; overflow: hidden; }
.port-coin img { width: 100%; height: auto; display: block; }
.port-name { font-size: 10px; font-weight: 700; color: #d7e6ff; }
.port-amt { font-size: 14px; font-weight: 900; }
.port-amt small { font-size: 9px; font-weight: 700; color: var(--muted); }
.port-vnd { font-size: 8.5px; color: var(--muted); }
.port-spark { width: 100%; height: 24px; filter: drop-shadow(0 0 4px rgba(47,232,138,.5)); }
.chg { font-size: 10px; font-weight: 800; }
.chg.up { color: var(--green); }

/* ============ He sinh thai ============ */
.eco { margin-top: 14px; }
.eco-title { font-size: 13px; font-weight: 800; margin-bottom: 10px; letter-spacing: .5px; }
.eco-grid {
  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;
}
.eco-grid::-webkit-scrollbar { height: 0; }
.eco-card { flex: 0 0 auto; width: 138px; border-radius: 12px; overflow: hidden; padding-bottom: 8px; display: grid; }
/* anh theo TI LE GOC cua file PNG */
.eco-card > img { width: 100%; height: auto; display: block; }
.eco-meta { padding: 6px 7px 2px; }
.eco-meta strong { display: block; font-size: 10px; font-weight: 700; }
.eco-meta small { display: block; font-size: 8px; color: var(--muted); }
.bar { height: 4px; margin: 4px 7px 0; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), var(--cyan)); }
.eco-card em { font-size: 9px; font-style: normal; font-weight: 800; color: var(--green); padding: 2px 7px 0; text-align: right; }

/* ============ KHU NAV DUOI (2 tang, ghim duoi) ============ */
.bottom-area {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  background: linear-gradient(180deg, rgba(8,16,38,.85), rgba(5,9,22,.98));
  border-top: 1px solid rgba(70,160,255,.30);
  backdrop-filter: blur(10px);
}

.bottom-nav {
  display: flex; justify-content: space-around; align-items: flex-end;
  padding: 8px 6px 6px;
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #6f86ad; font-size: 10.5px;
}
.nav-item svg { width: 22px; height: 22px; color: currentColor; }
.nav-item.active { color: var(--cyan); }
.nav-item.active svg { filter: drop-shadow(0 0 6px rgba(56,198,255,.7)); }
.nav-center { position: relative; }
.nav-center-circle {
  width: 58px; height: 58px;
  margin-top: -26px;
  border-radius: 50%;
  border: 2px solid rgba(56,198,255,.6);
  background: url("public/nav-center-btn.png") center / cover no-repeat;
  box-shadow: 0 0 16px rgba(56,198,255,.6);
}

/* Thanh phim tat truot ngang */
.quick-bar {
  display: flex; gap: 16px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  overflow-x: auto; overflow-y: hidden;
  border-top: 1px solid rgba(70,160,255,.18);
  touch-action: pan-x;
  scrollbar-width: none;
}
.quick-bar::-webkit-scrollbar { height: 0; }
.quick {
  flex: 0 0 auto;
  display: grid; grid-template-columns: 26px 1fr; align-items: center;
  gap: 7px; min-width: max-content;
}
.quick svg { width: 24px; height: 24px; color: var(--cyan); grid-row: span 2; }
.quick strong { font-size: 11px; font-weight: 700; }
.quick small { font-size: 8.5px; color: var(--muted); }

/* =====================================================================
   HIEU UNG VIEN NEON CHAY + CHOP (mang tu hgame, doi mau theo AVALON)
   - 1 vet sang cyan/trang chay vong quanh vien (conic-gradient xoay)
   - kem nhip "chop" nhe o glow vien
   Ap cho cac BANNER / O / NUT (cac khoi da/duoc them vien).
   ===================================================================== */
@property --neon-a {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* cac khoi co vien neon */
.topbanner, .card, .card-banner, .mission-box, .box-frame, .eco-card,
.tb-explore, .cb-btn, .mb-btn, .ghost-btn { position: relative; }
.tb-explore, .cb-btn, .mb-btn { position: absolute; }   /* giu lai vi tri tuyet doi */

/* vet neon chay doc theo vien (ring tao bang mask) */
.card::after, .card-banner::after, .mission-box::after,
.box-frame::after, .eco-card::after, .tb-explore::after, .cb-btn::after,
.mb-btn::after, .ghost-btn::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1.6px;                 /* do day vet neon = do day vien */
  background: conic-gradient(from var(--neon-a),
    transparent 0deg 55deg,
    rgba(56,198,255,.35) 80deg,
    var(--neon) 104deg,
    #ffffff 118deg,
    var(--neon) 132deg,
    rgba(47,232,138,.45) 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.8s linear infinite;
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 0 4px var(--neon));
}

/* le pha cho moi khoi -> vet chay lech nhau, sinh dong hon */
.card:nth-of-type(2)::after { animation-delay: -.5s; }
.card:nth-of-type(3)::after { animation-delay: -1.1s; }
.card:nth-of-type(4)::after { animation-delay: -1.7s; }
.box-frame:nth-of-type(2)::after { animation-delay: -.8s; }
.mission-box::after { animation-delay: -1.3s; }
.card-banner::after { animation-delay: -.6s; }
.cb-btn::after { animation-delay: -.9s; }
.mb-btn::after { animation-delay: -1.5s; }

/* nhip "chop" nhe cho glow vien */
.card, .card-banner, .mission-box, .box-frame, .eco-card {
  animation: neon-blink 2.8s ease-in-out infinite;
}
.eco-card:nth-of-type(2)::after { animation-delay: -.7s; }
.eco-card:nth-of-type(3)::after { animation-delay: -1.4s; }
.eco-card:nth-of-type(4)::after { animation-delay: -2.0s; }
.eco-card:nth-of-type(2) { animation-delay: -.7s; }
.eco-card:nth-of-type(3) { animation-delay: -1.4s; }
.eco-card:nth-of-type(4) { animation-delay: -2.0s; }
.card:nth-of-type(2)      { animation-delay: -.5s; }
.card:nth-of-type(3)      { animation-delay: -1.1s; }
.card:nth-of-type(4)      { animation-delay: -1.7s; }
.box-frame:nth-of-type(2) { animation-delay: -.8s; }
.mission-box              { animation-delay: -1.3s; }
.card-banner              { animation-delay: -.6s; }

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

@keyframes neon-blink {
  0%, 100% { box-shadow: 0 0 10px var(--glow), inset 0 0 16px rgba(40,120,220,.10); }
  50%      { box-shadow: 0 0 18px rgba(56,198,255,.7), inset 0 0 20px rgba(40,120,220,.18); }
}

/* ton trong nguoi dung tat hieu ung chuyen dong */
@media (prefers-reduced-motion: reduce) {
  .card, .card-banner, .mission-box, .box-frame, .eco-card { animation: none; }
  .card::after, .card-banner::after, .mission-box::after,
  .box-frame::after, .eco-card::after, .tb-explore::after, .cb-btn::after,
  .mb-btn::after, .ghost-btn::after { animation: none; }
}
