/* Team builder: pick the players, choose a mode, then read the two sides.
   Teams are balanced by ELO; roles are filled by preference afterwards. */

.team-builder {
  max-width: var(--measure-wide);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.team-builder__title {
  margin: 0;
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
}

.team-builder__warn {
  background: var(--surface-card);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--card-pad);
  margin: 0;
}

.team-builder__panel {
  background: var(--surface-card);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.team-builder__panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.team-builder__panel-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
}

.team-builder__count,
.team-builder__diff {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-secondary);
}

.team-builder__hint {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* ------------------------------------------------------------------ modes */






/* ----------------------------------------------------------------- roster */

.team-builder__roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

@media (min-width: 768px) {
  .team-builder__roster {
    grid-template-columns: 1fr 1fr;
  }
}

.team-builder__row {
  display: flex;
  align-items: center;
  gap: var(--space-smd);
  padding: 10px var(--space-smd);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  transition: var(--transition-control);
}

.team-builder__row:hover {
  border-color: var(--border-strong);
}

.team-builder__row--checked {
  border-color: var(--border-selected);
  box-shadow: var(--shadow-xs);
}

.team-builder__pick {
  display: flex;
  align-items: center;
  gap: var(--space-smd);
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.team-builder__pick input {
  accent-color: var(--mint-600);
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.team-builder__nickname {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-builder__elo {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  margin-left: auto;
}

.team-builder__lock {
  flex-shrink: 0;
}

.team-builder__lock-select {
  font-size: var(--text-sm);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  width: auto;
}

.team-builder__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ------------------------------------------------------------------ teams */

.team-builder__teams {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .team-builder__teams {
    grid-template-columns: 1fr 1fr;
  }
}

.team-builder__team {
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  box-shadow: var(--shadow-xs);
  padding: var(--card-pad-sm);
}

.team-builder__team--blue {
  border-top: 3px solid var(--side-blue);
}

.team-builder__team--red {
  border-top: 3px solid var(--side-red);
}

.team-builder__team-title {
  margin: 0 0 var(--space-smd);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
}

.team-builder__team-roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.team-builder__team-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: var(--space-sm);
  align-items: center;
  font-size: var(--text-base);
  padding: var(--space-sm) 0;
  border-bottom: var(--border-width) solid var(--border-default);
}

.team-builder__team-row:last-child {
  border-bottom: none;
}

.team-builder__team-row--noroles {
  grid-template-columns: 1fr auto;
}

.team-builder__assignments {
  display: flex;
  flex-direction: column;
  gap: var(--space-smd);
}

.team-builder__team-position {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-tertiary);
}

.team-builder__team-elo {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
}

.team-builder__save {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-smd);
}

.team-builder__team-name {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
