:root {
  color-scheme: dark;
  --bg: #010010;
  --card: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: #a7a6ac;
  --faint: rgba(255, 255, 255, 0.45);
  --cyan: #4dd8e7;
  --cyan-2: #abf7ff;
  --danger: #ff8d8d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  min-height: 100dvh;
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.55; cursor: default; }

.stage {
  width: min(440px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  min-height: 100vh;
  padding: calc(16px + var(--safe-top)) 16px calc(108px + var(--safe-bot));
}

.screen[hidden], [hidden] { display: none !important; }

.login-head { padding: 28px 4px 18px; }
.brand {
  margin: 0 0 8px;
  color: var(--cyan);
  letter-spacing: 0.12em;
  font-size: 13px;
}
h1 { margin: 0; font-size: 28px; font-weight: 700; }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.card {
  margin-top: 8px;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}
.field { display: block; margin-bottom: 14px; }
.field span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #1c1b27;
  font-size: 16px;
}
input:focus { outline: 2px solid rgba(77, 216, 231, 0.45); border-color: transparent; }

.mode { display: flex; gap: 8px; margin-bottom: 14px; }
.mode-btn, .tab, .level {
  border: 0;
  background: #2a2936;
  color: var(--muted);
}
.mode-btn {
  flex: 1;
  height: 40px;
  border-radius: 999px;
}
.mode-btn.on, .tab.on, .level.on {
  color: #041316;
  background: linear-gradient(90deg, var(--cyan), var(--cyan-2));
  font-weight: 650;
}

.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.ghost, .text-btn, .link {
  border: 0;
  background: transparent;
  color: var(--cyan);
}
.ghost {
  flex: 0 0 auto;
  height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  background: #1c1b27;
  white-space: nowrap;
}

.primary {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--cyan-2));
  color: #041316;
  font-size: 16px;
  font-weight: 700;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.who { margin: 0; color: var(--muted); font-size: 13px; }
.balance-label { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.balance { margin: 2px 0 0; font-size: 34px; font-weight: 700; letter-spacing: -0.03em; }
.text-btn { min-height: 44px; padding: 0 4px; font-size: 14px; }

.confirming {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(77, 216, 231, 0.12);
  color: var(--cyan-2);
  font-size: 13px;
}

.tabs, .level-tabs { display: flex; gap: 8px; }
.tabs { margin: 22px 0 14px; }
.tab, .level {
  flex: 1;
  min-height: 40px;
  border-radius: 999px;
  font-size: 14px;
}
.level-tabs { margin-bottom: 14px; }
.level[data-level="svip"].on { background: linear-gradient(90deg, #f3d48a, #fff1c9); }
.level[data-level="black_gold"].on { background: linear-gradient(90deg, #e7d3a1, #fff6df); }

.panel {
  padding: 16px 12px 8px;
  border: 1px solid var(--line);
  border-radius: 24px 24px 18px 18px;
  background: rgba(255, 255, 255, 0.06);
}
.panel-title { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.pkg, .plan {
  border: 2px solid transparent;
  border-radius: 14px;
  background: #3b3a47;
  color: white;
  min-height: 84px;
  padding: 10px 6px;
}
.pkg.on, .plan.on {
  border-color: var(--cyan);
  background: rgba(77, 216, 231, 0.16);
}
.pkg b, .plan b { display: block; font-size: 18px; }
.pkg small, .plan small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.plan { width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px; }
.plan .tag { float: right; color: var(--cyan); font-size: 12px; }
.expire { margin: 0 0 10px; color: #9eb4c8; font-size: 13px; }
.privs { margin: 8px 0 0; padding: 0 4px; list-style: none; color: var(--faint); font-size: 13px; }
.privs li { padding: 4px 0; }
.empty { color: var(--muted); text-align: center; }

.agree {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 0;
  margin-top: 22px;
  font-size: 12px;
  color: var(--faint);
}
.check { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.check input { width: 16px; height: 16px; accent-color: var(--cyan); }
.link { min-height: 44px; font-size: 12px; }
.hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.38);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(440px, 100%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + var(--safe-bot));
  background: linear-gradient(180deg, rgba(1, 0, 16, 0), #010010 28%);
}
.bar-price { flex: 1; font-size: 14px; font-weight: 700; }
.bar-price strong { margin-left: 4px; font-size: 26px; }
.bar-btn { width: 124px; }

.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}
.sheet {
  width: min(440px, 100%);
  padding: 8px 16px calc(16px + var(--safe-bot));
  border-radius: 20px 20px 0 0;
  background: #16151f;
}
.sheet-grab {
  width: 36px;
  height: 4px;
  margin: 6px auto 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
}
.sheet h2 { margin: 0; font-size: 17px; }
.sheet-sub { margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.channel {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  margin-bottom: 8px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #221f2c;
}
.ch-go { color: var(--cyan); font-size: 13px; }
.sheet-cancel { width: 100%; margin-top: 4px; }

.doc-sheet { height: min(78dvh, 640px); display: flex; flex-direction: column; }
.doc-bar { display: flex; justify-content: space-between; align-items: center; }
.doc-body {
  overflow: auto;
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  color: #222;
  font-size: 14px;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}
.doc-body p { margin: 0 0 10px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bot));
  transform: translateX(-50%);
  max-width: min(360px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(32, 32, 40, 0.96);
  color: white;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  z-index: 30;
}

.wechat-tip {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 196, 92, 0.14);
  color: #ffd78a;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 360px) {
  .pkg b { font-size: 16px; }
}
