/* French Tarot — a four-player card table. Cards are the 78-card tarot JPGs
   (220x386), rendered whole (the black die-cut outline is never cropped, never
   boxed). Opponent hands are CSS card backs. Scoped to .tar-root, tokens from the
   shell, a green felt surface inside the board only. */

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

/* ── Table surface ─────────────────────────────────────────────────────────── */
.tar-table {
  background: radial-gradient(130% 110% at 50% 12%, var(--tar-felt-1) 0%, var(--tar-felt-2) 58%, var(--tar-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);
}

.tar-seat { display: flex; flex-direction: column; align-items: center; gap: 4px; min-block-size: 1px; }
.tar-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;
}
.tar-name.tar-active { opacity: 1; color: #fff; background: rgba(182, 130, 53, 0.55); box-shadow: 0 0 0 1px rgba(182, 130, 53, 0.9); }

/* ── Card backs (CSS, no image) ────────────────────────────────────────────── */
.tar-backs { display: flex; align-items: center; justify-content: center; position: relative; min-block-size: 1px; }
.tar-back {
  inline-size: clamp(26px, 7vw, 38px);
  block-size: calc(clamp(26px, 7vw, 38px) * 1.72);
  border-radius: 5px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 4px, rgba(0, 0, 0, 0.12) 4px 8px),
    linear-gradient(160deg, #37424f 0%, #232a33 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(182, 130, 53, 0.35);
}
.tar-count {
  position: absolute;
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(11px, 2.4vw, 13px);
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 999px;
  padding: 0 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}
/* North fans horizontally, West / East stack vertically to save width. */
.tar-north .tar-backs .tar-back { margin-inline-start: -24px; }
.tar-north .tar-backs .tar-back:first-child { margin-inline-start: 0; }
.tar-north .tar-count { top: 50%; left: 50%; transform: translate(-50%, -50%); }

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

/* ── Center: trick area + info ─────────────────────────────────────────────── */
.tar-center { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; }
.tar-trick {
  position: relative;
  inline-size: clamp(160px, 44vw, 250px);
  block-size: clamp(160px, 44vw, 250px);
  margin: 0 auto;
}
.tar-slot { position: absolute; inline-size: clamp(46px, 13vw, 74px); display: flex; justify-content: center; }
.tar-slot .tar-card { inline-size: 100%; block-size: auto; }
.tar-slot-N { top: 0; left: 50%; transform: translateX(-50%); }
.tar-slot-S { bottom: 0; left: 50%; transform: translateX(-50%); }
.tar-slot-W { left: 0; top: 50%; transform: translateY(-50%); }
.tar-slot-E { right: 0; top: 50%; transform: translateY(-50%); }

.tar-info {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none;
}
.tar-bidhigh {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(13px, 3vw, 17px);
  line-height: 1.2;
  color: #fff;
  background: rgba(0, 0, 0, 0.28);
  padding: 6px 12px;
  border-radius: 8px;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.tar-card { display: block; border-radius: 5px; block-size: auto; }

/* ── Banner (contract / taker / bouts) ─────────────────────────────────────── */
.tar-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: clamp(8px, 2.5vw, 18px);
  min-block-size: 1.4em;
}
.tar-btag {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(12px, 2.8vw, 15px);
  letter-spacing: 0.03em;
  color: var(--color-text, #23201b);
}
.tar-btag b { color: var(--tar-gold); font-weight: 600; }
.tar-bouts { display: inline-flex; align-items: center; gap: 5px; }
.tar-bout {
  display: inline-flex; align-items: center; justify-content: center;
  min-inline-size: 1.5em; block-size: 1.5em; padding: 0 4px;
  border-radius: 999px;
  font-size: clamp(10px, 2.2vw, 12px);
  border: 1px solid var(--color-neutral-400, #c9c3b5);
  color: var(--color-neutral-500, #8a8578);
  background: transparent;
}
.tar-bout-on { background: var(--tar-gold); border-color: var(--tar-gold); color: #fff; font-weight: 600; }

/* ── Scores ────────────────────────────────────────────────────────────────── */
.tar-scores { display: flex; align-items: stretch; justify-content: center; gap: clamp(8px, 2.4vw, 18px); flex-wrap: wrap; }
.tar-scorecell { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; font-variant-numeric: tabular-nums; }
.tar-sname { font-family: var(--font-heading, "Cormorant Garamond", serif); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-neutral-500, #8a8578); }
.tar-scorecell b { font-family: var(--font-heading, "Cormorant Garamond", serif); font-weight: 600; font-size: clamp(17px, 4.4vw, 23px); color: var(--color-text, #23201b); }
.tar-you .tar-sname { color: var(--tar-gold); }
.tar-you b { color: var(--tar-gold); }

/* ── Status ────────────────────────────────────────────────────────────────── */
.tar-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 (bids / ecart / continue) ───────────────────────────────────────── */
.tar-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; min-block-size: 1px; }
.tar-panel[hidden] { display: none; }
.tar-ecount { font-family: var(--font-heading, "Cormorant Garamond", serif); font-size: 14px; color: var(--color-text, #23201b); }

.tar-btn {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: 15px;
  padding: 8px 16px;
  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;
}
.tar-btn:hover:not(:disabled) { border-color: var(--tar-gold); }
.tar-btn:active:not(:disabled) { transform: translateY(1px); }
.tar-btn:disabled { opacity: 0.4; cursor: default; }
.tar-btn-primary { background: var(--tar-gold); border-color: var(--tar-gold); color: #fff; }
.tar-btn-primary:hover:not(:disabled) { background: #a2732c; }

/* ── Human hand ────────────────────────────────────────────────────────────── */
.tar-hand { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 3px; min-block-size: clamp(64px, 17vw, 104px); }
.tar-cardwrap { line-height: 0; position: relative; transition: transform 0.12s; }
.tar-cardwrap .tar-card { inline-size: clamp(38px, 8.6vw, 58px); }
.tar-istrump .tar-card { box-shadow: 0 0 0 2px var(--tar-gold); border-radius: 6px; }
.tar-playable .tar-card { cursor: pointer; box-shadow: 0 2px 7px rgba(0, 0, 0, 0.28); }
.tar-istrump.tar-playable .tar-card { box-shadow: 0 0 0 2px var(--tar-gold), 0 2px 7px rgba(0, 0, 0, 0.28); }
.tar-playable:hover { transform: translateY(-10px); }
.tar-muted { opacity: 0.38; }
.tar-muted .tar-card { cursor: default; }
.tar-selected { transform: translateY(-14px); }
.tar-selected .tar-card { box-shadow: 0 0 0 3px var(--tar-gold), 0 6px 12px rgba(0, 0, 0, 0.32); border-radius: 6px; }
.tar-fromchien .tar-card { outline: 2px dashed rgba(182, 130, 53, 0.9); outline-offset: 1px; }
.tar-hint .tar-card { animation: tar-pulse 1.1s ease; }

@keyframes tar-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 ─────────────────────────────────────────────────────────────── */
.tar-root.mode-dark .tar-table {
  background: radial-gradient(130% 110% at 50% 12%, #245c3c 0%, #1a4830 58%, #123522 100%);
}
.tar-root.mode-dark .tar-status,
.tar-root.mode-dark .tar-btag,
.tar-root.mode-dark .tar-ecount,
.tar-root.mode-dark .tar-scorecell b { color: #ece7dc; }
.tar-root.mode-dark .tar-sname { color: #b9b3a4; }
.tar-root.mode-dark .tar-btag b,
.tar-root.mode-dark .tar-you .tar-sname,
.tar-root.mode-dark .tar-you b { color: #d9a54e; }
.tar-root.mode-dark .tar-bout { border-color: #4a463c; color: #b9b3a4; }
.tar-root.mode-dark .tar-bout-on { background: var(--tar-gold); color: #1a1712; border-color: var(--tar-gold); }
.tar-root.mode-dark .tar-btn { background: #2a2721; color: #ece7dc; border-color: #4a463c; }
.tar-root.mode-dark .tar-btn-primary { background: var(--tar-gold); color: #1a1712; border-color: var(--tar-gold); }

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