:root {
  --bg: #08111a;
  --bg2: #0d1a28;
  --card: #121f2e;
  --card2: #162636;
  --line: rgba(255, 255, 255, 0.06);
  --text: #f2f6fb;
  --muted: #8b9bb0;
  --blue: #2f8cff;
  --blue2: #1e6fe0;
  --hot: #ff3b4a;
  --new: #ff8a1f;
  --green: #2fd67b;
  --radius: 16px;
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  font-weight: 700;
  font-size: 14px;
}
.brand .logo {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f8cff, #55b0ff);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
}
.top-actions { color: var(--muted); font-size: 18px; opacity: .7; }
.brand .logo-img {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

/* Search */
.search-wrap {
  padding: 8px 14px 10px;
  display: flex;
  gap: 8px;
}
.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  height: 44px;
}
.search-box input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}
.search-box input::placeholder { color: var(--muted); }
.search-box .ico { color: var(--muted); font-size: 16px; }
.btn-search {
  height: 44px;
  min-width: 72px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--blue), var(--blue2));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 0 14px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 18px;
  padding: 4px 16px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  padding: 10px 2px 12px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  position: relative;
  cursor: pointer;
  background: none;
  border: 0;
}
.tab.active { color: var(--blue); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
}

/* Pages */
.pages {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 12px 14px calc(var(--nav-h) + var(--safe-b) + 16px);
  display: none;
  -webkit-overflow-scrolling: touch;
}
.page.active { display: block; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 8px;
}
.panel-hd h2 {
  font-size: 17px;
  font-weight: 800;
}
.panel-hd p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}
.badge.live {
  color: #dfffea;
  background: rgba(47, 214, 123, 0.12);
}
.badge.live::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 5px;
  vertical-align: middle;
}

.event-list { list-style: none; }
.event-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.event-list li:active { background: rgba(255,255,255,0.03); }
.rank {
  width: 22px;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
  text-align: center;
}
.rank.top { color: #ffb020; }
.event-main { flex: 1; min-width: 0; }
.event-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: 1px;
}
.tag.hot { background: var(--hot); color: #fff; }
.tag.new { background: var(--new); color: #fff; }
.chev { color: var(--muted); opacity: .6; }

/* Result / discover cards */
.section-title {
  margin: 4px 2px 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.card-list { display: grid; gap: 8px; }
.item-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.item-card:active { background: var(--card2); }
.avatar {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a3a5c, #2f8cff55);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #9fd0ff;
  flex: none;
}
.item-body { flex: 1; min-width: 0; }
.item-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill {
  font-size: 11px;
  color: #9fd0ff;
  background: rgba(47,140,255,0.12);
  border-radius: 999px;
  padding: 4px 8px;
  flex: none;
}

.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 12px;
  cursor: pointer;
}
.cat-card h3 { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.cat-card p { font-size: 12px; color: var(--muted); }

.niche-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.niche-row:first-child { border-top: 0; }
.niche-row small { color: var(--muted); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  font-size: 14px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}

.video-hero {
  background: linear-gradient(135deg, #12304f, #0d1a28 60%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.video-hero h3 { font-size: 16px; margin-bottom: 6px; }
.video-hero p { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  border: 0;
}

.me-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.me-avatar {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2f8cff, #55b0ff);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
}
.stat b { display: block; font-size: 18px; margin-bottom: 4px; }
.stat span { color: var(--muted); font-size: 11px; }

/* Bottom nav */
.bottom-nav {
  position: absolute;
  left: 12px; right: 12px;
  bottom: calc(10px + var(--safe-b));
  height: 60px;
  border-radius: 22px;
  background: rgba(18, 31, 46, 0.88);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 20;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.nav-item .ni { font-size: 18px; line-height: 1; }
.nav-item.active { color: var(--blue); }
