"use client"; import { cn } from "@/lib/cn"; import { Card, SUIT_IS_RED, SUIT_SYMBOL, rankLabel } from "@/lib/hokm/types"; import type { CardBackPattern } from "@/lib/online/types"; import { cardBackMotif, cardBackVisual } from "@/lib/cardBack"; const SIZES = { sm: { w: 44, h: 62, rank: "text-[11px]", center: "text-2xl", radius: 7 }, md: { w: 62, h: 87, rank: "text-sm", center: "text-3xl", radius: 9 }, lg: { w: 78, h: 110, rank: "text-base", center: "text-4xl", radius: 11 }, xl: { w: 92, h: 130, rank: "text-lg", center: "text-5xl", radius: 13 }, } as const; export type CardSize = keyof typeof SIZES; interface CardBack { c1: string; c2: string; accent: string; pattern?: CardBackPattern; motif?: string; } interface CardFront { bg1: string; bg2: string; border: string; } interface Props { card?: Card; faceDown?: boolean; size?: CardSize; className?: string; dimmed?: boolean; back?: CardBack; front?: CardFront; } export function PlayingCard({ card, faceDown, size = "md", className, dimmed, back, front, }: Props) { const s = SIZES[size]; /* ── Face-down ─────────────────────────────────────────────────── */ if (faceDown || !card) { const visual = back ? cardBackVisual(back.c1, back.c2, back.accent, back.pattern) : null; const styled = back && visual ? { width: s.w, height: s.h, borderRadius: s.radius, background: visual.background, backgroundSize: visual.backgroundSize, border: `1.5px solid ${back.accent}88`, boxShadow: "0 6px 18px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.12)", } : { width: s.w, height: s.h }; const motif = back ? cardBackMotif(back.pattern, back.motif) : "✦"; return (