/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #e53935;
  --primary-dark: #b71c1c;
  --primary-light: #ff6f60;
  --accent: #ffd600;
  --bg: #f4f5f7;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #888;
  --border: #e8e8e8;
  --sidebar-w: 260px;
  --header-h: 54px;
  --bottom-h: 62px;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --tg-theme-bg-color: var(--bg);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* 全局消除移动端 300ms 点击延迟 */
a, button, [onclick], label, select,
.nav-tab, .tab-btn, .qb-btn, .chip, .game-card,
.banner-slide, .entry-btn, .more-link, .cat-more {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* ===== Top Header ===== */
.top-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(229,57,53,0.35);
}

.header-left { display: flex; align-items: center; gap: 12px; }

.menu-btn {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; padding: 4px;
}
.menu-btn span {
  display: block; width: 22px; height: 2px;
  background: #fff; border-radius: 2px;
  transition: all 0.3s;
}

.logo-text {
  color: #fff; font-size: 18px; font-weight: 700; letter-spacing: 1px;
}

.header-right { display: flex; align-items: center; gap: 10px; }

.balance { color: rgba(255,255,255,0.9); font-size: 13px; }
.balance b { color: var(--accent); }

.btn-recharge {
  background: var(--accent); color: var(--primary-dark);
  border: none; border-radius: 16px;
  padding: 5px 14px; font-size: 13px; font-weight: 700;
  cursor: pointer;
}

/* ===== Overlay ===== */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 149;
}
.overlay.show { display: block; }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0; left: calc(-1 * var(--sidebar-w));
  width: var(--sidebar-w);
  height: 100%;
  background: #fff;
  z-index: 150;
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}
.sidebar.open { left: 0; }

.sidebar-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 48px 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-avatar {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; border: 2px solid rgba(255,255,255,0.4);
}
.user-name { color: #fff; font-size: 15px; font-weight: 600; }
.user-level {
  color: var(--accent); font-size: 12px; margin-top: 3px;
  background: rgba(255,214,0,0.15); padding: 2px 8px;
  border-radius: 10px; display: inline-block;
}

.sidebar-nav { padding: 8px 0; flex: 1; }

.nav-section-title {
  font-size: 11px; color: var(--text-muted);
  padding: 14px 18px 4px;
  text-transform: uppercase; letter-spacing: 1px;
}

.sidebar-nav ul { list-style: none; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px; font-weight: 500;
  position: relative;
}
.nav-item:hover, .nav-item.active {
  background: #fff5f5; color: var(--primary);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary); border-radius: 0 2px 2px 0;
}
.nav-icon { font-size: 18px; width: 22px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--primary); color: #fff;
  font-size: 10px; padding: 2px 6px;
  border-radius: 8px; font-weight: 600;
}

/* ===== Main Content ===== */
.main-content {
  margin-top: var(--header-h);
  padding-bottom: var(--bottom-h);
  min-height: 100vh;
}

/* ===== Banner ===== */
.banner-section {
  position: relative;
  overflow: hidden;
  height: 160px;
}

.banner-track {
  display: flex;
  width: 300%;
  height: 100%;
  transition: transform 0.5s ease;
}

.banner-slide {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 28px;
  position: relative;
  overflow: hidden;
}
.banner-slide::after {
  content: '';
  position: absolute; right: -10px; top: 10%; bottom: 10%;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.banner-text h3 {
  color: #fff; font-size: 18px; font-weight: 700; margin-bottom: 6px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.banner-text p { color: rgba(255,255,255,0.88); font-size: 13px; }

.banner-dots {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.5); cursor: pointer; transition: all 0.3s;
}
.dot.active { background: #fff; width: 18px; border-radius: 3px; }

/* ===== Quick Entry ===== */
.quick-entry {
  display: flex;
  justify-content: space-around;
  background: var(--bg-card);
  padding: 16px 10px;
  margin: 10px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.entry-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer;
}
.entry-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.entry-icon img {
  width: 36px; height: 36px;
  object-fit: contain; display: block;
}
.entry-label { font-size: 12px; color: var(--text-muted); }

/* ===== Category Tabs ===== */
.category-tabs {
  margin: 0 10px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.category-tabs::-webkit-scrollbar { display: none; }

.tab-list {
  display: flex; gap: 8px;
  padding: 10px 0;
  white-space: nowrap;
}

.tab-btn {
  padding: 7px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: #fff; color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(229,57,53,0.3);
}

/* ===== Game List ===== */
.game-list { padding: 0 10px; }

.game-category { margin-bottom: 16px; }
.game-category.hidden { display: none; }

.category-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0 10px;
  font-size: 15px; font-weight: 700;
}
.cat-more { font-size: 12px; color: var(--primary); font-weight: 400; }

.game-cards { display: flex; flex-direction: column; gap: 10px; }

.game-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--border);
}
.game-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.game-logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; font-size: 18px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.game-logo.sh { background: linear-gradient(135deg,#11998e,#38ef7d); }
.game-logo.js { background: linear-gradient(135deg,#f093fb,#f5576c); }
.game-logo.ah { background: linear-gradient(135deg,#4facfe,#00f2fe); }
.game-logo.ssc { background: linear-gradient(135deg,#f5a623,#f76b1c); }
.game-logo.tj { background: linear-gradient(135deg,#43e97b,#38f9d7); }
.game-logo.pk10 { background: linear-gradient(135deg,#667eea,#764ba2); font-size: 13px; }
.game-logo.s115 { background: linear-gradient(135deg,#fd7b7b,#e63950); }

.game-info { flex: 1; min-width: 0; }
.game-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }

.game-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-muted);
}
.game-status.open .status-dot {
  width: 7px; height: 7px; background: #4caf50; border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.game-countdown { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.countdown { color: var(--primary); font-weight: 700; }

.game-odds { text-align: right; flex-shrink: 0; }
.odds-label { font-size: 11px; color: var(--text-muted); }
.odds-val { font-size: 18px; font-weight: 800; color: var(--primary); }

/* ===== Latest Result ===== */
.latest-result {
  margin: 10px 10px 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.section-title {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 15px; font-weight: 700; margin-bottom: 12px;
}
.more-link { font-size: 12px; color: var(--primary); font-weight: 400; }

.result-list { display: flex; flex-direction: column; gap: 0; }

.result-card {
  display: flex; flex-direction: column; gap: 7px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.result-card:last-child { border-bottom: none; }

.rc-head {
  display: flex; justify-content: space-between; align-items: center;
}
.rc-name  { font-size: 13px; font-weight: 700; color: var(--text); }
.rc-period { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

.rc-body {
  display: flex; align-items: center; gap: 6px;
}
.rc-balls { display: flex; gap: 3px; flex-wrap: wrap; flex: 1; }
.rc-ball {
  width: 20px; height: 20px;
  background: var(--primary);
  color: #fff; font-size: 11px; font-weight: 800;
  border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rc-stat {
  display: flex; align-items: center; gap: 3px;
  flex-shrink: 0; white-space: nowrap;
}
.rc-sum { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-right: 1px; }
.rc-tag {
  font-size: 11px; font-weight: 700; font-style: normal;
  padding: 1px 5px; border-radius: 4px;
}
.rc-big { background: #fff0f0; color: #e53935; }
.rc-sml { background: #e8f4fd; color: #1565c0; }
.rc-odd { background: #fff8e1; color: #e65100; }
.rc-evn { background: #e8f5e9; color: #2e7d32; }

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-h);
  background: #fff;
  display: flex;
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}

.nav-tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; cursor: pointer;
  font-size: 11px; color: var(--text-muted);
  user-select: none;
  -webkit-user-select: none;
}
.nav-tab.active { color: var(--primary); }
.tab-icon { font-size: 22px; }
.tab-label { font-size: 11px; }

.nav-tab-center {
  position: relative; top: -10px;
}
.tab-center-btn {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(229,57,53,0.45);
}
