/* ============================================================
   COEXK NEW UI — Design System (Phase 2 preview)
   深色金融交易平台 | 紫色品牌 | 绿涨红跌 | 克制专业
   ============================================================ */
:root {
  /* ---- 色彩 ----
     分层原则：页面底 → 卡片 → 输入/浮层逐级提亮，靠色阶不用阴影 */
  --bg-page: #0B0B0F;          /* 页面背景（近黑带蓝调） */
  --bg-page-2: #0E0E13;        /* 次级区域 */
  --bg-card: #15151C;          /* 卡片 */
  --bg-card-2: #1A1A23;        /* 卡片内嵌/输入 */
  --bg-input: #1D1D27;         /* 输入框 */
  --bg-hover: #21212C;         /* hover */
  --bg-chip: #1E1E29;          /* 标签/chip */
  --bg-overlay: rgba(4,4,8,.72);/* 遮罩 */
  --line: #262631;             /* 分隔线 */
  --line-strong: #333340;      /* 强调线 */
  --line-focus: rgba(124,92,255,.55);

  /* 文字 */
  --text-1: #F3F3F6;
  --text-2: #9C9CA8;
  --text-3: #666674;
  --text-invert: #0B0B0F;

  /* 品牌 */
  --brand: #7C5CFF;
  --brand-strong: #9378FF;
  --brand-soft: rgba(124,92,255,.12);
  --brand-soft-2: rgba(124,92,255,.06);

  /* 行情 */
  --up: #16C784;
  --up-soft: rgba(22,199,132,.12);
  --down: #F6465D;
  --down-soft: rgba(246,70,93,.12);
  --warn: #F0B90B;

  /* 几何 */
  --r-card: 14px;
  --r-btn: 10px;
  --r-input: 10px;
  --r-chip: 8px;
  --r-tab: 12px;

  /* 间距（4pt 体系） */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px;

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
          "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-num: "DIN Alternate", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;

  /* 字号阶梯 */
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px;
  --fs-15: 15px; --fs-16: 16px; --fs-18: 18px; --fs-20: 20px; --fs-24: 24px; --fs-32: 32px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: #06060A;                 /* 预览外框（深） */
  color: var(--text-1);
  font-size: var(--fs-14);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* 手机视口容器 */
.phone {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg-page);
  position: relative;
  display: flex;
  flex-direction: column;
}
.phone-body { flex: 1; overflow-y: auto; padding-bottom: 76px; }
.phone-body.no-tab { padding-bottom: 24px; }

/* ============ 文字 ============ */
.t1 { color: var(--text-1); } .t2 { color: var(--text-2); } .t3 { color: var(--text-3); }
.up { color: var(--up); } .down { color: var(--down); } .brand { color: var(--brand); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.fs11 { font-size: var(--fs-11); } .fs12 { font-size: var(--fs-12); }
.fs13 { font-size: var(--fs-13); } .fs14 { font-size: var(--fs-14); }
.fs16 { font-size: var(--fs-16); } .fs18 { font-size: var(--fs-18); }
.fs20 { font-size: var(--fs-20); } .fs24 { font-size: var(--fs-24); }
.fs32 { font-size: var(--fs-32); }
.w500 { font-weight: 500; } .w600 { font-weight: 600; } .w700 { font-weight: 700; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ============ 布局 ============ */
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.gap2 { gap: var(--sp-2); } .gap3 { gap: var(--sp-3); } .gap4 { gap: var(--sp-4); }
.px4 { padding-left: var(--sp-4); padding-right: var(--sp-4); }
.mt2 { margin-top: var(--sp-2); } .mt3 { margin-top: var(--sp-3); } .mt4 { margin-top: var(--sp-4); } .mt6 { margin-top: var(--sp-6); }
.grid { display: grid; }

/* ============ 页面顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--sp-4) 12px;
  background: rgba(11,11,15,.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: .5px; color: var(--text-1); }
.logo b { color: var(--brand); font-weight: 800; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card-2); color: var(--text-2);
  border: 1px solid var(--line);
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { background: var(--bg-hover); }

/* ============ 卡片 ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-4);
}
.card + .card { margin-top: var(--sp-3); }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px; margin-bottom: var(--sp-3);
}
.section-title h3 { font-size: var(--fs-16); font-weight: 600; }
.section-title .more { font-size: var(--fs-12); color: var(--text-3); display: flex; align-items: center; gap: 2px; }

/* ============ 按钮 ============ */
.btn {
  height: 46px; border-radius: var(--r-btn); border: none;
  font-size: var(--fs-15); font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: opacity .12s, transform .06s;
  width: 100%;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:active { opacity: .88; }
.btn-primary:disabled { opacity: .45; }
.btn-ghost { background: var(--brand-soft); color: var(--brand-strong); }
.btn-ghost:active { background: var(--brand-soft); opacity: .85; }
.btn-outline { background: transparent; color: var(--text-1); border: 1px solid var(--line-strong); }
.btn-buy { background: var(--up); color: #04120C; }
.btn-sell { background: var(--down); color: #1A0408; }
.btn-sm { height: 34px; font-size: var(--fs-13); border-radius: 8px; padding: 0 14px; width: auto; }
.btn-block { width: 100%; }
.btn-lg { height: 52px; font-size: var(--fs-16); }

/* ============ 输入框 ============ */
.field { position: relative; }
.field + .field { margin-top: var(--sp-3); }
.field label { display: block; font-size: var(--fs-12); color: var(--text-2); margin-bottom: 6px; }
.input {
  width: 100%; height: 46px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  padding: 0 14px;
  color: var(--text-1); font-size: var(--fs-15);
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--line-focus); }
.input::placeholder { color: var(--text-3); }
.input-append { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: var(--fs-13); color: var(--text-2); }
.code-field { display: flex; gap: 10px; }
.code-field .input { flex: 1; }
.code-btn {
  width: 104px; height: 46px; flex: none;
  border-radius: var(--r-input); border: 1px solid var(--line);
  background: var(--bg-card-2); color: var(--brand-strong);
  font-size: var(--fs-13); font-weight: 500; cursor: pointer;
}
.code-btn:disabled { color: var(--text-3); }

/* ============ Chip / 标签 ============ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-chip);
  background: var(--bg-chip);
  border: 1px solid var(--line);
  font-size: var(--fs-12); color: var(--text-2);
}
.chip-active { color: var(--brand-strong); background: var(--brand-soft); border-color: rgba(124,92,255,.35); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

/* 状态徽标 */
.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 5px; font-size: 10px; font-weight: 600; }
.badge-up { color: var(--up); background: var(--up-soft); }
.badge-down { color: var(--down); background: var(--down-soft); }
.badge-brand { color: var(--brand-strong); background: var(--brand-soft); }
.badge-warn { color: var(--warn); background: rgba(240,185,11,.12); }

/* ============ 行情行 ============ */
.market-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px var(--sp-4);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.market-row:last-child { border-bottom: none; }
.market-row:active { background: var(--bg-page-2); }
.coin-icon {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.coin-sym { font-size: var(--fs-15); font-weight: 600; }
.coin-name { font-size: var(--fs-12); color: var(--text-3); }
.price-col { margin-left: auto; text-align: right; }
.price-col .price { font-family: var(--font-num); font-size: var(--fs-15); font-weight: 600; }
.price-col .chg { font-family: var(--font-num); font-size: var(--fs-12); }
.chg-pill {
  min-width: 62px; height: 26px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-num); font-size: var(--fs-12); font-weight: 600;
}
.chg-pill.up { background: var(--up-soft); color: var(--up); }
.chg-pill.down { background: var(--down-soft); color: var(--down); }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  height: 64px;
  display: flex; align-items: stretch;
  background: rgba(17,17,23,.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); cursor: pointer;
  font-size: 10px; position: relative;
}
.tab-item svg { width: 22px; height: 22px; }
.tab-item.active { color: var(--brand-strong); }
.tab-item.active svg { color: var(--brand); }
/* 交易 Tab 视觉重点：激活时紫色胶囊 */
.tab-item.trade { position: relative; }
.tab-item.trade.active .trade-core {
  background: var(--brand); color: #fff;
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-top: -18px;
  box-shadow: 0 0 0 5px rgba(124,92,255,.12);
}
.tab-item.trade.active .trade-core svg { width: 22px; height: 22px; }
.tab-item.trade .trade-core svg { width: 22px; height: 22px; }

/* ============ 分割 ============ */
.divider { height: 1px; background: var(--line); }
.section-gap { height: 10px; background: var(--bg-page-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ============ 功能宫格 ============ */
.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.menu-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 4px 12px;
  border-radius: var(--r-card);
  cursor: pointer;
}
.menu-item:active { background: var(--bg-page-2); }
.menu-ico {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft-2);
  border: 1px solid rgba(124,92,255,.16);
  color: var(--brand-strong);
}
.menu-ico svg { width: 22px; height: 22px; }
.menu-ico.alt { background: var(--bg-card-2); border-color: var(--line); color: var(--text-2); }
.menu-item .label { font-size: var(--fs-12); color: var(--text-2); }

/* ============ 资产操作 ============ */
.asset-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.asset-act {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  cursor: pointer; padding: 4px 0;
}
.asset-act:active { opacity: .75; }
.asset-act .aico {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-strong);
  display: flex; align-items: center; justify-content: center;
}
.asset-act .aico svg { width: 19px; height: 19px; }
.asset-act .alabel { font-size: var(--fs-12); color: var(--text-2); }

/* ============ 表单页（登录/注册） ============ */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  padding: 72px 28px 40px;
  position: relative; overflow: hidden;
}
/* 极淡科技网格背景 */
.auth-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(124,92,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,92,255,.045) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 30%, transparent 75%);
}
.auth-inner { position: relative; z-index: 1; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; }
.auth-logo .mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #8F74FF, #6B45F0);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.auth-logo .mark svg { width: 22px; height: 22px; }
.auth-title { font-size: var(--fs-24); font-weight: 700; }
.auth-sub { font-size: var(--fs-13); color: var(--text-3); margin-top: 4px; }
.auth-link { font-size: var(--fs-13); color: var(--brand-strong); cursor: pointer; }
.auth-foot { text-align: center; font-size: var(--fs-13); color: var(--text-3); margin-top: 22px; }
.agree { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-12); color: var(--text-2); margin-top: 14px; }
.agree input { margin-top: 2px; accent-color: var(--brand); }

/* 弹出层（设计演示用静态展示） */
.modal-sheet {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 430px;
  background: var(--bg-card);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line-strong);
  padding: 18px var(--sp-4) calc(24px + env(safe-area-inset-bottom));
  z-index: 50;
}
.modal-mask { position: fixed; inset: 0; background: var(--bg-overlay); z-index: 40; }

/* 滚动条隐藏 */
::-webkit-scrollbar { width: 0; height: 0; }

/* 预览索引页 */
.preview-shell { max-width: 1080px; margin: 0 auto; padding: 40px 20px; background: transparent; }
.preview-shell .phone { box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0,0,0,.5); border-radius: 24px; overflow: hidden; min-height: 780px; }
