:root {
  --bg: #0b1220;
  --bg2: #101a30;
  --card: #141f38;
  --card2: #1a2745;
  --border: #243356;
  --text: #e8eefc;
  --muted: #8fa0c8;
  --green: #22c55e;
  --yellow: #facc15;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 14px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, #0d1730 55%, #122042 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 20px 16px 60px;
  max-width: 860px;
  margin: 0 auto;
  position: relative;
}

.bg-glow {
  position: fixed;
  top: -120px; left: 50%;
  transform: translateX(-50%);
  width: 640px; height: 340px;
  background: radial-gradient(ellipse, rgba(59,130,246,.22), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

header { text-align: center; margin-bottom: 18px; position: relative; z-index: 1; }
.logo { font-size: 2rem; font-weight: 800; letter-spacing: .5px; }
.logo span { color: var(--yellow); }
.sub { color: var(--muted); font-size: .9rem; margin-top: 4px; }

.user-bar {
  display: flex; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  margin-bottom: 14px; position: relative; z-index: 1;
}
.user-bar input {
  flex: 1; background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); padding: 9px 12px; border-radius: 9px; font-size: 1rem;
  outline: none;
}
.user-bar input:focus { border-color: var(--blue); }
.status { font-size: .8rem; color: var(--green); white-space: nowrap; }

.btn {
  background: var(--blue); color: #fff; border: 0; padding: 10px 18px;
  border-radius: 10px; font-size: .95rem; font-weight: 600; cursor: pointer;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.97); }
.btn.small { padding: 9px 14px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.tabs {
  display: flex; gap: 8px; margin-bottom: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px; position: relative; z-index: 1;
}
.tab {
  flex: 1; background: transparent; border: 0; color: var(--muted);
  padding: 10px; border-radius: 9px; font-size: .92rem; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.tab.active { background: var(--blue); color: #fff; }
.tab:not(.active):hover { color: var(--text); background: var(--card2); }

.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.panel-head h2 { font-size: 1.15rem; }
.hint { color: var(--muted); font-size: .78rem; }

.tab-panel { display: none; position: relative; z-index: 1; }
.tab-panel.active { display: block; }

.cards { display: flex; flex-direction: column; gap: 12px; }
.loading { color: var(--muted); text-align: center; padding: 30px 0; }

.match-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.match-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; color: var(--muted); font-size: .78rem;
}
.match-date { text-transform: capitalize; }
.badge {
  padding: 3px 9px; border-radius: 20px; font-size: .7rem; font-weight: 700;
  background: var(--card2); border: 1px solid var(--border);
}
.badge.live { background: rgba(239,68,68,.15); color: var(--red); border-color: var(--red); }
.badge.soon { background: rgba(59,130,246,.15); color: var(--blue); border-color: var(--blue); }

.teams { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; margin-bottom: 12px; }
.teams .vs { color: var(--muted); font-size: .8rem; }
.teams .score { color: var(--yellow); margin-left: auto; font-size: 1.2rem; }

.pick-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pick-btn {
  min-width: 52px; padding: 9px 0; border-radius: 9px; font-weight: 700; font-size: 1rem;
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; transition: all .12s;
}
.pick-btn:hover { border-color: var(--blue); }
.pick-btn.selected { background: var(--blue); border-color: var(--blue); color: #fff; }
.pick-btn:disabled { opacity: .4; cursor: not-allowed; }

.exact-box {
  display: flex; gap: 6px; align-items: center; margin-left: auto;
}
.exact-box input {
  width: 44px; background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); padding: 7px; border-radius: 8px; text-align: center; font-size: .95rem;
  outline: none;
}
.exact-box input:focus { border-color: var(--yellow); }
.exact-box .x { color: var(--muted); font-size: .8rem; }

.bet-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.bet-actions .btn { flex: 1; }
.saved-tag { color: var(--green); font-size: .85rem; font-weight: 600; }

.bet-card { display: flex; flex-direction: column; gap: 6px; }
.bet-card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bet-card .teams { margin: 0; font-size: .98rem; }
.bet-card .meta { color: var(--muted); font-size: .78rem; }
.pill {
  padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700;
}
.pill.win { background: rgba(34,197,94,.15); color: var(--green); }
.pill.exact { background: rgba(250,204,21,.15); color: var(--yellow); }
.pill.lost { background: rgba(239,68,68,.12); color: var(--red); }
.pill.pending { background: var(--card2); color: var(--muted); }

.standings { display: flex; flex-direction: column; gap: 8px; }
.stand-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
}
.stand-pos { font-size: 1.2rem; font-weight: 800; width: 34px; text-align: center; }
.stand-pos.gold { color: var(--yellow); }
.stand-pos.silver { color: #c0c8e0; }
.stand-pos.bronze { color: #d98f5f; }
.stand-user { flex: 1; font-weight: 700; }
.stand-stats { color: var(--muted); font-size: .78rem; text-align: right; }
.stand-points { font-size: 1.25rem; font-weight: 800; color: var(--yellow); min-width: 54px; text-align: right; }

footer {
  margin-top: 28px; text-align: center; color: var(--muted); font-size: .8rem;
  position: relative; z-index: 1;
}
footer b { color: var(--yellow); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 22px; border-radius: 12px; font-size: .9rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); color: #fecaca; }
.toast.ok { border-color: var(--green); }

@media (max-width: 560px) {
  .exact-box { margin-left: 0; width: 100%; justify-content: flex-start; }
  .teams { font-size: .95rem; }
}
