:root {
  --bg: #08080c;
  --panel: #14141b;
  --panel-2: #1c1c26;
  --text: #ffffff;
  --muted: #9a9aa8;
  --accent: #ff2d55;
  --accent-2: #ff5c7a;
  --gold: #ffd166;
  --green: #29d697;
  --line: rgba(255, 255, 255, .09);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: radial-gradient(circle at 50% 0%, #22141d 0, #0d0d12 42%, #06060a 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0, 0, 0, .65);
}

/* ============ Top brand ============ */
.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,.55), transparent);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), #ff7a45);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: -.5px;
  box-shadow: 0 6px 20px rgba(255, 45, 85, .28);
}
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: .3px; }
.topbar-right { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16);
  background: rgba(20,20,28,.55); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(12px);
}
.icon-btn svg { width: 18px; height: 18px; }
.coin-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(20,20,28,.55); border: 1px solid rgba(255,255,255,.14);
  color: var(--gold); font-size: 13px; font-weight: 700; backdrop-filter: blur(12px);
}
.coin-pill svg { width: 16px; height: 16px; }

/* ============ Feed ============ */
.view { display: none; }
.view.active { display: block; }
.feed-scroll {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  background: #000;
}
.feed-scroll::-webkit-scrollbar { display: none; }
.slide {
  position: relative;
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #07070b;
  overflow: hidden;
}
.slide-video {
  position: absolute; left: 2px; top: 72px; width: 4px; height: 4px;
  opacity: 1; pointer-events: none; object-fit: cover; background: #07070b; z-index: 9;
}
.slide-poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; pointer-events: none; background: #07070b;
  z-index: 2; transition: opacity .35s ease;
}
.slide-poster.hidden { opacity: 0; }
.slide-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; pointer-events: none; background: transparent; z-index: 1;
}
.slide-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; z-index: 11;
  color: #fff; background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.3);
  backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .2s ease; pointer-events: none;
}
.slide-play svg { width: 30px; height: 30px; margin-left: 3px; }
.slide.paused .slide-play { opacity: 1; }
.slide-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.22) 0%, transparent 34%, rgba(0,0,0,.28) 66%, rgba(0,0,0,.86) 100%);
  pointer-events: none; z-index: 3;
}
.slide-actions {
  position: absolute; right: 12px; bottom: 140px;
  display: flex; flex-direction: column; align-items: center; gap: 13px;
  z-index: 4;
}
.action {
  width: 48px; border: 0; background: transparent; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.action .ring {
  width: 44px; height: 44px; border-radius: 999px;
  background: rgba(20,20,26,.42); border: 1px solid rgba(255,255,255,.13);
  display: grid; place-items: center; backdrop-filter: blur(12px);
  transition: transform .15s ease, background .15s ease;
}
.action .ring svg { width: 21px; height: 21px; }
.action.liked .ring { background: rgba(255,45,85,.28); border-color: rgba(255,45,85,.5); color: var(--accent); }
.action.collected .ring { background: rgba(255,209,102,.18); border-color: rgba(255,209,102,.45); color: var(--gold); }
.action:active .ring { transform: scale(.92); }
.avatar-ring {
  width: 46px; height: 46px; border-radius: 999px; padding: 2px;
  background: linear-gradient(135deg, #fff, #ff7a45);
  display: grid; place-items: center; margin-bottom: 2px;
}
.avatar-ring .avatar {
  width: 40px; height: 40px; border-radius: 999px; object-fit: cover;
  background: #222; display: grid; place-items: center; color: #fff; font-weight: 700;
}
.follow-dot {
  margin-top: -10px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); display: grid; place-items: center;
  font-size: 12px; font-weight: 800; border: 2px solid #000;
}
.slide-info {
  position: absolute; left: 16px; right: 78px; bottom: 120px; z-index: 4;
}
.slide-cat {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 8px;
  background: rgba(255,255,255,.12); font-size: 11px; color: #fff;
  border: 1px solid rgba(255,255,255,.16); margin-bottom: 9px;
}
.slide-title { font-size: 18px; font-weight: 800; line-height: 1.35; margin: 0 0 6px; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.slide-desc { font-size: 12px; color: rgba(255,255,255,.78); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slide-reward {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 10px;
  padding: 7px 10px; border-radius: 999px;
  background: rgba(255,209,102,.14); border: 1px solid rgba(255,209,102,.3);
  color: var(--gold); font-size: 11px; font-weight: 700;
}
.slide-reward .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.slide-index {
  position: absolute; right: 14px; top: 80px; z-index: 4;
  font-size: 10px; letter-spacing: 2px; color: rgba(255,255,255,.5);
}
.sound-toggle {
  position: absolute; right: 12px; top: 74px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.2);
  color: #fff; display: grid; place-items: center; z-index: 5;
}
.sound-toggle svg { width: 17px; height: 17px; }

.feed-progress {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), #ff8a5c); z-index: 3;
}

/* ============ Bottom nav ============ */
.bottom-nav {
  position: fixed; z-index: 30;
  left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(10,10,14,.55), rgba(8,8,12,.96));
  border-top: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
}
.nav-item {
  border: 0; background: transparent; color: rgba(255,255,255,.5);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 5px 0;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: #fff; }
.nav-item.active .nav-icon-wrap { background: rgba(255,45,85,.16); box-shadow: inset 0 0 0 1px rgba(255,45,85,.28); }
.nav-icon-wrap { width: 38px; height: 30px; border-radius: 10px; display: grid; place-items: center; transition: .2s; }

/* ============ Pages (shop/mine/earn) ============ */
.page {
  min-height: 100vh; padding: 86px 16px 130px;
  background:
    radial-gradient(circle at 86% 0%, rgba(255,45,85,.16), transparent 30%),
    linear-gradient(180deg, #17111a 0%, #0b0b10 44%, #08080c 100%);
}
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-title { margin: 0; font-size: 22px; font-weight: 800; }
.page-sub { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.pill { padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid var(--line); font-size: 11px; color: var(--muted); }

.wallet-card {
  position: relative; overflow: hidden;
  padding: 20px; border-radius: 22px;
  background: linear-gradient(135deg, #ff315a 0%, #ff5d7a 45%, #ff8a5c 100%);
  box-shadow: 0 18px 45px rgba(255,45,85,.24);
}
.wallet-card::after {
  content: ""; position: absolute; right: -30px; top: -50px;
  width: 170px; height: 170px; border-radius: 50%;
  background: rgba(255,255,255,.14);
}
.wallet-card .label { font-size: 12px; opacity: .8; }
.wallet-card .amount { font-size: 34px; font-weight: 800; margin: 8px 0 4px; letter-spacing: -.8px; }
.wallet-card .hint { font-size: 11px; opacity: .8; }
.wallet-actions { display: flex; gap: 10px; margin-top: 16px; position: relative; z-index: 2; }
.wallet-actions button {
  border: 0; border-radius: 999px; padding: 10px 18px;
  background: rgba(0,0,0,.24); color: #fff; font-weight: 700; font-size: 12px;
  border: 1px solid rgba(255,255,255,.18);
}
.wallet-actions .primary { background: #fff; color: #e51f47; border-color: #fff; }

.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title { font-size: 15px; font-weight: 800; margin: 0; }
.section-more { font-size: 11px; color: var(--muted); background: none; border: 0; }
.card-list { display: grid; gap: 10px; }
.card {
  background: rgba(255,255,255,.055); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row + .row { margin-top: 10px; }
.muted { color: var(--muted); font-size: 12px; }
.strong { font-weight: 800; }
.gold { color: var(--gold); }
.accent { color: var(--accent-2); }
.green { color: var(--green); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; padding: 4px 7px; border-radius: 6px; background: rgba(255,255,255,.08); }
.btn {
  border: 0; border-radius: 12px; padding: 11px 15px; font-weight: 800; font-size: 13px;
  background: var(--accent); color: #fff; box-shadow: 0 8px 24px rgba(255,45,85,.22);
}
.btn:disabled { opacity: .45; box-shadow: none; }
.btn-ghost { background: rgba(255,255,255,.08); color: #fff; border: 1px solid var(--line); box-shadow: none; }
.btn-small { padding: 8px 11px; font-size: 11px; border-radius: 9px; }
.btn-block { width: 100%; }

.user-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.avatar-lg {
  width: 62px; height: 62px; border-radius: 20px; object-fit: cover;
  background: linear-gradient(135deg, #ff6b81, #ff9a6b); display: grid; place-items: center;
  font-size: 22px; font-weight: 800; color: #fff;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 17px; font-weight: 800; }
.user-phone { font-size: 11px; color: var(--muted); margin-top: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 12px; }
.stat-box { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 14px; padding: 14px 8px; text-align: center; }
.stat-num { font-size: 18px; font-weight: 800; }
.stat-label { font-size: 10px; color: var(--muted); margin-top: 3px; }

.menu-list { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.menu-item { display: flex; align-items: center; justify-content: space-between; padding: 15px 14px; border-bottom: 1px solid rgba(255,255,255,.06); background: none; border-left: 0; border-right: 0; border-top: 0; color: #fff; width: 100%; text-align: left; }
.menu-item:last-child { border-bottom: 0; }
.menu-item .left { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.menu-item .left svg { width: 20px; height: 20px; color: #ff7c92; }
.menu-item .chev { color: rgba(255,255,255,.3); }

/* ============ Shop ============ */
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.product-card { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.product-cover { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #222; display: block; }
.product-body { padding: 10px 10px 12px; }
.product-name { font-size: 13px; font-weight: 800; line-height: 1.35; min-height: 35px; }
.product-price { display: flex; align-items: baseline; justify-content: space-between; margin-top: 7px; }
.price { color: #ff8a9c; font-weight: 800; }
.price small { font-size: 10px; }
.buy-btn { border: 0; border-radius: 8px; background: rgba(255,45,85,.16); color: #ff8a9c; font-size: 11px; font-weight: 800; padding: 6px 9px; }

/* ============ Modals / toast ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.65); backdrop-filter: blur(8px);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%; max-width: 520px;
  background: #181820; border-radius: 24px 24px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,.1);
  max-height: 88vh; overflow-y: auto;
  animation: up .24s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 800; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: #fff; display: grid; place-items: center; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.06);
  color: #fff; border-radius: 12px; padding: 12px 13px; outline: none; font-size: 14px;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(255,45,85,.55); box-shadow: 0 0 0 3px rgba(255,45,85,.12); }
.modal-foot { display: flex; gap: 10px; margin-top: 16px; }
.modal-foot .btn { flex: 1; }
.tip { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 10px 0 0; }
.auth-tabs { display: flex; gap: 6px; background: rgba(255,255,255,.06); padding: 4px; border-radius: 10px; margin-bottom: 16px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 9px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.auth-tabs button.active { background: var(--accent); color: #fff; }
.toast {
  position: fixed; z-index: 80; left: 50%; bottom: 108px; transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,.84); border: 1px solid rgba(255,255,255,.16); color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: 12px; opacity: 0; pointer-events: none; transition: .25s;
  backdrop-filter: blur(12px); max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loading {
  height: 100vh; display: grid; place-items: center; color: var(--muted); font-size: 12px; gap: 10px;
}
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); font-size: 12px; padding: 38px 10px; }

@media (min-width: 760px) {
  body { padding: 24px 0; }
  .app-shell { border-radius: 28px; min-height: calc(100vh - 48px); }
  .bottom-nav { bottom: 24px; border-radius: 0 0 28px 28px; }
  .topbar { top: 24px; border-radius: 28px 28px 0 0; }
  .feed-scroll { border-radius: 28px; }
}
