import SwiftUI struct PlayingCardView: View { let card: HandCard let revealed: Bool let selected: Bool let compact: Bool var body: some View { ZStack { RoundedRectangle(cornerRadius: compact ? 6 : 8, style: .continuous) .fill(faceColor) .overlay( RoundedRectangle(cornerRadius: compact ? 6 : 8, style: .continuous) .strokeBorder(selected ? Color.accentColor : Color.black.opacity(0.2), lineWidth: selected ? 2.5 : 1) ) .shadow(color: .black.opacity(0.12), radius: selected ? 4 : 1, y: 1) if revealed { Text(CardDisplay.label(for: card.value)) .font(.system(size: compact ? 11 : 16, weight: .bold, design: .rounded)) .foregroundStyle(CardDisplay.isRed(value: card.value) ? Color.red : Color.black) } else { Text("Golf") .font(.system(size: compact ? 8 : 10, weight: .semibold, design: .rounded)) .foregroundStyle(.white.opacity(0.9)) .rotationEffect(.degrees(-20)) } } .frame(width: compact ? 40 : 56, height: compact ? 56 : 78) } private var faceColor: Color { revealed ? Color(white: 0.98) : Color(red: 0.12, green: 0.35, blue: 0.22) } } struct HandGridView: View { let cards: [HandCard] let interactive: Bool let selectedSlot: Int? let compact: Bool let onSelect: ((Int) -> Void)? private let columns = [ GridItem(.flexible(), spacing: 6), GridItem(.flexible(), spacing: 6), GridItem(.flexible(), spacing: 6) ] var body: some View { LazyVGrid(columns: columns, spacing: 6) { ForEach(Array(cards.enumerated()), id: \.offset) { index, card in if interactive { Button { onSelect?(index) } label: { PlayingCardView( card: card, revealed: card.faceUp, selected: selectedSlot == index, compact: compact ) } .buttonStyle(.plain) } else { PlayingCardView( card: card, revealed: card.faceUp, selected: false, compact: compact ) } } } } }