/* Barbu — the four-player multi-contract trick table. Card art is the shared
   Vector Playing Cards SVGs, rendered whole (the black outline is the die-cut:
   never cropped, never boxed). Scoped to .barbu-root, tokens from the shell, a
   green felt surface inside the board only. */

.barbu-root {
  --barbu-gold: #b68235;
  --barbu-felt-1: #2f7d4f;
  --barbu-felt-2: #206040;
  --barbu-felt-3: #184e34;
  --barbu-ink: #f4f1ea;
  inline-size: 100%;
  max-inline-size: 700px;
  margin: 0 auto;
  color: var(--barbu-ink);
  font-family: var(--font-body, "Lora", Georgia, serif);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2vw, 14px);
}

/* ── Contract banner ─────────────────────────────────────────────────────── */
.barbu-banner {
  text-align: center;
  padding: clamp(8px, 2vw, 12px) clamp(10px, 3vw, 16px);
  border-radius: var(--radius-md, 12px);
  background: linear-gradient(180deg, rgba(182, 130, 53, 0.14), rgba(182, 130, 53, 0.06));
  border: 1px solid rgba(182, 130, 53, 0.4);
  color: var(--color-text, #23201b);
}
.barbu-bcontract {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 600;
  color: var(--barbu-gold);
  line-height: 1.15;
}
.barbu-bdesc { font-size: clamp(12px, 3vw, 14.5px); opacity: 0.85; margin-block-start: 2px; }
.barbu-bdeal {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--color-neutral-500, #8a8578); margin-block-start: 4px;
}

/* ── Table surface ─────────────────────────────────────────────────────────── */
.barbu-table {
  background: radial-gradient(130% 110% at 50% 12%, var(--barbu-felt-1) 0%, var(--barbu-felt-2) 58%, var(--barbu-felt-3) 100%);
  border-radius: var(--radius-md, 12px);
  padding: clamp(10px, 3vw, 20px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 2px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.5vw, 12px);
}

.barbu-seat { display: flex; flex-direction: column; align-items: center; gap: 4px; min-block-size: 1px; }
.barbu-name {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(12px, 2.6vw, 15px);
  letter-spacing: 0.04em;
  opacity: 0.82;
  text-align: center;
  padding: 1px 8px;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}
.barbu-name.barbu-active { opacity: 1; color: #fff; background: rgba(182, 130, 53, 0.55); box-shadow: 0 0 0 1px rgba(182, 130, 53, 0.9); }

.barbu-backs { display: flex; justify-content: center; min-block-size: 1px; }
.barbu-north .barbu-backs .barbu-back { margin-inline-start: -34px; }
.barbu-north .barbu-backs .barbu-back:first-child { margin-inline-start: 0; }

.barbu-midrow { display: flex; align-items: stretch; justify-content: space-between; gap: clamp(6px, 2vw, 14px); }
.barbu-west, .barbu-east { flex: 0 0 auto; justify-content: center; }
.barbu-west .barbu-backs, .barbu-east .barbu-backs { flex-direction: column; }
.barbu-west .barbu-backs .barbu-back, .barbu-east .barbu-backs .barbu-back { margin-block-start: -52px; }
.barbu-west .barbu-backs .barbu-back:first-child, .barbu-east .barbu-backs .barbu-back:first-child { margin-block-start: 0; }

/* ── Center: trick area or domino layout ──────────────────────────────────── */
.barbu-center { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-inline-size: 0; }
.barbu-trick {
  position: relative;
  inline-size: clamp(150px, 42vw, 230px);
  block-size: clamp(150px, 42vw, 230px);
  margin: 0 auto;
}
.barbu-trick[hidden] { display: none; }
.barbu-slot { position: absolute; inline-size: clamp(46px, 13vw, 72px); display: flex; justify-content: center; }
.barbu-slot .barbu-card { inline-size: 100%; block-size: auto; }
.barbu-slot-N { top: 0; left: 50%; transform: translateX(-50%); }
.barbu-slot-S { bottom: 0; left: 50%; transform: translateX(-50%); }
.barbu-slot-W { left: 0; top: 50%; transform: translateY(-50%); }
.barbu-slot-E { right: 0; top: 50%; transform: translateY(-50%); }

.barbu-info {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none;
}
.barbu-trickcount {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.7;
}

/* Domino layout: one row per suit, cards scroll horizontally if long. */
.barbu-layout { inline-size: 100%; display: flex; flex-direction: column; gap: clamp(4px, 1.4vw, 8px); }
.barbu-layout[hidden] { display: none; }
.barbu-lrow { display: flex; align-items: center; gap: 8px; min-block-size: clamp(34px, 9vw, 52px); }
.barbu-lsuit { font-size: clamp(18px, 5vw, 26px); inline-size: 1.4em; text-align: center; flex: 0 0 auto; }
.barbu-lcards { display: flex; align-items: center; gap: 2px; overflow-x: auto; padding-block: 2px; min-inline-size: 0; }
.barbu-lcard { inline-size: clamp(26px, 6.5vw, 38px); block-size: auto; border-radius: 3px; }
.barbu-lempty {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: 12px; font-style: italic; opacity: 0.6; letter-spacing: 0.06em;
}

.barbu-suit-H, .barbu-suit-D { color: #ff6a5a; }
.barbu-suit-C, .barbu-suit-S { color: var(--barbu-ink); }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.barbu-card { display: block; border-radius: 5px; block-size: auto; }
.barbu-back { inline-size: clamp(30px, 8vw, 46px); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }

/* ── Scores ────────────────────────────────────────────────────────────────── */
.barbu-scores { display: flex; align-items: stretch; justify-content: center; gap: clamp(6px, 2.4vw, 16px); flex-wrap: wrap; }
.barbu-scorecell {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 4px 10px; border-radius: var(--radius-sm, 8px);
  background: var(--color-neutral-100, #f2efe8);
  min-inline-size: 62px;
}
.barbu-scoreseat {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-neutral-500, #8a8578);
}
.barbu-scorecell b {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-weight: 600; font-size: clamp(18px, 4.6vw, 24px);
  color: var(--color-text, #23201b); font-variant-numeric: tabular-nums;
}
.barbu-me { background: rgba(182, 130, 53, 0.16); box-shadow: inset 0 0 0 1px rgba(182, 130, 53, 0.5); }
.barbu-me b { color: var(--barbu-gold); }

/* ── Status ────────────────────────────────────────────────────────────────── */
.barbu-status {
  text-align: center;
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(15px, 3.6vw, 20px);
  min-block-size: 1.5em;
  color: var(--color-text, #23201b);
}

/* ── Panel: chooser / deal result ──────────────────────────────────────────── */
.barbu-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; min-block-size: 1px; }
.barbu-panel[hidden] { display: none; }
.barbu-choosetitle, .barbu-choicerow, .barbu-dealscores { flex-basis: 100%; }
.barbu-choosetitle {
  text-align: center; font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(15px, 3.6vw, 19px); color: var(--color-text, #23201b);
}
.barbu-choicerow { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.barbu-btn {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: 15px;
  padding: 8px 18px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--color-neutral-400, #c9c3b5);
  background: #fff;
  color: #23201b; /* fixed: white bg, text must not flip in dark mode */
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}
.barbu-btn:hover { border-color: var(--barbu-gold); }
.barbu-btn:active { transform: translateY(1px); }
.barbu-btn-primary { background: var(--barbu-gold); border-color: var(--barbu-gold); color: #fff; }
.barbu-btn-primary:hover { background: #a2732c; }

.barbu-choice {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: start; max-inline-size: 220px;
}
.barbu-choicename { font-size: 16px; font-weight: 600; color: var(--barbu-gold); }
.barbu-choicedesc { font-family: var(--font-body, "Lora", serif); font-size: 12px; opacity: 0.8; line-height: 1.25; }

.barbu-dealscores { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(8px, 3vw, 18px); margin-block-end: 4px; }
.barbu-dcell { display: inline-flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.barbu-dcell span { font-family: var(--font-heading, "Cormorant Garamond", serif); font-size: 13px; color: var(--color-neutral-500, #8a8578); letter-spacing: 0.06em; }
.barbu-dcell b { font-family: var(--font-heading, "Cormorant Garamond", serif); font-size: 18px; color: var(--color-text, #23201b); }

/* ── Human hand ────────────────────────────────────────────────────────────── */
.barbu-hand { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 3px; min-block-size: clamp(60px, 16vw, 96px); }
.barbu-cardwrap { line-height: 0; position: relative; transition: transform 0.12s; }
.barbu-cardwrap .barbu-card { inline-size: clamp(38px, 8.6vw, 58px); }
.barbu-playable .barbu-card { cursor: pointer; box-shadow: 0 2px 7px rgba(0, 0, 0, 0.28); }
.barbu-playable:hover { transform: translateY(-10px); }
.barbu-muted { opacity: 0.4; }
.barbu-muted .barbu-card { cursor: default; }
.barbu-hint .barbu-card { animation: barbu-pulse 1.1s ease; }

@keyframes barbu-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(182, 130, 53, 0); }
  30% { box-shadow: 0 0 0 4px rgba(182, 130, 53, 0.85); transform: translateY(-8px); }
}

/* ── Dark mode ─────────────────────────────────────────────────────────────── */
.barbu-root.mode-dark .barbu-table {
  background: radial-gradient(130% 110% at 50% 12%, #245c3c 0%, #1a4830 58%, #123522 100%);
}
.barbu-root.mode-dark .barbu-banner { color: #ece7dc; background: linear-gradient(180deg, rgba(217, 165, 78, 0.16), rgba(217, 165, 78, 0.05)); border-color: rgba(217, 165, 78, 0.4); }
.barbu-root.mode-dark .barbu-bcontract { color: #d9a54e; }
.barbu-root.mode-dark .barbu-status,
.barbu-root.mode-dark .barbu-scorecell b { color: #ece7dc; }
.barbu-root.mode-dark .barbu-scoreseat { color: #b9b3a4; }
.barbu-root.mode-dark .barbu-scorecell { background: #2a2721; }
.barbu-root.mode-dark .barbu-me { background: rgba(217, 165, 78, 0.18); }
.barbu-root.mode-dark .barbu-me b { color: #d9a54e; }
.barbu-root.mode-dark .barbu-choosetitle,
.barbu-root.mode-dark .barbu-dcell b { color: #ece7dc; }
.barbu-root.mode-dark .barbu-btn { background: #2a2721; color: #ece7dc; border-color: #4a463c; }
.barbu-root.mode-dark .barbu-btn-primary { background: var(--barbu-gold); color: #1a1712; border-color: var(--barbu-gold); }
.barbu-root.mode-dark .barbu-choicename { color: #d9a54e; }

/* ── Reduced motion ────────────────────────────────────────────────────────── */
.barbu-root.no-motion .barbu-cardwrap,
.barbu-root.no-motion .barbu-btn { transition: none; }
.barbu-root.no-motion .barbu-playable:hover { transform: none; }
.barbu-root.no-motion .barbu-hint .barbu-card { animation: none; }
