/* ============================================================
   CDN 设备租赁平台 - 移动端科技感样式
   ============================================================ */

:root {
  --cyber: #29e0ff;
  --violet: #7c5cff;
  --deep: #050b18;
  --card: #0b1426;
  --line: rgba(41, 224, 255, 0.14);
}

* { -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--deep);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  overflow-x: hidden;
}

/* ---------- 页面加载层 ---------- */
.page-loading {
  position: fixed; inset: 0; z-index: 999;
  background: var(--deep);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity .4s ease;
}
.page-loading.hidden { opacity: 0; pointer-events: none; }
.loading-logo { width: 64px; height: 64px; }
.spin-slow { transform-origin: center; animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 背景特效 ---------- */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg-grid {
  position: absolute; inset: -50%;
  background-image:
    linear-gradient(rgba(41,224,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41,224,255,0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  transform: perspective(500px) rotateX(30deg);
  animation: gridMove 14s linear infinite;
}
@keyframes gridMove { to { background-position: 0 42px; } }
.bg-glow { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .25; }
.bg-glow-1 { width: 280px; height: 280px; background: var(--cyber); top: -80px; right: -80px; animation: float1 9s ease-in-out infinite; }
.bg-glow-2 { width: 320px; height: 320px; background: var(--violet); bottom: 5%; left: -120px; animation: float1 11s ease-in-out infinite reverse; }
@keyframes float1 { 50% { transform: translateY(28px) scale(1.08); } }

/* ---------- 顶部 ---------- */
.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(5, 11, 24, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo-icon { width: 34px; height: 34px; filter: drop-shadow(0 0 8px rgba(41,224,255,.5)); }
.wallet-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: #051018;
  background: linear-gradient(135deg, var(--cyber), var(--violet));
  box-shadow: 0 0 16px rgba(41,224,255,.35);
  transition: transform .15s ease;
}
.wallet-btn:active { transform: scale(.95); }
.wallet-btn .dot { width: 6px; height: 6px; border-radius: 50%; background: #051018; opacity: .6; }
.wallet-btn.connected { color: var(--cyber); background: rgba(41,224,255,.1); border: 1px solid var(--line); box-shadow: none; }
.wallet-btn.connected .dot { background: #2eea8d; opacity: 1; box-shadow: 0 0 6px #2eea8d; animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .4; } }

/* ---------- 主体 / Tab页 ---------- */
.app-main { padding: 16px 16px 80px; max-width: 520px; margin: 0 auto; }
.tab-page { display: none; animation: pageIn .3s ease; }
.tab-page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }
.page-title { font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 12px; }

/* ---------- Banner ---------- */
.banner {
  position: relative; overflow: hidden;
  border-radius: 16px; padding: 20px;
  background: linear-gradient(135deg, rgba(41,224,255,.12), rgba(124,92,255,.14)), var(--card);
  border: 1px solid var(--line);
}
.banner-lines {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 85% 20%, rgba(41,224,255,.18), transparent 45%),
    radial-gradient(circle at 15% 90%, rgba(124,92,255,.15), transparent 40%);
}
.banner-lines::after {
  content: ''; position: absolute; top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(41,224,255,.08), transparent);
  animation: sweep 4s ease-in-out infinite;
}
@keyframes sweep { 60%, 100% { left: 140%; } }
.banner-chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 10px; letter-spacing: 1px; color: var(--cyber);
  background: rgba(41,224,255,.1); border: 1px solid var(--line);
}

/* ---------- 面板 / 卡片 ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px;
}
.panel-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 14px;
}

/* ---------- 份数选择 ---------- */
.qty-row { display: flex; align-items: center; gap: 12px; }
.qty-btn {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  font-size: 22px; color: var(--cyber);
  background: rgba(41,224,255,.08); border: 1px solid var(--line);
  transition: all .15s ease;
}
.qty-btn:active { background: rgba(41,224,255,.2); transform: scale(.93); }
.qty-display {
  flex: 1; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
  background: rgba(5,11,24,.6); border: 1px solid var(--line);
}

/* ---------- 周期选择 ---------- */
.period-btn {
  padding: 10px 4px; border-radius: 12px; text-align: center;
  font-size: 13px; color: #cbd5e1;
  background: rgba(5,11,24,.6); border: 1px solid var(--line);
  transition: all .2s ease;
}
.period-btn .rate { font-size: 10px; color: #64748b; margin-top: 2px; }
.period-btn.active {
  color: #fff; border-color: var(--cyber);
  background: linear-gradient(135deg, rgba(41,224,255,.15), rgba(124,92,255,.15));
  box-shadow: 0 0 12px rgba(41,224,255,.2);
}
.period-btn.active .rate { color: var(--cyber); }

/* ---------- 预览 ---------- */
.preview-box {
  border-radius: 12px; padding: 12px 14px;
  background: rgba(5,11,24,.6); border: 1px dashed var(--line);
}
.preview-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: #94a3b8; padding: 4px 0;
}

/* ---------- 支付方式 ---------- */
.pay-btn {
  padding: 10px; border-radius: 12px; text-align: center;
  font-size: 13px; font-weight: 600; color: #cbd5e1;
  background: rgba(5,11,24,.6); border: 1px solid var(--line);
  transition: all .2s ease;
}
.pay-btn span { display: block; font-size: 10px; font-weight: 400; color: #64748b; margin-top: 2px; }
.pay-btn.active { color: #fff; border-color: var(--cyber); background: rgba(41,224,255,.08); }

/* ---------- 按钮 ---------- */
.btn-primary {
  width: 100%; padding: 13px; border-radius: 12px;
  font-size: 15px; font-weight: 700; color: #051018;
  background: linear-gradient(135deg, var(--cyber), var(--violet));
  box-shadow: 0 4px 20px rgba(41,224,255,.3);
  transition: all .15s ease;
}
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .5; }
.btn-ghost {
  padding: 9px 18px; border-radius: 10px;
  font-size: 13px; color: var(--cyber);
  background: rgba(41,224,255,.06); border: 1px solid var(--line);
}
.btn-danger {
  width: 100%; padding: 12px; border-radius: 12px;
  font-size: 14px; font-weight: 600; color: #ff5b6e;
  background: rgba(255,91,110,.07); border: 1px solid rgba(255,91,110,.25);
}

/* ---------- 订单卡片 ---------- */
.order-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; position: relative; overflow: hidden;
}
.order-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--cyber), var(--violet));
  opacity: .6;
}
.order-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: rgba(46,234,141,.1); color: #2eea8d; border: 1px solid rgba(46,234,141,.25);
}
.order-tag.ended { background: rgba(100,116,139,.12); color: #94a3b8; border-color: rgba(100,116,139,.3); }
.order-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.order-cell { font-size: 10px; color: #64748b; }
.order-cell b { display: block; font-size: 13px; color: #e2e8f0; margin-top: 1px; }

/* ---------- 进度条 ---------- */
.progress-track {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: rgba(41,224,255,.08);
}
.progress-bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--cyber), var(--violet));
  box-shadow: 0 0 8px rgba(41,224,255,.5);
  transition: width .6s ease;
}

/* ---------- 推广 ---------- */
.level-card {
  border-radius: 16px; padding: 18px;
  background: linear-gradient(135deg, rgba(41,224,255,.1), rgba(124,92,255,.12)), var(--card);
  border: 1px solid var(--line);
}
.invite-box {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(5,11,24,.6); border: 1px solid var(--line);
}
.copy-btn {
  flex-shrink: 0; padding: 6px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: #051018;
  background: linear-gradient(135deg, var(--cyber), var(--violet));
}
.copy-btn:active { transform: scale(.94); }
.stat-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; text-align: center;
}
.stat-card.clickable:active { background: rgba(41,224,255,.06); }
.stat-num { font-size: 20px; font-weight: 800; color: #fff; }
.stat-label { font-size: 11px; color: #64748b; margin-top: 3px; }

/* ---------- 我的 ---------- */
.me-head {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px;
}
.me-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(41,224,255,.08); border: 1px solid var(--line);
}
.wallet-card {
  position: relative; cursor: pointer;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px;
  transition: border-color .2s ease;
}
.wallet-card:active { border-color: var(--cyber); }
.wd-btn {
  margin-top: 8px; width: 100%; padding: 6px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--cyber);
  background: rgba(41,224,255,.08); border: 1px solid var(--line);
}
.wd-btn:active { background: rgba(41,224,255,.18); }

/* ---------- 资金明细 ---------- */
.flow-tab {
  flex-shrink: 0; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; color: #94a3b8;
  background: rgba(5,11,24,.6); border: 1px solid var(--line);
}
.flow-tab.active { color: #051018; font-weight: 600; background: linear-gradient(135deg, var(--cyber), var(--violet)); border-color: transparent; }
.flow-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(5,11,24,.5); border: 1px solid rgba(41,224,255,.07);
}
.flow-amount-in { color: #2eea8d; font-weight: 700; }
.flow-amount-out { color: #ff5b6e; font-weight: 700; }

/* ---------- 底部导航 ---------- */
.bottom-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex;
  background: rgba(7, 14, 28, 0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; padding: 8px 0 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; color: #5a7395;
  transition: color .2s ease;
}
.tab-item svg { width: 22px; height: 22px; }
.tab-item.active { color: var(--cyber); }
.tab-item.active svg { filter: drop-shadow(0 0 6px rgba(41,224,255,.6)); }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.show { display: flex; align-items: flex-end; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); animation: fadeIn .25s ease; }
.modal-body {
  position: relative; width: 100%; max-width: 520px;
  background: #0c1730; border: 1px solid var(--line); border-bottom: none;
  border-radius: 20px 20px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  animation: slideUp .3s cubic-bezier(.3,1.2,.4,1);
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(100%); } }
.modal-title { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 12px; }
.input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  font-size: 15px; color: #fff; outline: none;
  background: rgba(5,11,24,.7); border: 1px solid var(--line);
  transition: border-color .2s ease;
}
.input:focus { border-color: var(--cyber); }

/* ---------- 支付动画 ---------- */
.pay-spinner { display: flex; justify-content: center; gap: 6px; padding-top: 6px; }
.pay-spinner div {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--cyber); animation: bounce 1s infinite ease-in-out;
}
.pay-spinner div:nth-child(2) { animation-delay: .15s; background: #56c8ff; }
.pay-spinner div:nth-child(3) { animation-delay: .3s; background: var(--violet); }
@keyframes bounce { 40% { transform: translateY(-10px); } }

/* ---------- Toast ---------- */
#toastWrap { position: fixed; top: 64px; left: 0; right: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: 86%; padding: 10px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 500; color: #fff;
  background: rgba(12, 23, 48, .95); border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: toastIn .3s ease;
}
.toast.success { border-color: rgba(46,234,141,.4); color: #2eea8d; }
.toast.error { border-color: rgba(255,91,110,.4); color: #ff5b6e; }
.toast.warning { border-color: rgba(255,209,102,.4); color: #ffd166; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } }
.toast.hide { opacity: 0; transform: translateY(-12px); transition: all .3s ease; }

/* ---------- 空状态 ---------- */
.empty-box { text-align: center; padding: 28px 0; color: #4a6585; font-size: 13px; }

/* ---------- 直推成员 ---------- */
.member-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(5,11,24,.5); border: 1px solid rgba(41,224,255,.07);
}
