* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}
.app {
  width: 100%;
  max-width: 420px;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* PAGE VIEWS */
.page { display: none; flex-direction: column; flex: 1; }
.page.active { display: flex; }

/* TOP NAV */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 50;
}
.icon-btn {
  font-size: 20px;
  color: #333;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.icon-btn:hover { background: #f0f4ff; }
.top-nav h2 { font-size: 15px; font-weight: 600; color: #111; }

/* MATCH HEADER */
.match-header { background: #fff; padding: 10px 16px 0; }
.match-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.badge-live {
  background: #1a73e8;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }
.match-time { font-size: 13px; color: #555; font-weight: 600; }
.more-markets { margin-left: auto; font-size: 12px; color: #1a73e8; cursor: pointer; font-weight: 600; }
.more-markets:hover { text-decoration: underline; }

.scoreboard { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 14px; }
.team { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.team-logo {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: #e8f0fe;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s;
}
.team-logo:hover { transform: scale(1.1); }
.team-logo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.team-name { font-size: 12px; font-weight: 600; color: #222; text-align: center; }
.score-area { text-align: center; }
.score { font-size: 32px; font-weight: 800; color: #111; }
.score span.away { color: #1a73e8; }
.score-icons { display: flex; justify-content: center; gap: 8px; margin-top: 6px; }
.score-icons span {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid #ddd;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer; color: #555;
  transition: all 0.15s;
}
.score-icons span:hover { background: #e8f0fe; }
.score-icons span.active { background: #1a73e8; color: #fff; border-color: #1a73e8; font-weight: 700; }

/* TABS */
.tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 2px solid #eee;
  background: #fff;
  padding: 0 6px;
  scrollbar-width: none;
  position: sticky;
  top: 49px;
  z-index: 40;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s;
}
.tab:hover { color: #1a73e8; }
.tab.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }

/* MARKETS */
.markets { flex: 1; overflow-y: auto; padding: 8px 12px 80px; }
.market-group { display: none; }
.market-group.visible { display: block; }

.market-section { margin-bottom: 12px; }
.market-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 8px;
}
.market-title .title-left { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #111; }
.star-btn { cursor: pointer; font-size: 16px; color: #ccc; transition: color 0.2s, transform 0.2s; }
.star-btn:hover { transform: scale(1.3); }
.star-btn.fav { color: #f5a623; }
.more-link { font-size: 12px; color: #888; cursor: pointer; }
.more-link:hover { color: #1a73e8; }

.odds-row { display: flex; gap: 8px; }
.odds-btn {
  flex: 1;
  background: #f5f7fa;
  border: 1.5px solid #e8eaf0;
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}
.odds-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.3);
  opacity: 0;
  transition: opacity 0.2s;
}
.odds-btn:active::after { opacity: 1; }
.odds-btn:hover { background: #e8f0fe; border-color: #a8c4f5; transform: translateY(-1px); }
.odds-btn.selected { background: #1a73e8; border-color: #1a73e8; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(26,115,232,0.4); }
.odds-btn.selected .odds-label,
.odds-btn.selected .odds-value { color: #fff; }
.odds-label { font-size: 10px; color: #888; margin-bottom: 3px; }
.odds-value { font-size: 14px; font-weight: 700; color: #111; }

/* Extra odds (collapsed by default) */
.extra-odds { display: none; margin-top: 8px; }
.extra-odds.open { display: flex; gap: 8px; }

/* Scrollable row */
.odds-scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.odds-scroll::-webkit-scrollbar { display: none; }
.odds-scroll .odds-btn { min-width: 72px; flex-shrink: 0; }

/* Correct Score grid */
.score-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.score-grid .odds-btn { flex: none; }

/* Corners table */
.corners-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.corners-table th { background: #f5f7fa; padding: 6px 8px; color: #888; font-weight: 600; text-align: center; }
.corners-table td { padding: 8px; text-align: center; border-bottom: 1px solid #f0f2f5; }
.corners-table .team-col { text-align: left; color: #333; font-weight: 500; }
.corner-odd {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f5f7fa;
  border: 1.5px solid #e8eaf0;
  cursor: pointer;
  font-weight: 700;
  color: #111;
  font-size: 13px;
  transition: all 0.15s;
}
.corner-odd:hover { background: #e8f0fe; border-color: #a8c4f5; }
.corner-odd.selected { background: #1a73e8; color: #fff; border-color: #1a73e8; }

.divider { height: 1px; background: #f0f2f5; margin: 4px 0; }

/* Dynamic market sections */
.market-section.with-divider { border-top: 1px solid #f0f2f5; padding-top: 10px; margin-top: 4px; }
.market-section.no-title { margin-top: -4px; }
.market-sub { font-size: 10px; font-weight: 400; color: #999; margin-top: 1px; }

/* Generic lines table (handicap lines, totals lines, corners...) */
.lines-table { width: 100%; border-collapse: separate; border-spacing: 6px; margin: -6px; }
.lines-table td { padding: 0; }
.lines-table .odds-btn.lt-cell { padding: 6px 4px; }
.lt-dash { color: #aaa; font-size: 12px; text-align: center; vertical-align: middle; white-space: nowrap; padding: 0 6px !important; }

/* BETSLIP BAR */
.betslip-bar {
  position: fixed;
  bottom: -400px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-top: 2px solid #1a73e8;
  padding: 10px 14px 10px;
  z-index: 100;
  transition: bottom 0.3s ease;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
}
.betslip-bar.show { bottom: 56px; }
.betslip-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.betslip-sel { display: flex; align-items: center; gap: 8px; }
.sel-badge { background: #1a73e8; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; }
.sel-meta { font-size: 11px; color: #555; }
.sel-meta strong { display: block; color: #111; font-size: 12px; }
.sel-odds-val { font-size: 16px; font-weight: 800; color: #1a73e8; }
.betslip-inputs { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.stake-input-wrap { flex: 1; }
.stake-input-wrap label { font-size: 10px; color: #888; display: block; margin-bottom: 2px; }
.stake-input {
  width: 100%;
  border: 1.5px solid #e8eaf0;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 700;
  color: #111;
  outline: none;
}
.stake-input:focus { border-color: #1a73e8; }
.quick-stakes { display: flex; gap: 6px; margin-bottom: 8px; }
.qs-btn {
  flex: 1;
  background: #f0f4ff;
  border: 1px solid #d0daf8;
  border-radius: 16px;
  padding: 4px 0;
  font-size: 12px;
  color: #1a73e8;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.qs-btn:hover { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.returns-bar { display: flex; justify-content: space-between; margin-bottom: 8px; }
.ret-item label { font-size: 10px; color: #888; display: block; }
.ret-item .ret-val { font-size: 14px; font-weight: 700; color: #1a73e8; }
.place-btn {
  width: 100%;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.place-btn:hover { background: #1558c0; }
.place-btn:active { transform: scale(0.98); }
.close-betslip {
  background: none;
  border: none;
  font-size: 18px;
  color: #aaa;
  cursor: pointer;
  padding: 0 0 0 8px;
}

/* BOTTOM NAV */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  z-index: 200;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 2px 5px;
  cursor: pointer;
  font-size: 9px;
  color: #888;
  gap: 2px;
  transition: color 0.15s;
}
.nav-item:hover { color: #1a73e8; }
.nav-item.active { color: #1a73e8; }
.nav-icon { font-size: 18px; }

/* TOAST */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: #323232;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 999;
  transition: transform 0.3s ease;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* SUCCESS */
.success-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 600;
  align-items: center;
  justify-content: center;
}
.success-overlay.open { display: flex; }
.success-card {
  background: #fff;
  border-radius: 16px;
  padding: 30px 24px;
  text-align: center;
  max-width: 300px;
  width: 90%;
  animation: popIn 0.3s ease;
}
@keyframes popIn { from{transform:scale(0.7);opacity:0} to{transform:scale(1);opacity:1} }
.success-icon { font-size: 56px; margin-bottom: 12px; }
.success-card h3 { font-size: 20px; font-weight: 700; color: #111; margin-bottom: 6px; }
.success-card p { font-size: 13px; color: #666; margin-bottom: 20px; }
.success-ok {
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ══════════════════════════════════
   LOBBY PAGE
══════════════════════════════════ */
.lobby-top-tabs {
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.lobby-top-tabs::-webkit-scrollbar { display: none; }
.ltt {
  flex-shrink: 0;
  padding: 10px 11px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s;
}
.ltt:hover { color: #1a73e8; }
.ltt.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }
.ltt-sep { color: #ddd; padding: 0 2px; font-size: 18px; align-self: center; }
.ltt-money { color: #1a73e8; font-size: 12px; font-weight: 700; padding: 10px 8px; flex-shrink: 0; }

.sport-icons-row {
  display: flex;
  align-items: center;
  padding: 6px 4px;
  background: #fff;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.sport-icons-row::-webkit-scrollbar { display: none; }
.sport-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  padding: 4px 9px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.sport-icon:hover { background: #f0f4ff; }
.si-emoji { font-size: 20px; }
.si-label { font-size: 10px; color: #888; white-space: nowrap; }
.sport-icon.active .si-label { color: #1a73e8; font-weight: 700; }

.lobby-sub-tabs {
  display: flex;
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 0 4px;
  scrollbar-width: none;
  flex-shrink: 0;
}
.lobby-sub-tabs::-webkit-scrollbar { display: none; }
.lst {
  flex-shrink: 0;
  padding: 7px 11px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s;
}
.lst:hover { color: #1a73e8; }
.lst.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }

.lobby-section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f5f7fa;
  padding: 6px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.lsh-title { font-size: 13px; font-weight: 700; color: #333; }
.lsh-odds { font-size: 12px; color: #1a73e8; cursor: pointer; font-weight: 600; }

.lobby-scroll { flex: 1; overflow-y: auto; padding-bottom: 70px; }

/* League group */
.league-block { border-bottom: 4px solid #f0f2f5; }
.league-hdr {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: #f9fafb;
  border-bottom: 1px solid #eee;
}
.lhdr-star { font-size: 14px; color: #ccc; cursor: pointer; transition: color 0.2s; }
.lhdr-star.fav { color: #f5a623; }
.lhdr-name { font-size: 12px; font-weight: 700; color: #222; flex: 1; }
.lhdr-count {
  font-size: 11px; color: #888;
  background: #e8eaf0; padding: 1px 7px;
  border-radius: 10px;
}

/* Compact match card */
.lmc { background: #fff; border-bottom: 1px solid #f0f0f0; }
.lmc-body { display: flex; align-items: stretch; }

.lmc-left {
  flex: 0 0 125px;
  padding: 8px 8px;
  border-right: 1px solid #eee;
  cursor: pointer;
}
.lmc-left:hover { background: #f9fafb; }
.lmc-time-row { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.lmc-star { font-size: 12px; color: #ccc; cursor: pointer; flex-shrink: 0; transition: color 0.2s; }
.lmc-star.fav { color: #f5a623; }
.lmc-live-time { font-size: 11px; font-weight: 700; color: #e53935; }
.lmc-half-tag { font-size: 9px; color: #888; }
.lmc-pin { font-size: 11px; color: #bbb; cursor: pointer; margin-left: auto; }
.lmc-team-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 0; gap: 4px; }
.lmc-team-logo { width: 14px; height: 14px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.lmc-team { font-size: 11px; color: #222; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lmc-team.hot { color: #e53935; font-weight: 700; }
.lmc-badge { font-size: 9px; background: #e53935; color: #fff; padding: 1px 4px; border-radius: 3px; flex-shrink: 0; }
.lmc-score { font-size: 14px; font-weight: 800; color: #111; min-width: 14px; text-align: right; flex-shrink: 0; }
.lmc-score.lead { color: #1a73e8; }

/* Odds 3-column area */
.lmc-right { flex: 1; display: flex; min-width: 0; }
.lmc-odds-col { flex: 1; border-right: 1px solid #eee; display: flex; flex-direction: column; min-width: 0; }
.lmc-odds-col:last-child { border-right: none; }
.lmc-col-hdr {
  font-size: 9px; color: #aaa; text-align: center;
  padding: 4px 2px 3px; border-bottom: 1px solid #f0f0f0;
  background: #fafafa; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.lmc-rows { flex: 1; display: flex; flex-direction: column; }
.lmc-odd-row { flex: 1; display: flex; border-bottom: 1px solid #f5f5f5; }
.lmc-odd-row:last-child { border-bottom: none; }
.lmc-odd-cell {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 4px 2px; cursor: pointer;
  border-right: 1px solid #f5f5f5;
  transition: background 0.12s;
  min-height: 28px;
}
.lmc-odd-cell:last-child { border-right: none; }
.lmc-odd-cell:hover { background: #e8f0fe; }
.lmc-odd-cell.selected { background: #1a73e8; }
.lmc-odd-cell.selected .lmc-olabel,
.lmc-odd-cell.selected .lmc-oval { color: #fff !important; }
.lmc-olabel { font-size: 8px; color: #aaa; }
.lmc-oval { font-size: 12px; font-weight: 700; color: #1a73e8; }
.lmc-dash { font-size: 13px; color: #ddd; }

/* Match footer */
.lmc-footer {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-top: 1px solid #f0f0f0;
  background: #fafafa;
}
.lmc-ficon { font-size: 13px; color: #999; cursor: pointer; }
.lmc-ficon:hover { color: #1a73e8; }
.lmc-more-tag {
  font-size: 11px; color: #1a73e8;
  background: #e8f0fe; padding: 2px 8px;
  border-radius: 10px; cursor: pointer; font-weight: 600;
}
.lmc-anim { font-size: 10px; color: #888; margin-left: auto; cursor: pointer; }

/* ALL MARKETS TABLE */
.amt-wrap { background: #fff; }
.amt-tabs {
  display: flex; overflow-x: auto;
  background: #fff; border-bottom: 1px solid #eee;
  padding: 0 4px; scrollbar-width: none;
}
.amt-tabs::-webkit-scrollbar { display: none; }
.amt-tab {
  flex-shrink: 0; padding: 8px 10px;
  font-size: 12px; color: #666; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.amt-tab.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }

.odds-tbl-wrap { overflow-x: auto; }
table.odds-tbl { width: 100%; border-collapse: collapse; min-width: 360px; }
.odds-tbl .th-section {
  background: #f5f7fa; text-align: center;
  font-size: 11px; font-weight: 700; color: #555;
  padding: 5px 4px; border: 1px solid #eee;
}
.odds-tbl .th-col {
  background: #fafafa; text-align: center;
  font-size: 10px; color: #888; font-weight: 600;
  padding: 4px 2px; border: 1px solid #eee;
}
.odds-tbl td {
  text-align: center; padding: 7px 4px;
  border: 1px solid #f0f0f0; font-size: 12px;
  cursor: pointer; transition: background 0.1s;
}
.odds-tbl td:hover { background: #e8f0fe; }
.odds-tbl td.o-home { color: #1a73e8; font-weight: 700; }
.odds-tbl td.o-draw { color: #888; font-weight: 700; }
.odds-tbl td.o-away { color: #1a73e8; font-weight: 700; }
.odds-tbl td.o-dash { color: #ddd; }
.odds-tbl td.o-more { color: #1a73e8; font-size: 11px; font-weight: 600; }
.odds-tbl td.selected { background: #1a73e8 !important; color: #fff !important; }
