/* ── Base ─────────────────────────────────────────────────────────────────── */
body { background: #f0f2f5; font-family: system-ui, sans-serif; }

/* ── Player tokens ───────────────────────────────────────────────────────── */
.player-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #4a90d9;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: default;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  user-select: none;
  flex-shrink: 0;
}

.my-token {
  background: #e8500a;
}

.token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 38px;
  padding: 4px 0 0;
  justify-content: center;
}

/* ── Group Stage match cards ─────────────────────────────────────────────── */
.group-header {
  font-size: 1rem;
  font-weight: 700;
  color: #444;
  padding: 6px 10px;
  background: #e0e4ea;
  border-radius: 6px;
  margin-bottom: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 12px;
}

.match-card-wrap {
  background: #fff;
  border-radius: 10px;
  border: 2px solid #dde;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transition: box-shadow 0.15s;
}
.match-card-wrap:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.12); }
.match-card-wrap.is-live  { border-color: #dc3545; animation: pulse 2s infinite; }
.match-card-wrap.is-final { border-color: #6c757d; background: #fafafa; }

@keyframes pulse {
  0%,100% { border-color: #dc3545; }
  50%      { border-color: #ff8888; }
}

.match-meta {
  background: #2c3e50;
  color: #ccc;
  font-size: 0.72rem;
  text-align: center;
  padding: 3px 8px;
  letter-spacing: 0.5px;
}
.live-dot { color: #ff4444; }
.meta-venue { margin-left: 10px; opacity: 0.75; font-size: 0.68rem; }

.teams-row {
  display: flex;
  align-items: stretch;
  min-height: 110px;
}

/* ── Team drop zones ─────────────────────────────────────────────────────── */
.team-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 8px;
  transition: background 0.15s;
  border-radius: 0;
  min-width: 0;
}

.team-zone { cursor: pointer; }
.team-zone:hover { background: #f0f4ff; }
.team-zone.zone-selected { background: #cce5ff; outline: 2px solid #0066cc; }
.team-zone.zone-saved    { background: #d4edda; transition: background 0.3s; }
.team-zone.zone-winner   { background: #d4edda; }
.team-zone.zone-loser    { background: #f8f8f8; opacity: 0.7; }

.team-flag {
  width: 52px; height: 36px;
  object-fit: contain;
}

.team-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  margin: 4px 0 2px;
  line-height: 1.2;
}

.score-badge {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  margin: 2px 0;
}
.score-win  { color: #198754; }
.score-draw { color: #6c757d; }
.score-loss { color: #aaa; }

/* ── Centre zone (draw + score) ──────────────────────────────────────────── */
.centre-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  min-width: 120px;
  border-left: 1px solid #eee;
  border-right: 1px solid #eee;
}

.draw-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  border: 2px dashed #bbb;
  min-width: 80px;
  transition: background 0.15s, border-color 0.15s;
}
.draw-zone { cursor: pointer; }
.draw-zone:hover         { background: #f0f4ff; border-color: #88a; }
.draw-zone.zone-selected { background: #cce5ff; border-color: #0066cc; }
.draw-zone.zone-winner   { background: #d4edda; border-color: #198754; }
.draw-zone.zone-saved    { background: #d4edda; }

.draw-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 4px;
}

/* ── Score inputs ────────────────────────────────────────────────────────── */
.score-input-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
}

.score-inp {
  width: 38px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.85rem;
  font-weight: 600;
}
.score-inp:focus { outline: none; border-color: #4a90d9; }

.score-sep { font-weight: 700; color: #666; }

.btn-score {
  background: #198754;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-score:hover { background: #146c43; }

.final-score { text-align: center; }
.fs-score {
  font-size: 1.4rem;
  font-weight: 800;
  color: #2c3e50;
  letter-spacing: 2px;
}

/* ── Result pills (completed matches) ───────────────────────────────────── */
.result-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 10px;
  border-top: 1px solid #eee;
  background: #fafafa;
}

.result-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  cursor: default;
}
.pill-correct { background: #d4edda; color: #155724; }
.pill-wrong   { background: #f8d7da; color: #721c24; }

/* ── Knockout Bracket tree ───────────────────────────────────────────────── */
.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 16px;
}

.bracket-tree {
  display: flex;
  gap: 0;
  min-width: max-content;
  align-items: flex-start;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  min-width: 240px;
}

.round-label {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  background: #2c3e50;
  padding: 5px 8px;
  border-radius: 4px 4px 0 0;
  margin-bottom: 2px;
}

.round-matches {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 4px;
  /* Vertical centering trick: space matches so they align with next round */
  justify-content: space-around;
  flex: 1;
}

.bracket-match {
  background: #fff;
  border: 2px solid #ccd;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
  position: relative;
}
.bracket-match::after {
  content: '';
  position: absolute;
  right: -12px;
  top: 50%;
  width: 12px;
  height: 2px;
  background: #bbb;
}
.bracket-match.is-live  { border-color: #dc3545; }
.bracket-match.is-final { border-color: #198754; }

.bracket-slot {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  border-bottom: 1px solid #eee;
  transition: background 0.15s;
  min-height: 54px;
}
.bracket-slot:last-of-type  { border-bottom: none; }
.bracket-slot:hover          { background: #f0f4ff; }
.bracket-slot.drag-over      { background: #cce5ff; outline: 2px dashed #0066cc; }
.bracket-slot.zone-saved     { background: #d4edda; }
.bracket-slot.slot-winner    { background: #d4edda; }
.bracket-slot.slot-loser     { background: #f5f5f5; opacity: 0.6; }

.bracket-team {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bracket-flag {
  width: 28px; height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.bracket-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.bracket-score {
  margin-left: auto;
  font-size: 1rem;
  font-weight: 800;
}

.bracket-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: #f8f9fa;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.vs-label {
  font-size: 0.7rem;
  color: #999;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Connector lines between rounds */
.bracket-round:not(:last-child) .bracket-match::after {
  display: block;
}
.bracket-round:last-child .bracket-match::after {
  display: none;
}

.pick-hint {
  text-align: center;
  margin-top: 4px;
  min-height: 20px;
}

/* ── Bucket section toggles ──────────────────────────────────────────────── */
.bucket-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: #e9ecef;
  border: 1px solid #ced4da;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #343a40;
  cursor: pointer;
  transition: background 0.15s;
}
.bucket-toggle:hover { background: #dee2e6; }
.bucket-toggle .chevron {
  transition: transform 0.2s;
}
.bucket-toggle:not(.collapsed) .chevron {
  transform: rotate(180deg);
}
.bucket-count {
  background: #6c757d;
  color: #fff;
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 0.75rem;
  font-weight: 700;
}
.bucket-icon { font-size: 1.1rem; }

.bucket-header-active {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #1a3a5c;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 10px;
}
.bucket-header-active .bucket-count {
  background: rgba(255,255,255,0.25);
}

/* ── Teams list ──────────────────────────────────────────────────────────── */
.team-card-link { text-decoration: none; color: inherit; }

.team-card {
  background: #fff;
  border: 1px solid #dde;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  transition: box-shadow 0.15s, transform 0.15s;
  height: 100%;
}
.team-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}
.team-card-logo {
  width: 56px; height: 40px;
  object-fit: contain;
  margin-bottom: 8px;
}
.team-card-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 6px;
  line-height: 1.2;
}
.team-card-record {
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  flex-wrap: wrap;
}
.rec-w   { color: #198754; font-weight: 700; }
.rec-d   { color: #6c757d; font-weight: 700; }
.rec-l   { color: #dc3545; font-weight: 700; }
.rec-pts { color: #0d6efd; font-weight: 700; }

/* ── Team detail stats ───────────────────────────────────────────────────── */
.stat-box {
  background: #fff;
  border: 1px solid #dde;
  border-radius: 8px;
  padding: 12px 6px;
}
.stat-val   { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.7rem; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 3px; }
.stat-win  { border-color: #198754; background: #d4edda; }
.stat-draw { border-color: #6c757d; background: #f0f0f0; }
.stat-loss { border-color: #dc3545; background: #f8d7da; }
.stat-pts  { border-color: #0d6efd; background: #cfe2ff; }

/* ── Team detail match list ──────────────────────────────────────────────── */
.match-list { display: flex; flex-direction: column; gap: 8px; }

.match-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #dde;
  border-radius: 8px;
  padding: 10px 14px;
  flex-wrap: wrap;
}
.match-row-date  { color: #888; font-size: 0.78rem; min-width: 120px; }
.match-row-teams { display: flex; align-items: center; gap: 6px; flex: 1; font-size: 0.88rem; }
.match-row-score { min-width: 110px; text-align: center; }
.match-row-stage { min-width: 50px; text-align: right; }

.score-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.82rem;
}
.outcome-W { background: #d4edda; color: #155724; }
.outcome-D { background: #e9ecef; color: #495057; }
.outcome-L { background: #f8d7da; color: #721c24; }

.mini-logo { width: 22px; height: 16px; object-fit: contain; }

/* ── Leaderboard ─────────────────────────────────────────────────────────── */
.table-hover tbody tr:hover { background-color: #f0f4ff; }
