:root {
  --blue: #1a6fd4;
  --blue-dark: #0d4a8c;
  --blue-light: #e8f2fc;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f97316;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --card: #fff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang HK', 'Microsoft JhengHei', sans-serif;
  background: #f1f5f9;
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 64px;
}

a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  padding: 16px 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.site-header p {
  font-size: 13px;
  opacity: 0.85;
}

.header-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.header-stat {
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
}

.header-stat strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

/* Nav tabs */
.page-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 99;
}

.page-tabs a {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.page-tabs a.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* Container */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 12px 24px;
}

/* League filter */
.league-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 12px;
  scrollbar-width: none;
}

.league-filter::-webkit-scrollbar { display: none; }

.league-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
}

.league-chip.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* Match card */
.match-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}

.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--blue-light);
  font-size: 12px;
  color: var(--blue-dark);
}

.match-card-body {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.team-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.team-name.home { text-align: right; }
.team-name.away { text-align: left; }

.match-center {
  text-align: center;
  min-width: 70px;
}

.match-time {
  font-size: 13px;
  color: var(--muted);
}

.match-score {
  font-size: 20px;
  font-weight: 700;
  color: var(--red);
}

.match-live {
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
}

.match-card-footer {
  display: flex;
  border-top: 1px solid var(--border);
}

.match-card-footer a,
.match-card-footer button {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--blue);
}

.match-card-footer a + a,
.match-card-footer a + button {
  border-left: 1px solid var(--border);
}

.match-card-footer .btn-tg {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
}

/* Expert card */
.expert-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.expert-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.expert-rank.top1 { background: #fef3c7; color: #d97706; }
.expert-rank.top2 { background: #f1f5f9; color: #64748b; }
.expert-rank.top3 { background: #ffedd5; color: #ea580c; }
.expert-rank.normal { background: var(--blue-light); color: var(--blue); }

.expert-info { flex: 1; min-width: 0; }

.expert-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.expert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.expert-tag {
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.expert-profit {
  text-align: right;
  flex-shrink: 0;
}

.expert-profit .pct {
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
}

.expert-profit .label {
  font-size: 11px;
  color: var(--muted);
}

.btn-tips {
  display: inline-block;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--orange), #ea580c);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

/* Match detail */
.match-hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  padding: 24px 16px;
  text-align: center;
}

.match-hero .league {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 16px;
}

.match-hero .teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.match-hero .team {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
}

.match-hero .score-box {
  font-size: 28px;
  font-weight: 800;
  min-width: 80px;
}

.match-hero .live-info {
  font-size: 13px;
  opacity: 0.9;
}

.ai-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: -20px 12px 16px;
  padding: 16px;
  position: relative;
}

.ai-box h3 {
  font-size: 15px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-box p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.ai-locked {
  margin-top: 12px;
  padding: 12px;
  background: #fef9c3;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.cta-block {
  padding: 16px;
  text-align: center;
}

.btn-cta {
  display: inline-block;
  width: 100%;
  max-width: 320px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #0088cc, #006699);
  color: #fff;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.btn-cta:hover { opacity: 0.95; }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
  max-width: 640px;
  margin: 0 auto;
}

.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 4px 10px;
  font-size: 11px;
  color: var(--muted);
}

.bottom-nav a.active { color: var(--blue); }

.bottom-nav .icon {
  display: block;
  font-size: 22px;
  margin-bottom: 2px;
}

/* Float TG button */
.tg-float {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #0088cc;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(0,136,204,0.4);
  z-index: 150;
  border: none;
  cursor: pointer;
}

/* Loading / empty */
.loading, .empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* Type filter for rankings */
.type-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.type-filter button {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.type-filter button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* Admin */
.admin-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px;
}

.admin-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.admin-card h2 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.btn-primary {
  padding: 10px 20px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  padding: 10px 20px;
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-left: 8px;
}

.log-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.log-table th, .log-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.log-table .ok { color: var(--green); }
.log-table .fail { color: var(--red); }

.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: #fff;
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 20px;
}

.hidden { display: none !important; }

/* Tipsme-style layout (blue theme) */
.top-nav {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(13, 74, 140, 0.25);
}

.top-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 12px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  flex-shrink: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  flex-shrink: 0;
  display: block;
}

.brand-text {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.main-nav {
  display: none;
  gap: 4px;
  flex: 1;
}

.main-nav a {
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

.main-nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.main-nav a.active { background: rgba(255,255,255,0.22); color: #fff; }

.btn-nav-tg {
  margin-left: auto;
  padding: 8px 16px;
  background: #0088cc;
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.page-shell { max-width: 1280px; margin: 0 auto; padding: 12px; }

.home-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 960px) {
  .main-nav { display: flex; }
  .home-layout { grid-template-columns: 200px 1fr 240px; }
  body { padding-bottom: 0; }
  .mobile-nav { display: none !important; }
  .tg-float { bottom: 24px; right: 24px; }
}

.sidebar-panel, .content-panel, .aside-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  background: var(--blue-light);
  color: var(--blue-dark);
  border-bottom: 1px solid var(--border);
}

.league-list { max-height: 70vh; overflow-y: auto; }

.league-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.league-item:hover { background: #f8fafc; }
.league-item.active { background: var(--blue-light); color: var(--blue-dark); font-weight: 600; }

.promo-banner {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.promo-banner p { font-size: 13px; opacity: 0.9; margin-top: 4px; }
.promo-banner h3 { font-size: 16px; }

.sub-tabs, .day-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.sub-tabs button, .day-tabs button {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.sub-tabs button.active, .day-tabs button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.match-row .team.home { text-align: right; font-weight: 600; }
.match-row .team.away { text-align: left; font-weight: 600; }
.match-row .meta { text-align: center; min-width: 64px; }
.match-row .league-tag { font-size: 11px; color: var(--muted); grid-column: 1 / -1; margin-bottom: -4px; }

.standings-lock {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.standings-lock button {
  margin-top: 12px;
  padding: 8px 16px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

/* Tips / Bigdata pages */
.page-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.page-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.expert-grid { display: grid; gap: 10px; }

@media (min-width: 640px) {
  .expert-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 960px) {
  .expert-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.algo-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.algo-tab {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.algo-tab.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  border-color: transparent;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  text-align: center;
}

.stat-card .val { font-size: 18px; font-weight: 800; color: var(--blue); }
.stat-card .lbl { font-size: 11px; color: var(--muted); margin-top: 4px; }

.tips-table { width: 100%; border-collapse: collapse; font-size: 12px; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tips-table th, .tips-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.tips-table th { background: var(--blue-light); color: var(--blue-dark); font-weight: 700; }
.tips-table .win { color: var(--green); font-weight: 700; }
.tips-table .lose { color: var(--red); font-weight: 700; }

.news-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) { .news-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .news-grid { grid-template-columns: 1fr 1fr 1fr; } }

.news-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
}

.news-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--blue-light);
}

.news-card-body { padding: 12px; }
.news-card h3 { font-size: 14px; line-height: 1.4; margin-bottom: 8px; }
.news-card-meta { font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }

.blog-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) { .blog-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .blog-grid { grid-template-columns: 1fr 1fr 1fr; } }

.blog-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.blog-card img { width: 100%; height: 160px; object-fit: cover; background: var(--blue-light); }
.blog-card-body { padding: 14px; }
.blog-card h3 { font-size: 15px; line-height: 1.45; margin-bottom: 10px; }
.blog-card-meta { font-size: 12px; color: var(--muted); }

.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
}

.mobile-nav a {
  flex: 1;
  text-align: center;
  padding: 6px 2px 8px;
  font-size: 10px;
  color: var(--muted);
}

.mobile-nav a.active { color: var(--blue); font-weight: 600; }
.mobile-nav .icon { display: block; font-size: 18px; margin-bottom: 2px; }

@media (min-width: 641px) {
  .bottom-nav, .tg-float {
    left: auto;
    transform: none;
    width: auto;
  }
}

/* Big Data page (Tipsme layout, blue theme) */
.bd-page { max-width: 1100px; }

.bd-hero {
  text-align: center;
  padding: 24px 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  border-radius: var(--radius);
}

.bd-hero h1 { font-size: 26px; font-weight: 800; margin-bottom: 10px; }
.bd-hero p { font-size: 13px; opacity: 0.9; line-height: 1.6; max-width: 640px; margin: 0 auto 14px; }

.bd-badges {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}

.bd-badges span {
  background: rgba(255,255,255,0.18);
  padding: 6px 12px;
  border-radius: 20px;
}

.bd-chart-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.bd-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--blue-light);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.bd-chart-head h2 { font-size: 18px; color: var(--blue-dark); }
.bd-chart-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }

.bd-period-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.bd-period-tabs button {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.bd-period-tabs button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.bd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.bd-leg-item { display: flex; align-items: center; gap: 6px; }
.bd-leg-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.bd-leg-item strong { color: var(--blue-dark); }

.bd-chart-wrap {
  height: 320px;
  padding: 12px 8px 16px;
}

.bd-algo-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.bd-algo-tab {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bd-algo-tab .name { font-size: 15px; font-weight: 800; color: var(--blue-dark); }
.bd-algo-tab .count { font-size: 12px; color: var(--muted); }

.bd-algo-tab.active {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: 0 0 0 1px var(--blue);
}

.bd-algo-tab.locked { opacity: 0.85; }
.bd-algo-tab.locked .name { color: var(--orange); }

.bd-road-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.bd-road-card h3 { font-size: 15px; margin-bottom: 12px; color: var(--blue-dark); }

.bd-road {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.bd-road-dot {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

.bd-road-dot.win { background: var(--green); }
.bd-road-dot.lose { background: var(--red); }
.bd-road-dot.draw { background: var(--muted); }

.bd-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.bd-section-head h2 { font-size: 16px; }

@media (max-width: 640px) {
  .bd-algo-tabs { grid-template-columns: repeat(2, 1fr); }
  .bd-chart-wrap { height: 260px; }
}
