/* ============================================
   DEFI PRO V4 — Layout
   原有页面结构不变，仅统一间距与视觉
   ============================================ */

/* ── 主内容区 ── */
#app-main {
  position: fixed;
  top: 0;
  padding-top: var(--safe-t);  /* ★ 把 safe-area 内嵌，顶部不再裸露 body */
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  overflow: hidden;
}

/* ── 每个 Tab 页面 ── */
.page {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;

  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;

  padding: var(--page-px);
  padding-bottom: var(--sp-6);   /* #app-main 已避开导航栏,这里不需要再加 88px */

  display: none;
  opacity: 0;
}

.page.active {
  display: block;
  opacity: 1;
  animation: page-in var(--dur-normal, 250ms) var(--ease, cubic-bezier(.2,.8,.2,1)) backwards;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── 底部 TabBar：只保留 DApp 自身导航 ── */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;

  height: calc(var(--tabbar-h) + var(--safe-b));
  padding: 12px 10px var(--safe-b);

  display: flex;
  align-items: flex-start;
  justify-content: space-around;

  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  border-top: 1px solid var(--line);
  z-index: var(--z-tabbar);
  box-shadow: none;
}

.tab-item {
  flex: 1;
  min-width: 0;
  min-height: var(--control-h);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 5px;
  padding: 4px 0;

  color: var(--text-3);
  position: relative;

  transition: color var(--t-fast, 150ms);
  -webkit-tap-highlight-color: transparent;
}

.tab-item svg {
  width: 23px;
  height: 23px;
  stroke-width: 1.8;
}

.tab-item span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.1;
}

.tab-item.active {
  color: var(--gold);
}

.tab-item.active svg {
  transform: none;
  filter: none;
}

/* 选中:顶部 22×3 金条 + 光晕(规范 8.12) */
.tab-item.active::after {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 22px;
  height: 3px;
  margin-left: -11px;
  border-radius: 3px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}

/* ── Tab 未读徽章 ── */
.tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 16px);

  min-width: 16px;
  height: 16px;
  padding: 0 4px;

  background: var(--gold);
  color: var(--text-on-gold);
  box-shadow: 0 0 0 2px var(--bg);

  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;

  border-radius: var(--r-pill);
}

/* ── 连接钱包遮罩 ── */
#connect-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);

  background:
    radial-gradient(520px 320px at 50% -60px, var(--blue-glow), transparent 70%),
    var(--bg);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: var(--sp-5);
  text-align: center;
  padding: var(--sp-8);

  transition:
    opacity var(--dur-slow) var(--ease-out);
}

#connect-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

#connect-overlay .connect-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

#connect-overlay .connect-desc {
  font-size: 13px;
  color: var(--text-2);
  max-width: 280px;
  line-height: 1.5;
}

#connect-overlay .connect-icon {
  width: 80px;
  height: 80px;

  border-radius: var(--r-xl);
  background: var(--surface-2);
  border: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: var(--sp-2);
}

#connect-overlay .connect-icon svg {
  width: 36px;
  height: 36px;
  color: var(--gold);
}