:root {
  --bg: #f4f7fb;
  --surface: #fff;
  --surface2: #eef3fa;
  --border: #dde5f0;
  --text: #1a2332;
  --muted: #6b7a90;
  --accent: #4f7cff;
  --accent2: #7c5cff;
  --green: #18a957;
  --live: #ff4d6d;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(26,35,50,.07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Outfit, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 2rem;
  padding: .85rem 1.5rem;
}
.logo {
  font-size: 1.35rem; font-weight: 700; text-decoration: none; color: var(--text);
}
.logo span { color: var(--accent); }
.header-nav { display: flex; gap: .35rem; flex: 1; }
.header-nav button {
  background: none; border: none; font: inherit; font-weight: 500;
  color: var(--muted); padding: .5rem 1rem; border-radius: 999px; cursor: pointer;
}
.header-nav button.active, .header-nav button:hover {
  background: var(--surface2); color: var(--accent);
}
.header-player { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.header-player label { color: var(--muted); }
.header-player select {
  border: 1px solid var(--border); border-radius: 10px;
  padding: .4rem .65rem; font: inherit; background: var(--surface);
}

#app { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }

.hero {
  background: linear-gradient(135deg, #e8f0ff 0%, #f0ebff 50%, #fff 100%);
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  padding: 2rem 2.25rem; margin-bottom: 2rem;
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center;
}
.hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: .35rem; }
.hero p { color: var(--muted); max-width: 520px; }
.hero-stats { display: flex; gap: 1rem; }
.hero-stat {
  background: var(--surface); border-radius: var(--radius);
  padding: 1rem 1.25rem; text-align: center; min-width: 90px;
  box-shadow: var(--shadow);
}
.hero-stat b { display: block; font-size: 1.5rem; color: var(--accent); }
.hero-stat small { color: var(--muted); font-size: .75rem; }

.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.section-head h2 { font-size: 1.2rem; font-weight: 600; }
.section-head a, .section-head button.link {
  background: none; border: none; color: var(--accent); font: inherit;
  font-weight: 600; cursor: pointer; text-decoration: none;
}

.grid { display: grid; gap: 1rem; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 960px) { .g6 { grid-template-columns: repeat(3,1fr); } .g4, .g3 { grid-template-columns: repeat(2,1fr); } .hero { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .g6, .g4, .g3 { grid-template-columns: 1fr; } .header-inner { flex-wrap: wrap; gap: .75rem; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: .18s;
}
.card.click { cursor: pointer; }
.card.click:hover { transform: translateY(-3px); border-color: var(--accent); }

.provider-card { padding: 1.1rem; text-align: center; }
.provider-thumb, .game-thumb {
  aspect-ratio: 16/10; background: var(--surface2);
  display: grid; place-items: center; overflow: hidden;
  border-bottom: 1px solid var(--border); position: relative;
}
.thumb-img, .banner-img { width: 100%; height: 100%; object-fit: contain; padding: .75rem; }
.banner-img { max-height: 64px; width: auto; }
.thumb-fallback { font-size: 2rem; font-weight: 700; color: var(--accent); }
.provider-card { padding: 0 0 .85rem; text-align: center; }
.provider-card h3 { font-size: .9rem; font-weight: 600; padding: 0 .75rem; }
.provider-card p { font-size: .75rem; color: var(--muted); padding: 0 .75rem; }

.game-card { position: relative; cursor: pointer; }
.game-card.disabled { opacity: .55; cursor: not-allowed; }
.game-card.loading { pointer-events: none; opacity: .7; }
.play-mask {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(15,23,42,.0); color: #fff; font-weight: 700; font-size: .85rem;
  transition: .15s; letter-spacing: .05em;
}
.tap-play:hover .play-mask, .game-card:not(.disabled):hover .play-mask {
  background: rgba(37,99,235,.72);
}
.tap-play, .tap-vendor, .tap-sport { cursor: pointer; transition: .15s; }
.tap-play:hover, .tap-vendor:hover, .tap-sport:hover { transform: translateY(-3px); border-color: var(--accent); }
.tap-play.loading::after {
  content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.6);
  display: grid; place-items: center;
}

.game-body { padding: .85rem 1rem 1rem; }
.game-body h3 { font-size: .9rem; font-weight: 600; }
.game-body p { font-size: .75rem; color: var(--muted); margin-top: .15rem; }

.vendor-banner {
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
}
.vendor-banner .provider-thumb { width: 88px; aspect-ratio: 1; border-radius: 12px; border: none; flex-shrink: 0; }

.sportsbook-card { padding: 0 0 1rem; text-align: center; position: relative; }
.sb-thumb { aspect-ratio: 16/9; }
.sportsbook-card .vendor-tag { margin: .5rem .75rem 0; }
.sportsbook-card h3, .sportsbook-card p { padding: 0 .75rem; }
.sportsbook-card .vendor-tag {
  display: inline-block; padding: .2rem .55rem; border-radius: 999px;
  background: var(--surface2); font-size: .7rem; font-weight: 600; color: var(--accent2);
  margin-bottom: .5rem;
}
.sportsbook-card h3 { font-size: 1.05rem; margin-bottom: .25rem; }
.sportsbook-card p { font-size: .8rem; color: var(--muted); }

.sport-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.sport-tab {
  padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font: inherit; font-weight: 500; cursor: pointer;
}
.sport-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.sport-tab .count { opacity: .75; font-size: .8rem; margin-left: .25rem; }

.event-card { padding: 1rem 1.15rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; cursor: pointer; }
.event-card:hover { background: var(--surface2); }
.event-info h3 { font-size: .95rem; font-weight: 600; }
.event-info p { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.badge-live {
  background: #ffe8ed; color: var(--live); font-size: .68rem; font-weight: 700;
  padding: .25rem .55rem; border-radius: 999px; text-transform: uppercase;
}
.badge-up { background: var(--surface2); color: var(--muted); font-size: .68rem; font-weight: 600; padding: .25rem .55rem; border-radius: 999px; }

.event-page .back {
  background: none; border: none; color: var(--accent); font: inherit;
  font-weight: 600; cursor: pointer; margin-bottom: 1rem;
}
.event-header {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}
.market-card { padding: 1rem; margin-bottom: .75rem; }
.market-card h4 { font-size: .85rem; font-weight: 600; margin-bottom: .65rem; }
.odds-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.odd-btn {
  flex: 1; min-width: 100px; padding: .65rem .75rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface2); cursor: pointer; text-align: center;
}
.odd-btn:hover { border-color: var(--accent); background: #e8f0ff; }
.odd-btn .name { font-size: .75rem; color: var(--muted); display: block; }
.odd-btn .price { font-size: 1rem; font-weight: 700; color: var(--accent); }

.game-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: #0a0f18; display: flex; flex-direction: column;
}
.game-overlay.hidden { display: none; }
.game-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .65rem 1rem; background: #141c2b; color: #fff; font-weight: 600;
}
.game-bar button {
  background: rgba(255,255,255,.1); border: none; color: #fff;
  padding: .4rem .85rem; border-radius: 8px; cursor: pointer; font: inherit;
}
#gameFrame { flex: 1; border: none; width: 100%; }

.toast-wrap { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 200; }
.toast {
  background: var(--text); color: #fff; padding: .7rem 1rem;
  border-radius: 10px; font-size: .875rem; margin-top: .5rem;
  animation: in .2s ease;
}
.toast.err { background: var(--live); }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.mb2 { margin-bottom: 2rem; }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.5rem; }
.filters { display: flex; flex-direction: column; gap: .75rem; }
.search-input {
  width: 100%; max-width: 420px; padding: .65rem 1rem;
  border: 1px solid var(--border); border-radius: 12px; font: inherit;
  background: var(--surface);
}
.pg-pg { background: linear-gradient(135deg,#6c5ce7,#a29bfe); }
.pg-jili, .pg-jl { background: linear-gradient(135deg,#e17055,#fab1a0); }
.pg-evoasia { background: linear-gradient(135deg,#2d3436,#636e72); }
.pg-ezugi { background: linear-gradient(135deg,#0984e3,#74b9ff); }
.pg-sexy { background: linear-gradient(135deg,#fd79a8,#e84393); }
.pg-cq9 { background: linear-gradient(135deg,#00b894,#55efc4); }
.pg-spribe { background: linear-gradient(135deg,#6c5ce7,#fd79a8); }
.pg-jdb { background: linear-gradient(135deg,#fdcb6e,#e17055); }
.pg-habanero { background: linear-gradient(135deg,#d63031,#ff7675); }
.pg-mg { background: linear-gradient(135deg,#00cec9,#81ecec); }
.pg-sb { background: linear-gradient(135deg,#4f7cff,#7c5cff); }
