/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --bg:          #0b0f1a;
  --surface:     #111827;
  --surface-2:   #1a2235;
  --border:      #1f2d45;
  --border-soft: #1a2540;

  --text:        #f1f5f9;
  --text-muted:  #8b9bb4;
  --text-faint:  #4a5568;

  --blue:        #3b82f6;
  --blue-dark:   #1d4ed8;
  --blue-glow:   rgba(59, 130, 246, 0.15);

  --green:       #22c55e;
  --green-bg:    rgba(34, 197, 94, 0.12);
  --red:         #ef4444;
  --red-bg:      rgba(239, 68, 68, 0.12);
  --amber:       #f59e0b;
  --amber-bg:    rgba(245, 158, 11, 0.12);

  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --font:        'Inter', system-ui, sans-serif;
}

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-icon { font-size: 20px; }
.logo-text strong { color: var(--blue); }

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

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link.active { color: var(--blue); background: var(--blue-glow); }

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #2563eb; }
.btn-primary:active { transform: scale(0.97); }
.btn-primary.btn-full { width: 100%; padding: 12px; font-size: 15px; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Login modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.modal-box h2 { font-size: 22px; margin-bottom: 6px; }
.modal-sub { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }

.text-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 14px;
  font-size: 15px;
  margin-bottom: 12px;
  font-family: var(--font);
  transition: border-color 0.15s;
}
.text-input:focus { outline: none; border-color: var(--blue); }
.text-input::placeholder { color: var(--text-faint); }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  flex: 1;
  width: 100%;
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ── Flash messages ───────────────────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-error { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.flash-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }

/* ── CTA banner ───────────────────────────────────────────────────────────── */
.cta-banner {
  background: var(--blue-glow);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.cta-banner p { font-size: 14px; color: var(--text-muted); }

/* ── Game cards ───────────────────────────────────────────────────────────── */
.games-list { display: flex; flex-direction: column; gap: 16px; }

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}
.game-card:hover { border-color: var(--border-soft); }
.game-card.live { border-color: rgba(245,158,11,0.4); }
.game-card.finished { opacity: 0.85; }

/* Game meta row */
.game-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-group { background: var(--blue-glow); color: var(--blue); }
.badge-stage { background: var(--surface-2); color: var(--text-muted); }
.badge-finished { background: var(--surface-2); color: var(--text-muted); }
.badge-live { background: var(--amber-bg); color: var(--amber); animation: pulse 1.5s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.game-kickoff {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Teams row */
.game-teams {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.team {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.team-home { justify-content: flex-start; }
.team-away { justify-content: flex-end; flex-direction: row-reverse; }

.team-crest {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.team-name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
}

.score-block {
  flex-shrink: 0;
  text-align: center;
  min-width: 60px;
}
.score {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}
.live-score { color: var(--amber); }
.vs {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Vote buttons */
.vote-buttons {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
}

.vote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.vote-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}
.vote-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.vote-btn.vote-home.selected {
  background: var(--blue-glow);
  border-color: var(--blue);
  color: var(--blue);
}
.vote-btn.vote-draw.selected {
  background: rgba(100,116,139,0.2);
  border-color: #64748b;
  color: var(--text);
}
.vote-btn.vote-away.selected {
  background: rgba(168,85,247,0.15);
  border-color: #a855f7;
  color: #c084fc;
}

.btn-crest {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Vote feedback */
.vote-result {
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.vote-result.correct { background: var(--green-bg); color: var(--green); }
.vote-result.wrong   { background: var(--red-bg);   color: var(--red); }
.vote-result.no-vote { background: var(--surface-2); color: var(--text-faint); font-weight: 400; }

.vote-status.in-play {
  font-size: 13px;
  color: var(--amber);
  text-align: center;
  padding: 8px;
}

.vote-closed-msg {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 8px;
}

.vote-prompt { text-align: center; }

/* ── Leaderboard ──────────────────────────────────────────────────────────── */
.leaderboard-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table thead tr {
  border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: left;
}

.leaderboard-table tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.15s;
}
.leaderboard-table tbody tr:last-child { border-bottom: none; }
.leaderboard-table tbody tr:hover { background: var(--surface-2); }
.leaderboard-table tbody tr.my-row { background: var(--blue-glow); }

.leaderboard-table td {
  padding: 14px 16px;
  font-size: 14px;
}

.col-rank { width: 50px; }
.col-bar  { width: 120px; }

.medal { font-size: 20px; }
.rank-num { color: var(--text-muted); font-weight: 600; }

.you-tag {
  display: inline-block;
  background: var(--blue-glow);
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.accuracy-bar {
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.accuracy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* ── Schedule page ────────────────────────────────────────────────────────── */
.day-section { margin-bottom: 36px; }
.day-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 40px; display: block; margin-bottom: 16px; }
.empty-state p { margin-bottom: 12px; }

.muted { color: var(--text-muted); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .header-inner { gap: 12px; }
  .main-nav { gap: 2px; }
  .nav-link { padding: 6px 10px; font-size: 13px; }

  .game-card { padding: 16px; }

  .team-name { font-size: 13px; }
  .team-crest { width: 26px; height: 26px; }

  .score { font-size: 18px; }
  .score-block { min-width: 48px; }

  .vote-buttons {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .vote-btn { justify-content: center; }

  .leaderboard-table th,
  .leaderboard-table td { padding: 10px 10px; font-size: 13px; }
  .col-bar { display: none; }

  .cta-banner { flex-direction: column; align-items: flex-start; }

  .page-title { font-size: 22px; }
}

@media (max-width: 420px) {
  .user-chip { max-width: 90px; }
  .logo-text { display: none; }
}
