:root {
  --bg: #0a0a1a;
  --card: #131328;
  --card2: #1b1b3a;
  --card3: #232349;
  --border: #2a2a55;
  --accent: #8b5cf6;
  --accent2: #c4b5fd;
  --accent3: #d946ef;
  --accent-dark: #6d28d9;
  --gold: #fcd34d;
  --text: #ffffff;
  --muted: #9ca3c7;
  --ok: #34d399;
  --no: #f87171;
  --warn: #fcd34d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'SF Pro', Roboto, 'Segoe UI', sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 84px;
}

#app { min-height: 100vh; }

/* ---------- headers ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px 10px;
  position: sticky; top: 0; background: var(--bg); z-index: 20;
}
.backbtn {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--border); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.topbar-title { font-size: 17px; font-weight: 700; flex: 1; }

.brandbar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 14px 6px;
}
.brand-logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 15px; color: #fff;
}
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: 1px; }

/* ---------- hero ---------- */
.hero {
  position: relative; margin: 10px 14px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(160deg, #1d1846 0%, #120f33 55%, #0a0a1a 100%);
  border: 1px solid #37307d;
  padding: 20px 18px;
}
.hero-glow {
  position: absolute; top: -60px; right: -40px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.45), transparent 70%);
  pointer-events: none;
}
.hero-tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: var(--accent2); margin-bottom: 8px;
}
.hero-title { font-size: 24px; font-weight: 800; line-height: 1.15; }
.hero-title .brand { color: var(--accent2); }
.hero-sub { color: #b9b4dd; font-size: 13px; margin-top: 8px; line-height: 1.5; }
.hero-btn {
  display: inline-block; margin-top: 14px; padding: 11px 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #fff; font-weight: 800; font-size: 14px;
  border: none; border-radius: 22px; cursor: pointer;
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.35);
}
.hero-btn:active { transform: scale(0.97); }

/* ---------- quick actions ---------- */
.quick {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 4px 14px; margin-top: 4px;
}
.quick-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 4px; display: flex; flex-direction: column;
  align-items: center; gap: 7px; cursor: pointer;
}
.quick-item:active { border-color: var(--accent); }
.quick-ico {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #221d55, #16123b);
  border: 1px solid #37307d;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
}
.quick-label { font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; margin: 10px 14px; padding: 16px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }

.balance-card {
  background: linear-gradient(135deg, #1d1846 0%, #0e0c26 100%);
  border: 1px solid #37307d;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px;
}
.balance-label { font-size: 12px; color: var(--muted); }
.balance-value { font-size: 26px; font-weight: 800; color: var(--accent2); margin-top: 4px; }
.balance-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.balance-ico {
  width: 46px; height: 46px; border-radius: 14px;
  background: rgba(139, 92, 246, 0.18); border: 1px solid #4a3fa0;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 14px 0; }
.stat-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 8px; text-align: center;
}
.stat-num { font-size: 16px; font-weight: 800; }
.stat-num.gold { color: var(--gold); }
.stat-lbl { font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%; margin-top: 12px; padding: 13px;
  border: none; border-radius: 12px; cursor: pointer;
  background: var(--card2); color: var(--text);
  font-size: 14px; font-weight: 700;
}
.btn.accent {
  background: linear-gradient(135deg, var(--accent), var(--accent3)); color: #fff;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}
.btn.gold { background: linear-gradient(135deg, #fcd34d, #d9a441); color: #1a1206; }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.small { display: inline-block; width: auto; padding: 7px 14px; margin: 6px 6px 0 0; font-size: 12px; }
.btn.ok { background: #123c32; color: var(--ok); }
.btn.no { background: #3d1518; color: var(--no); }

/* ---------- movie grid ---------- */
.movie-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.movie-card {
  background: var(--card2); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; cursor: pointer;
}
.movie-thumb {
  height: 108px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #221d55, #120f33);
  font-size: 34px; overflow: hidden;
}
.movie-thumb .movie-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.3s ease;
}
.movie-card:active .movie-img { transform: scale(1.05); }
.movie-info { padding: 9px 10px; }
.movie-title { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.movie-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

/* ---------- watch ---------- */
.watch-wrap { position: relative; border-radius: 14px; overflow: hidden; background: #000; border: 1px solid var(--border); }
#player { width: 100%; display: block; max-height: 55vh; }
.watch-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background: rgba(10, 10, 26, 0.55);
}
.overlay-hint { font-size: 12px; color: #ddd; text-align: center; padding: 0 12px; }
.countdown { font-size: 44px; font-weight: 800; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.6); }
.stars { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.star {
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #fff; border: none; border-radius: 10px; padding: 9px 13px;
  font-size: 15px; cursor: pointer; font-weight: 700;
}
.hidden { display: none !important; }
.earned { font-size: 18px; font-weight: 800; color: var(--ok); margin-bottom: 8px; }

/* ---------- VIP ---------- */
.vip-head {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, #1d1846, #0e0c26);
  border: 1px solid #37307d; border-radius: 16px;
  margin: 10px 14px; padding: 16px;
}
.vip-head .lvl { font-size: 22px; font-weight: 800; color: var(--accent2); }
.vip-head .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.vip-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  margin: 10px 14px; padding: 16px; position: relative; overflow: hidden;
}
.vip-card.active { border-color: var(--accent); box-shadow: 0 0 24px rgba(139, 92, 246, 0.15); }
.vip-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.vip-lvl { font-size: 17px; font-weight: 800; }
.vip-price { font-size: 18px; font-weight: 800; color: var(--gold); }
.vip-tag {
  position: absolute; top: 12px; right: -34px; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--accent), var(--accent3)); color: #fff;
  font-size: 10px; font-weight: 800; padding: 3px 40px; letter-spacing: 1px;
}
.vip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.token-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.token-chip {
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  border-radius: 20px; padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.token-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  border-color: transparent; color: #fff;
}
.vip-cell {
  background: var(--card2); border-radius: 10px; padding: 8px 6px; text-align: center;
}
.vip-cell .v { font-size: 12.5px; font-weight: 800; }
.vip-cell .v.gold { color: var(--gold); }
.vip-cell .l { font-size: 9.5px; color: var(--muted); margin-top: 2px; line-height: 1.25; }
.vip-note { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.rates-line { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* ---------- team ---------- */
.level-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  margin: 10px 14px; padding: 16px;
}
.level-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.level-name { font-size: 15px; font-weight: 800; }
.level-rate { font-size: 13px; font-weight: 800; color: var(--accent2); }
.stat-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-cell {
  background: var(--card2); border-radius: 10px; padding: 8px 6px; text-align: center;
}
.mini-cell .v { font-size: 13px; font-weight: 800; }
.mini-cell .v.gold { color: var(--gold); }
.mini-cell .l { font-size: 9px; color: var(--muted); margin-top: 2px; }
.member-list { margin-top: 10px; max-height: 160px; overflow-y: auto; }
.member-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; background: var(--card2); border-radius: 8px; margin-bottom: 5px;
  font-size: 12.5px;
}

/* ---------- revenue ---------- */
.rev-row {
  background: var(--card2); border-radius: 12px; padding: 12px;
  margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center;
}
.rev-name { font-size: 13.5px; font-weight: 700; }
.rev-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.rev-today { font-size: 13px; font-weight: 800; color: var(--ok); text-align: right; }

/* ---------- mine ---------- */
.profile {
  display: flex; align-items: center; gap: 12px; padding: 16px 14px;
  background: linear-gradient(135deg, #1d1846, #0e0c26);
  border: 1px solid #37307d; margin: 10px 14px; border-radius: 16px;
}
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px; color: #fff;
}
.profile-name { font-size: 16px; font-weight: 800; }
.profile-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.vip-badge {
  display: inline-block; font-size: 10px; font-weight: 800; color: #1a1206;
  background: linear-gradient(135deg, #fcd34d, #d9a441);
  padding: 2px 8px; border-radius: 20px; margin-top: 5px;
}

.menu-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 8px; cursor: pointer;
  font-size: 14px;
}
.menu-row:active { border-color: var(--accent); }
.menu-row .left { display: flex; align-items: center; gap: 10px; }
.menu-row .right { color: var(--muted); font-size: 13px; }
.chev { color: var(--muted); }

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(10, 10, 26, 0.97);
  border-top: 1px solid var(--border);
  display: flex; z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 9px 0 8px; cursor: pointer;
  background: none; border: none;
}
.tab .ico { font-size: 19px; filter: grayscale(1) opacity(0.6); }
.tab .lbl { font-size: 10px; color: var(--muted); font-weight: 600; }
.tab.active .ico { filter: none; }
.tab.active .lbl { color: var(--accent2); }

/* ---------- misc ---------- */
.subtitle { font-weight: 700; margin: 12px 0 8px; font-size: 14px; }
.note { color: var(--muted); font-size: 12px; margin-top: 10px; line-height: 1.5; }
.center { text-align: center; }
.pad { padding: 24px 8px; }
.muted { color: var(--muted); }

.chat-box {
  background: var(--card2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; min-height: 90px; max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px;
}
.chat-msg {
  max-width: 85%; padding: 9px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.45; word-break: break-word;
}
.chat-msg.support { background: #221d55; align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-msg.user { background: linear-gradient(135deg, var(--accent), var(--accent3)); align-self: flex-end; border-bottom-right-radius: 4px; }

textarea.input { resize: vertical; min-height: 70px; font-family: inherit; }

.addr {
  background: var(--card2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; font-family: ui-monospace, Menlo, monospace;
  font-size: 12.5px; word-break: break-all; margin: 8px 0;
}
.input {
  width: 100%; margin-top: 12px; padding: 13px 14px;
  background: var(--card2); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 14px; outline: none;
}
.input:focus { border-color: var(--accent); }

.banner {
  margin: 10px 14px; padding: 12px; border-radius: 12px;
  background: #241c4a; border: 1px solid #4a3b8a;
  color: var(--warn); text-align: center; font-size: 13px;
}

.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #232349; border: 1px solid var(--border); color: #fff;
  padding: 12px 20px; border-radius: 12px; font-size: 13px;
  opacity: 0; transition: all 0.25s ease; z-index: 100;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- about ---------- */
.about-hero {
  text-align: center; padding: 26px 16px 10px;
  background: linear-gradient(160deg, #1d1846, #0c0a1e);
  border-bottom: 1px solid #37307d;
}
.about-logo {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; color: #fff;
}
.about-name { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.about-tag { color: var(--muted); font-size: 13px; margin-top: 6px; }
.about-section { margin: 14px; }
.about-title {
  font-size: 15px; font-weight: 800; color: var(--accent2);
  margin: 16px 0 8px;
}
.about-p { font-size: 13px; color: #b9b4dd; line-height: 1.65; }

/* ---------- invite ---------- */
.invite-hero {
  text-align: center; padding: 26px 16px;
  background: linear-gradient(160deg, #1d1846, #0c0a1e);
  border-bottom: 1px solid #37307d;
}
.invite-title { font-size: 22px; font-weight: 900; letter-spacing: 2px; color: var(--accent2); }
.invite-sub { font-size: 14px; color: #b9b4dd; margin-top: 6px; }
.qr-box {
  width: 150px; height: 150px; margin: 18px auto; border-radius: 14px;
  background: #fff; padding: 8px; display: flex; align-items: center; justify-content: center;
}
.qr-box img { width: 100%; height: 100%; }

/* ---------- lucky draw ---------- */
.draw-wheel {
  width: 130px; height: 130px; margin: 12px auto; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c4b5fd, #8b5cf6 55%, #4c1d95);
  border: 3px solid #4a3b8a;
  display: flex; align-items: center; justify-content: center;
  font-size: 52px; box-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
}
.prize-line {
  display: flex; justify-content: space-between; padding: 8px 12px;
  background: var(--card2); border-radius: 10px; margin-bottom: 6px; font-size: 13px;
}

/* ---------- website mode ---------- */
body.web { background: #070712; }
body.web #app {
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  background: var(--bg);
}
body.web .tabbar {
  left: 50%; right: auto; width: 100%; max-width: 480px; transform: translateX(-50%);
}
body.web .topbar { max-width: 480px; margin: 0 auto; }

.login-hero { text-align: center; padding: 34px 16px 12px; }
.login-card { max-width: 420px; margin: 10px auto; }
.login-code {
  font-size: 32px; letter-spacing: 6px; font-weight: 900; color: var(--accent2);
  text-align: center; padding: 16px; background: var(--card2);
  border: 1px dashed var(--border); border-radius: 14px; margin: 12px 0;
  user-select: all;
}
.login-divider { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 10px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.seg-btn {
  background: var(--card2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 12px; padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.seg-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #fff; border-color: transparent;
}
