:root {
  --bg: #070b14;
  --bg2: #0d1424;
  --card: #121a2c;
  --card2: #162033;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8eefc;
  --muted: #8b97b3;
  --blue: #3b82f6;
  --blue2: #2563eb;
  --gold: #f5c542;
  --green: #34d399;
  --purple: #7c5cff;
  --cyan: #22d3ee;
  --orange: #fb923c;
  --red: #f43f5e;
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #152246 0%, var(--bg) 55%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: calc(84px + var(--safe-bottom));
}

.page { padding: 18px 16px 24px; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.h1 {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.brand.compact { margin-bottom: 0; flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.topbar-left { flex: 1; min-width: 0; }
.refresh-btn {
  width: 40px; height: 40px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(59,130,246,.22), rgba(15,23,42,.55));
  color: #dbeafe;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.refresh-btn svg { width: 18px; height: 18px; }
.refresh-btn.spin svg { animation: spin .6s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

.channels-single { grid-template-columns: 1fr; max-width: 180px; }

.menu-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  color: white; flex-shrink: 0;
}
.menu-ico svg { width: 18px; height: 18px; display: block; }
.ico-blue { background: linear-gradient(145deg, #60a5fa, #2563eb); }
.ico-green { background: linear-gradient(145deg, #34d399, #059669); }
.ico-slate { background: linear-gradient(145deg, #94a3b8, #475569); }
.ico-orange { background: linear-gradient(145deg, #fdba74, #ea580c); }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
  background: linear-gradient(145deg, #ffe7a3, #fff8e7);
}
.brand-mark img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.brand h2 { font-size: 18px; font-weight: 800; }
.brand p { color: var(--muted); font-size: 12px; margin-top: 2px; }

.balance-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(245,197,66,.28), transparent 55%),
    radial-gradient(320px 160px at 0% 100%, rgba(59,130,246,.35), transparent 50%),
    linear-gradient(135deg, #1a3a78 0%, #152a55 42%, #0f1b38 100%);
  border: 1px solid rgba(96,165,250,.28);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 12px 32px rgba(15, 40, 100, .35);
}
.balance-card::after {
  content: "";
  position: absolute;
  right: -20px; top: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,197,66,.22), transparent 70%);
  pointer-events: none;
}
.balance-label { color: rgba(226,232,240,.78); font-size: 13px; position: relative; z-index: 1; }
.balance-value {
  margin-top: 6px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.02em;
  position: relative; z-index: 1;
  background: linear-gradient(90deg, #ffe08a, #f5c542 40%, #fff1b8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.balance-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}

.btn {
  appearance: none; border: 0; cursor: pointer;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px; font-weight: 700;
  color: white;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(0.98); opacity: .9; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue2)); }
.btn-ghost {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-block { width: 100%; padding: 14px; font-size: 15px; border-radius: 14px; }

.promo {
  margin-top: 14px;
  border-radius: 18px;
  padding: 18px;
  background:
    radial-gradient(280px 140px at 12% 0%, rgba(255,210,80,.35), transparent 55%),
    radial-gradient(360px 180px at 100% 30%, rgba(56,189,248,.35), transparent 58%),
    linear-gradient(135deg, #5b21b6 0%, #4338ca 38%, #1d4ed8 72%, #0891b2 100%);
  border: 1px solid rgba(165,180,252,.35);
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(49, 46, 129, .35);
}
.promo::before {
  content: "★";
  position: absolute;
  right: 18px; top: 18px;
  font-size: 64px;
  opacity: .18;
  color: #fff;
  transform: rotate(12deg);
  pointer-events: none;
}
.promo-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 4px 8px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,.24), rgba(255,255,255,.1));
  border: 1px solid rgba(255,255,255,.2);
  margin-bottom: 10px;
}
.promo h3 { font-size: 22px; font-weight: 800; position: relative; z-index: 1; }
.promo p { margin-top: 6px; color: rgba(255,255,255,.86); font-size: 13px; line-height: 1.45; max-width: 72%; position: relative; z-index: 1; }
.promo .btn {
  margin-top: 14px; display: inline-flex;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1f2937;
  position: relative; z-index: 1;
}

.quick {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.quick-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
}
.quick-ico {
  width: 46px; height: 46px; margin: 0 auto 8px;
  border-radius: 15px; display: grid; place-items: center;
  color: white;
  box-shadow: 0 8px 18px rgba(0,0,0,.22);
}
.quick-ico svg { width: 22px; height: 22px; display: block; }
.q1 { background: linear-gradient(145deg, #a78bfa, #7c3aed 55%, #4c1d95); }
.q2 { background: linear-gradient(145deg, #67e8f9, #22d3ee 45%, #0e7490); }
.q3 { background: linear-gradient(145deg, #fdba74, #fb923c 45%, #c2410c); }
.quick-item span { font-size: 12px; color: var(--muted); font-weight: 600; }

.section-title {
  margin: 22px 0 12px;
  font-size: 16px;
  font-weight: 800;
}

.service-list { display: grid; gap: 10px; }
.service {
  display: flex; gap: 12px; align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  cursor: pointer;
}
.service-ico {
  width: 48px; height: 48px; border-radius: 15px;
  display: grid; place-items: center;
  color: white; font-weight: 800; flex-shrink: 0;
  box-shadow: 0 8px 16px rgba(0,0,0,.2);
}
.service-ico svg { width: 24px; height: 24px; display: block; }
.s-purple { background: linear-gradient(145deg, #c4b5fd, #8b5cf6 48%, #5b21b6); }
.s-yellow { background: linear-gradient(145deg, #fde68a, #f59e0b 48%, #b45309); }
.s-green { background: linear-gradient(145deg, #6ee7b7, #10b981 48%, #047857); }
.s-red { background: linear-gradient(145deg, #fda4af, #f43f5e 48%, #be123c); }
.service-body { flex: 1; min-width: 0; }
.service-body h4 { font-size: 15px; font-weight: 750; }
.service-body p { margin-top: 3px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-meta { text-align: right; }
.price { color: var(--gold); font-size: 12px; font-weight: 700; }
.badge {
  display: inline-block; margin-top: 6px;
  font-size: 11px; color: var(--green);
  background: rgba(52,211,153,.12);
  border: 1px solid rgba(52,211,153,.25);
  padding: 3px 8px; border-radius: 999px;
}
.linkish { color: var(--blue); font-size: 12px; font-weight: 700; }

.field-label {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.channels, .amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.amounts { grid-template-columns: repeat(4, 1fr); }
.chip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
}
.chip.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(59,130,246,.35) inset;
  background: rgba(59,130,246,.12);
}
.chip strong { display: block; font-size: 13px; }
.chip small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.input:focus { border-color: var(--blue); }

.profile {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(145deg, #1a2744, #121a2c);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
}
.profile h3 { font-size: 17px; }
.profile p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.profile-bal { margin-left: auto; text-align: right; color: var(--gold); font-weight: 800; font-size: 14px; }

.menu-list {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.menu-item:last-child { border-bottom: 0; }
.menu-item span { flex: 1; font-size: 14px; font-weight: 650; }
.menu-item em { color: var(--muted); font-style: normal; }
.lang {
  display: inline-flex; gap: 6px; background: rgba(255,255,255,.05);
  padding: 4px; border-radius: 999px;
}
.lang button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.lang button.on { background: var(--blue); color: white; }

.version {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 18px;
}

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(10, 14, 24, .94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 10px 4px calc(10px + var(--safe-bottom));
  z-index: 20;
}
.tab {
  border: 0; background: transparent; color: #8b97b3;
  display: grid; gap: 5px; place-items: center;
  font-size: 13px; font-weight: 700; padding: 6px 4px;
  letter-spacing: 0.02em;
}
.tab.active { color: #60a5fa; }
.tab-ico {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  line-height: 1;
}
.tab-ico svg { width: 26px; height: 26px; display: block; }
.tab-label { line-height: 1; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(20,28,48,.95); color: white;
  border: 1px solid var(--line);
  padding: 10px 14px; border-radius: 12px;
  font-size: 13px; z-index: 50;
  opacity: 0; pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; }

.muted-box {
  color: var(--muted);
  text-align: center;
  padding: 18px 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.sheet-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 480px;
  background: #101827;
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(18px + var(--safe-bottom));
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
  margin-bottom: 8px;
}
.sheet-title { display: flex; gap: 12px; align-items: center; }
.sheet-title h3 { font-size: 16px; }
.sheet-title p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255,255,255,.04);
  color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 16px; height: 16px; }
.variant-list { display: grid; gap: 8px; margin-bottom: 14px; }
.variant-item {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 13px 14px; color: var(--text);
  cursor: pointer; font-size: 14px; font-weight: 650;
}
.variant-item strong { color: var(--gold); }
.variant-item.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(59,130,246,.35) inset;
  background: rgba(59,130,246,.12);
}
