/* ============================================================
   PREDICTIONS — Group stage, match cards, group picker
   ============================================================ */

/* ── Group card container ── */
.groups-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ── Group card ── */
.group-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition);
}

.group-card.locked {
  opacity: 0.75;
}

.group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  cursor: pointer;
  transition: background var(--transition);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.group-card-header:hover { background: var(--bg-surface-hover); }

.group-label {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--gold);
  line-height: 1;
}

.group-teams-preview {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.group-team-chip {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.group-lock-badge {
  margin-left: auto;
  margin-right: var(--sp-3);
}

/* ── Save status ── */
.save-status {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.75rem;
  font-weight: 600;
}

.save-status.saved { color: var(--green); }
.save-status.unsaved { color: var(--text-secondary); }
.save-status.saving { color: var(--gold); }

/* ── Group card body ── */
.group-card-body {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* ── Match card ── */
.match-card {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  border-left: 3px solid var(--border);
  transition: all var(--transition);
}

.match-card.status-correct   { border-left-color: var(--green); }
.match-card.status-incorrect { border-left-color: var(--red); }
.match-card.status-pending   { border-left-color: var(--gold); }
.match-card.status-locked    { border-left-color: var(--neutral); opacity: 0.75; }

/* Match main row: home | score inputs | away */
.match-main {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
}

.match-team {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 600;
  font-size: 0.9375rem;
  min-width: 0;
}

.match-team.home { justify-content: flex-end; }
.match-team.away { justify-content: flex-start; }

.match-team .team-flag { font-size: 1.5rem; }

.match-team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}

/* Confirmed result score display */
.match-result-score {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  text-align: center;
  min-width: 60px;
}

/* Match meta (venue, time, group) */
.match-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
}

/* Match outcome row: toggle or confirmed badge */
.match-outcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.match-prediction-badge {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Exact score bonus label */
.exact-score-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-align: center;
}

/* Match points earned */
.match-points {
  text-align: center;
}

/* ── Group standings section ── */
.group-standings {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
}

.group-standings-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
}

.standings-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.standings-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 600;
  width: 30px;
  flex-shrink: 0;
}

.standings-select {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.875rem;
}

.standings-select:focus { outline: none; border-color: var(--gold); }
.standings-select:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Group save bar ── */
.group-save-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

/* ── Third-place qualifier section ── */
.third-place-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-card);
}

.third-place-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}

.third-place-title {
  font-size: 1rem;
  font-weight: 700;
}

.third-place-count {
  font-size: 0.875rem;
  font-weight: 700;
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-page);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
}

.third-place-count.complete { color: var(--green); }
.third-place-count.over { color: var(--red); }

.third-place-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.third-place-card {
  background: var(--bg-page);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  user-select: none;
}

.third-place-card:hover { border-color: var(--text-secondary); }
.third-place-card.selected { border-color: var(--green); background: rgba(39,174,96,0.08); }
.third-place-card.locked { cursor: default; pointer-events: none; }

.third-place-group-label {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--gold);
  line-height: 1;
}

.third-place-team-name {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.third-place-check {
  color: var(--green);
  margin-left: auto;
  display: none;
}

.third-place-card.selected .third-place-check { display: block; }

/* ── Global save bar ── */
.global-save-bar {
  position: sticky;
  bottom: calc(var(--bottom-nav-height) + var(--sp-4));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-card);
  margin-top: var(--sp-4);
  z-index: 10;
}

@media (min-width: 640px) {
  .global-save-bar { bottom: var(--sp-4); }
}

/* ── Locked overlay ── */
.locked-overlay {
  position: relative;
}

.locked-overlay::after {
  content: '🔒 Locked';
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  background: rgba(127,140,141,0.2);
  color: var(--neutral);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-pill);
}

/* Responsive: stack match teams on small screens */
@media (max-width: 480px) {
  .match-main {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }

  .match-team.home, .match-team.away {
    justify-content: flex-start;
  }

  .match-center {
    flex-direction: row;
    justify-content: center;
    gap: var(--sp-4);
  }
}
