:root {
  --green: #1a7a4a;
  --green-dark: #145f39;
  --gold: #f5c518;
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --red: #f85149;
  --blue: #388bfd;
  --radius: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: var(--green);
  padding: 24px 32px 20px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

header h1 { font-size: 1.6rem; font-weight: 700; }

.subtitle { color: rgba(255,255,255,0.85); font-size: 0.95rem; flex: 1; }

.nav-link {
  margin-left: auto;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 14px;
  border-radius: 6px;
  transition: background 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.15); }

main { max-width: 860px; margin: 0 auto; padding: 28px 16px 60px; }

.hidden { display: none !important; }

.loading { color: var(--muted); text-align: center; padding: 48px 0; }

.error-banner {
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

/* calm "nothing here yet" state — not an error */
.empty-note {
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  margin: 8px 0 20px;
  font-size: 0.98rem;
}
.empty-sub { margin-top: 6px; font-size: 0.83rem; opacity: 0.7; }

/* ── Matchday sections ──────────────────────────────────── */

.matchday { margin-bottom: 36px; }

.matchday h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.matchday h2 .date {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Day view selector + section tags (predictions) ──────────── */
.day-pager {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 22px;
}
.day-view-label { font-size: 0.76rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.day-select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 0.92rem; font-weight: 600; cursor: pointer;
  max-width: 80vw;
}
.day-select:focus { outline: none; border-color: var(--green); }

.md-tag {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 9px; border-radius: 20px;
}
.md-tag-open { background: rgba(26,122,74,0.22); color: #4caf7d; }
.md-tag-done { background: rgba(245,197,24,0.15); color: var(--gold); }
.md-tag-soon { background: var(--surface2); color: var(--muted); }

/* ── Match card ─────────────────────────────────────────── */

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.match-card.status-open { border-left: 3px solid var(--green); }
.match-card.status-pending { opacity: 0.7; }
.match-card.status-settled { border-left: 3px solid var(--gold); }

.match-header {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.stage-tag {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 4px;
}

.status-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: auto;
}
.status-tag.open     { background: rgba(26,122,74,0.25); color: #4caf7d; }
.status-tag.pending  { background: var(--surface2); color: var(--muted); }
.status-tag.closed   { background: rgba(56,139,253,0.15); color: var(--blue); }
.status-tag.settled  { background: rgba(245,197,24,0.15); color: var(--gold); }

.teams {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.vs { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.kickoff { font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; }

.vote-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-vote {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-vote:hover { background: var(--green-dark); }

.voted-badge {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}
.voted-badge.correct { border-color: var(--green); color: #4caf7d; }
.voted-badge.wrong   { border-color: var(--red); color: var(--red); }

.result-badge {
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.vote-error {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--red);
}

/* ── Leaderboard ────────────────────────────────────────── */

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 36px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.leaderboard-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface);
}

.leaderboard-table tr.me td { background: rgba(26,122,74,0.1); }
.leaderboard-table .rank { color: var(--muted); width: 36px; }
.leaderboard-table .total { font-size: 1rem; }

/* ── Breakdown ──────────────────────────────────────────── */

.breakdown { margin-top: 8px; }
.breakdown h2 { font-size: 1rem; margin-bottom: 12px; color: var(--muted); }

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

.breakdown-table th,
.breakdown-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.breakdown-table th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  background: var(--surface);
}

.refresh-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 24px;
}

/* ── Underdog badge ─────────────────────────────────────────── */

.vote-buttons { display: flex; gap: 16px; flex-wrap: wrap; }
.vote-option { display: flex; flex-direction: column; gap: 4px; }

.underdog-hint {
  font-size: 0.72rem;
  color: #a78bfa;
  padding-left: 2px;
  cursor: default;
}

/* ── Profile link ───────────────────────────────────────────── */

.profile-link {
  color: var(--text);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: color 0.15s;
}
.profile-link:hover { color: var(--gold); }

/* ── Clickable match card ───────────────────────────────────── */

.match-card.clickable { cursor: pointer; }
.match-card.clickable:hover {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(26,122,74,0.3);
}

/* ── Modal shell ────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 660px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  min-height: 52px;
}

.modal-header h2 { font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body {
  overflow-y: auto;
  flex: 1;
}

/* stage badge in modal header */
.mo-stage-badge {
  background: rgba(26,122,74,0.18);
  color: #4caf7d;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Loading spinner ────────────────────────────────────────── */

.mo-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 56px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes spin { to { transform: rotate(360deg); } }
.mo-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Kickoff layout ─────────────────────────────────────────── */

.mo-kickoff { display: flex; flex-direction: column; }

/* teams row — the hero section */
.mo-teams-row {
  display: flex;
  align-items: flex-start;
  background: linear-gradient(160deg, #0f1923 0%, #161b22 60%, #0f1923 100%);
  border-bottom: 1px solid var(--border);
  padding: 28px 20px 24px;
  gap: 12px;
  position: relative;
}

/* subtle pitch-line decoration */
.mo-teams-row::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(26,122,74,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.mo-team {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  position: relative;
}


.mo-flag-wrap {
  width: 72px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  background: var(--surface2);
  flex-shrink: 0;
}

.mo-flag {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mo-flag-placeholder {
  font-size: 2rem;
  line-height: 1;
}

.mo-team-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  max-width: 120px;
  word-break: break-word;
}

.mo-rank {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mo-dog-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #c4b5fd;
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.4);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

/* underdog team gets a purple tint */
.mo-team.mo-underdog .mo-team-name { color: #c4b5fd; }
.mo-team.mo-underdog .mo-flag-wrap {
  box-shadow: 0 0 0 2px rgba(124,58,237,0.5), 0 4px 16px rgba(0,0,0,0.4);
}

/* winner gets gold */
.mo-team.mo-winner .mo-team-name { color: var(--gold); }
.mo-team.mo-winner .mo-flag-wrap {
  box-shadow: 0 0 0 2px rgba(245,197,24,0.6), 0 4px 20px rgba(245,197,24,0.2);
}

/* VS / result in centre column */
.mo-vs-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  width: 110px;
  min-height: 52px;    /* = flag height: centres a short "VS" on the flag, taller result grows down */
}

.mo-vs {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--border);
  letter-spacing: 0.05em;
}

.mo-result-crown {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  background: rgba(245,197,24,0.1);
  border: 1px solid rgba(245,197,24,0.3);
  border-radius: 20px;
  padding: 3px 10px;
  line-height: 1.4;
}

.mo-kickoff-time {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.mo-stage-note {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Predictions section ────────────────────────────────────── */

.mo-pred-section {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mo-pred-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.mo-pred-total {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
}

/* horizontal vote bar */
.mo-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.mo-bar-label-left { flex-shrink: 0; min-width: 60px; text-align: right; }
.mo-bar-label-right { flex-shrink: 0; min-width: 60px; }

.mo-bar {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 20px;
  display: flex;
  overflow: hidden;
}

.mo-bar-a {
  background: var(--green);
  border-radius: 20px 0 0 20px;
  transition: width 0.4s ease;
}
.mo-bar-b {
  background: var(--blue);
  border-radius: 0 20px 20px 0;
  transition: width 0.4s ease;
}
.mo-bar-a.mo-bar-win { background: var(--gold); }
.mo-bar-b.mo-bar-win { background: var(--gold); }

/* split columns for names */
.mo-split {
  display: flex;
  gap: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.mo-split-col {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mo-split-divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}

.mo-split-head {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mo-split-head.mo-split-head-win { color: var(--gold); }

.mo-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.mo-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
}

.mo-chip-empty {
  font-size: 0.82rem;
  color: var(--muted);
}

.mo-hidden-note {
  font-size: 0.8rem;
  color: #a78bfa;
  background: rgba(124,58,237,0.08);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 8px;
  padding: 8px 14px;
}

.mo-not-voted {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
}

/* ── Modal voting actions ───────────────────────────────────── */
.mo-vote-section {
  padding: 18px 22px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.mo-vote-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.mo-vote-btns {
  display: flex;
  gap: 12px;
  width: 100%;
}
.mo-vote-btn {
  flex: 1;
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 13px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.mo-vote-btn:hover { border-color: var(--green); background: #1c2230; }
.mo-vote-btn:active { transform: scale(0.98); }
.mo-vote-btn.picked {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.mo-vote-btn.picked:hover { background: var(--green-dark); }
.mo-revoke-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s;
}
.mo-revoke-btn:hover { color: var(--red); border-color: var(--red); }
.mo-vote-err {
  color: var(--red);
  font-size: 0.82rem;
  text-align: center;
}
.mo-vote-locked {
  margin: 16px 22px 0;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
.mo-vote-locked strong { color: var(--text); }
.mo-mark-ok { color: #4caf7d; }
.mo-mark-no { color: var(--red); }
.mo-mark-draw { color: var(--muted); }

/* ── Modal (profile / generic) table rows ───────────────────── */
.modal-body tr.correct td { color: #4caf7d; }
.modal-body tr.wrong td   { color: var(--red); opacity: 0.8; }

/* ── Chat widget ────────────────────────────────────────────── */

.chat-widget {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 90;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}

.chat-header {
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  background: var(--surface2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.chat-header:hover { background: var(--border); }

.chat-toggle-icon { margin-left: auto; font-size: 0.75rem; color: var(--muted); }

.chat-unread { color: var(--green); font-size: 0.65rem; }

/* Smack-talk toast — small popup when a new message arrives with the chat closed */
.chat-toast {
  position: fixed;
  right: 24px;
  bottom: 56px;
  width: 300px;
  max-width: calc(100vw - 48px);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  cursor: pointer;
  z-index: 95;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.chat-toast.show { opacity: 1; transform: translateY(0); }
.chat-toast.hidden { display: none; }
.chat-toast-icon { font-size: 1.05rem; line-height: 1.4; }
.chat-toast-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chat-toast-name { font-size: 0.76rem; font-weight: 700; color: #4caf7d; }
.chat-toast-text {
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.chat-body {
  display: none;
  flex-direction: column;
  height: 300px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 85%;
  align-items: flex-start;
}
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }

.chat-name {
  font-size: 0.7rem;
  color: var(--muted);
}
.chat-msg.mine .chat-name { color: #4caf7d; }

.chat-text {
  background: var(--surface2);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  word-break: break-word;
  border: 1px solid var(--border);
}
.chat-msg.mine .chat-text {
  background: rgba(26,122,74,0.2);
  border-color: rgba(26,122,74,0.4);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
}
.chat-input:focus { outline: none; border-color: var(--green); }

.chat-send {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
.chat-send:hover { background: var(--green-dark); }

.chat-readonly {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 10px;
  border-top: 1px solid var(--border);
}

/* ── Page tabs (bracket.html) ───────────────────────────────── */

.page-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 24px;
}

.page-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 14px 20px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.page-tab:hover { color: var(--text); }
.page-tab.active { color: var(--text); border-bottom-color: var(--green); }

.tab-panel { padding: 28px 24px 60px; max-width: 1200px; margin: 0 auto; }

/* ── Group standings ─────────────────────────────────────────── */

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 20px;
}

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.standings-table th {
  padding: 6px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.standings-table th.th-team { text-align: left; padding-left: 12px; }

.standings-table td {
  padding: 8px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(48,54,61,0.5);
}
.standings-table tr:last-child td { border-bottom: none; }

.standings-table tr.qualifier { border-left: 3px solid var(--green); }
.standings-table tr.qualifier td:first-child { padding-left: 5px; }

.pos { color: var(--muted); font-size: 0.75rem; }

.team-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding-left: 12px !important;
  white-space: nowrap;
}

.st-flag {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}
.st-flag-ph { font-size: 0.9rem; }

.pts { font-weight: 700; color: var(--text); }
.pos-gd { color: #4caf7d; }
.neg-gd { color: var(--red); }

.qualifier-note {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 6px 12px;
  background: rgba(26,122,74,0.06);
  border-top: 1px solid var(--border);
}

/* ── Knockout bracket ────────────────────────────────────────── */

.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 24px;
}

.bracket-inner {
  position: relative;                 /* anchors the SVG connector overlay */
  display: flex;
  align-items: stretch;
  min-width: 100%;                    /* fill the page; scrolls only if columns hit their min */
  padding: 8px 12px 24px;
}

/* SVG overlay holding the connector lines (drawn from real card geometry) */
.br2-lines { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; }
.br2-lines line { stroke: var(--border); stroke-width: 2; }

.br2-side { display: flex; align-items: stretch; flex: 4 1 0; min-width: 0; }

.br2-round { display: flex; flex-direction: column; flex: 1 1 0; min-width: 92px; }
.br2-round-head {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); text-align: center;
  padding-bottom: 10px; margin-bottom: 6px; border-bottom: 1px solid var(--border);
}
.br2-round-body { flex: 1; display: flex; flex-direction: column; justify-content: space-around; }

/* centre column: Final + trophy + 3rd place */
.br2-center {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1 1 0; min-width: 0; padding: 0 6px; gap: 6px; z-index: 1;
}
.br2-center-label { font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--gold); }
.br2-third-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 14px; }
.br2-trophy { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 8px 0; }
.br2-trophy-icon { font-size: 2.2rem; line-height: 1; }
.br2-trophy-cap { font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); }

.bracket-match {
  position: relative;
  z-index: 1;
  width: auto;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 6px 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.br2-center .bracket-match { margin: 6px 0; }

.bracket-match.settled { border-left: 2px solid var(--gold); }
.bracket-match.open    { border-left: 2px solid var(--green); }

.bm-date {
  font-size: 0.65rem;
  color: var(--muted);
  padding: 5px 10px 2px;
  line-height: 1.2;
}

.bm-team {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.1s;
}

.bm-team.winner { background: rgba(245,197,24,0.08); }
.bm-team.loser  { opacity: 0.45; }

.bm-flag {
  width: 24px;
  height: 17px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}
.bm-flag-ph { font-size: 1rem; }

.bm-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tbd { color: var(--muted); font-weight: 400; font-style: italic; }

.bm-win-mark {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
}

.bm-sep {
  height: 1px;
  background: var(--border);
  margin: 0 10px;
}

@media (max-width: 600px) {
  header { padding: 16px; }
  .teams { font-size: 1rem; }
  .leaderboard-table th:nth-child(n+5),
  .leaderboard-table td:nth-child(n+5) { display: none; }

  /* Modal on mobile */
  .modal { border-radius: 12px 12px 0 0; max-height: 92vh; }
  .modal-backdrop { align-items: flex-end; padding: 0; }

  .mo-teams-row { padding: 20px 14px 18px; }
  .mo-team-name { font-size: 0.9rem; max-width: 90px; }
  .mo-flag-wrap { width: 56px; height: 40px; }
  .mo-vs-col { width: 80px; min-height: 40px; }

  .mo-split-col { padding: 12px; }
  .mo-pred-section { padding: 16px 16px 20px; }
}
