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

:root {
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --gray: #6b7280;
  --gray-light: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

body { font-family: 'Inter', sans-serif; font-size: 15px; color: var(--text); background: #f9fafb; }

/* ── Navbar ─────────────────────────── */
.navbar { display: flex; align-items: center; gap: 16px; padding: 12px 24px;
  background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.nav-brand { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--text); }
.nav-links { display: flex; gap: 4px; margin-left: 16px; }
.nav-links a { padding: 6px 14px; border-radius: 8px; text-decoration: none; color: var(--text-muted);
  font-size: 14px; font-weight: 500; transition: background .15s; }
.nav-links a:hover { background: var(--gray-light); color: var(--text); }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.admin-link { background: var(--amber-light) !important; color: var(--amber) !important; }
.score-badge { background: var(--green-light); color: var(--green); padding: 4px 12px;
  border-radius: 20px; font-size: 13px; font-weight: 600; }
.btn-logout { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.btn-logout:hover { color: var(--red); }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 4px; }

/* ── Container ──────────────────────── */
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h2 { font-size: 22px; font-weight: 700; }

/* ── Alerts ─────────────────────────── */
.alert { padding: 10px 16px; border-radius: var(--radius); margin-bottom: 12px; font-size: 14px; }
.alert-success { background: var(--green-light); color: var(--green); }
.alert-danger  { background: var(--red-light); color: var(--red); }
.alert-info    { background: var(--blue-light); color: var(--blue); }

/* ── Login ──────────────────────────── */
.login-page { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,.1);
  padding: 40px 36px; max-width: 400px; width: 100%; text-align: center; }
.login-logo { font-size: 56px; margin-bottom: 12px; }
.login-card h1 { font-size: 24px; font-weight: 700; }
.login-sub { color: var(--text-muted); margin: 8px 0 24px; }
.login-divider { color: var(--text-muted); font-size: 13px; margin: 16px 0; }
.tg-widget-wrap { display: flex; justify-content: center; }
.login-note { font-size: 13px; color: var(--text-muted); margin-top: 20px; line-height: 1.6; }

/* ── Match cards ────────────────────── */
.matches-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.match-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  padding: 20px; border-top: 3px solid var(--border); transition: box-shadow .2s; }
.match-card.open { border-top-color: var(--green); }
.match-card.finished { border-top-color: var(--blue); }
.match-card.closed { border-top-color: var(--gray); opacity: .8; }

.match-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.match-num { font-weight: 600; font-size: 13px; color: var(--text-muted); }
.match-status { font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 20px; }
.status-open { background: var(--green-light); color: var(--green); }
.status-done { background: var(--blue-light); color: var(--blue); }
.status-closed { background: var(--gray-light); color: var(--gray); }

.match-teams { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.team { display: flex; align-items: center; gap: 6px; flex: 1; }
.team-left { justify-content: flex-end; text-align: right; }
.team-name { font-weight: 700; font-size: 15px; }
.team-side { background: var(--gray-light); color: var(--gray); width: 26px; height: 26px;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; }
.handicap-team .team-side { background: #fee2e2; color: var(--red); }
.match-vs { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.match-vs > span { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.handicap-badge { background: #fef3c7; color: var(--amber); font-size: 11px;
  padding: 2px 8px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.final-score { font-size: 20px; font-weight: 700; color: var(--blue); }
.final-score-big { font-size: 28px; font-weight: 800; color: var(--blue); }

.match-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 12px; margin-bottom: 14px; }

/* ── Bet form ───────────────────────── */
.bet-form { display: flex; gap: 8px; }
.btn-bet { flex: 1; padding: 10px; border-radius: 8px; border: 2px solid var(--border);
  font-weight: 600; font-size: 14px; cursor: pointer; transition: all .15s; background: #fff; }
.btn-bet:hover { border-color: var(--blue); color: var(--blue); }
.btn-bet.active { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }
.btn-sm { font-size: 12px; padding: 6px 12px; }
.bet-change { align-items: center; }
.change-hint { font-size: 12px; color: var(--text-muted); }

/* ── My bet ─────────────────────────── */
.my-bet { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 12px; }
.bet-win  { background: var(--green-light); color: var(--green); }
.bet-lose { background: var(--red-light); color: var(--red); }
.bet-draw { background: var(--amber-light); color: var(--amber); }
.bet-pending { background: var(--blue-light); color: var(--blue); }
.auto-tag { font-size: 11px; opacity: .8; }

/* ── Leaderboard ────────────────────── */
.leaderboard { background: #fff; border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); }
.lb-row:last-child { border-bottom: none; }
.lb-me { background: var(--blue-light); }
.lb-rank { width: 32px; font-size: 18px; }
.lb-name { flex: 1; font-weight: 500; }
.lb-score { font-weight: 700; font-size: 16px; color: var(--green); }
.you-tag { background: var(--blue); color: #fff; font-size: 11px; padding: 1px 6px;
  border-radius: 10px; margin-left: 6px; }

/* ── Table ──────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.data-table th { padding: 12px 14px; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-muted); background: var(--gray-light); border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.row-win { background: #f0fdf4; }
.row-lose { background: #fef2f2; }
.row-draw { background: #fffbeb; }
.positive { color: var(--green); font-weight: 600; }
.negative { color: var(--red); font-weight: 600; }
.text-muted { color: var(--text-muted); }

/* ── Admin ──────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; text-align: center;
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-num { font-size: 32px; font-weight: 800; color: var(--blue); }
.stat-label { font-size: 13px; color: var(--text-muted); }
.admin-links { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.form-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  padding: 28px; max-width: 480px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-input { width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; }
.form-input:focus { border-color: var(--blue); }
.inline-form { display: flex; align-items: center; gap: 4px; }
.score-input { width: 52px; padding: 5px 8px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; text-align: center; }
.status-badge { padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.status-open { background: var(--green-light); color: var(--green); }
.status-finished { background: var(--blue-light); color: var(--blue); }
.status-closed { background: var(--gray-light); color: var(--gray); }
.admin-tag { background: var(--amber-light); color: var(--amber); font-size: 11px;
  padding: 1px 6px; border-radius: 10px; margin-left: 4px; }

/* ── Buttons ────────────────────────── */
.btn-primary { background: var(--blue); color: #fff; border: none; padding: 9px 18px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-block; transition: opacity .15s; }
.btn-primary:hover { opacity: .88; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer;
  text-decoration: none; display: inline-block; }
.btn-success { background: var(--green-light); color: var(--green); border: none; cursor: pointer;
  padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.btn-danger { background: var(--red-light); color: var(--red); border: none; cursor: pointer;
  padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; }

/* ── Misc ───────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state span { font-size: 48px; display: block; margin-bottom: 12px; }
.tip-box { margin-top: 20px; background: var(--blue-light); color: var(--blue);
  padding: 12px 18px; border-radius: 10px; font-size: 14px; }
.date-nav { display: flex; gap: 8px; }
.score-display { font-size: 14px; color: var(--text-muted); }
.link-sm { font-size: 13px; color: var(--blue); text-decoration: none; }
code { background: var(--gray-light); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* ── Mobile ─────────────────────────── */
@media (max-width: 600px) {
  .matches-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .navbar { flex-wrap: wrap; gap: 8px; }
  .nav-user { width: 100%; justify-content: flex-end; }
}

/* ── Google login button ─────────────────────────── */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 12px 20px; margin: 20px 0;
  background: #fff; color: #3c4043; font-size: 15px; font-weight: 500;
  border: 1.5px solid #dadce0; border-radius: 8px; text-decoration: none;
  transition: box-shadow .2s, background .15s; cursor: pointer;
}
.btn-google:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); background: #f8f9fa; }

/* ── Nav name ────────────────────────────────────── */
.nav-name { font-size: 14px; font-weight: 500; color: var(--text);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Form label ──────────────────────────────────── */
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

/* ── Status upcoming ─────────────────────────────── */
.status-upcoming { background: #f3f4f6; color: #6b7280; }
