interface Props { name: string; /** Tricks won this round. */ won: number; /** Bid for this round (null until the player has guessed). */ guess: number | null; /** Whether it is this player's turn — the only state that highlights a circle. */ active: boolean; size?: number; } export default function PlayerCircle({ name, won, guess, active, size = 52 }: Props) { const nameFont = Math.max(9, Math.round(size * 0.17)); const valueFont = Math.round(size * 0.32); // Bid status at a glance: terracotta once the player has taken more tricks // than bid (the bid is already lost), gold while exactly on target, cream // while still chasing. Scoring: exact match = 10 + bid, anything else = 0. const guessColor = guess === null ? '#d8cba6' : won > guess ? '#e08066' : won === guess ? '#e8c14a' : '#d8cba6'; // Oval: height a touch shorter than size so it reads as an ellipse. Width // starts at `size` (a circle for short names) but grows with the name via // fit-content + padding, up to a cap beyond which the name is ellipsised // rather than wrapping (wrapping would break the fixed height/oval shape). const height = Math.round(size * 0.78); const hPad = Math.round(size * 0.16); const maxWidth = Math.round(size * 2); return (