/* Rami (Rummy) — a three-player card table. The card art is the shared Vector
   Playing Cards SVGs, rendered whole (the black outline is the die-cut: never
   cropped, never boxed). Scoped to .rami-root, tokens from the shell, a green
   felt surface inside the board only. */

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

/* ── Table surface ─────────────────────────────────────────────────────────── */
.rami-table {
  background: radial-gradient(130% 110% at 50% 10%, var(--rami-felt-1) 0%, var(--rami-felt-2) 58%, var(--rami-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);
  color: var(--rami-ink);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.4vw, 16px);
}

/* ── Opponents ─────────────────────────────────────────────────────────────── */
.rami-opps { display: flex; align-items: flex-start; justify-content: space-between; gap: clamp(6px, 2vw, 16px); }
.rami-opp { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.rami-oppname {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(13px, 2.8vw, 16px);
  letter-spacing: 0.04em;
  padding: 1px 10px;
  border-radius: 999px;
  opacity: 0.85;
  transition: color 0.15s, background 0.15s;
}
.rami-oppname.rami-active { opacity: 1; color: #fff; background: rgba(182, 130, 53, 0.55); box-shadow: 0 0 0 1px rgba(182, 130, 53, 0.9); }
.rami-oppcount { font-size: clamp(11px, 2.4vw, 13px); opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ── Stock + discard piles ─────────────────────────────────────────────────── */
.rami-piles { display: flex; align-items: flex-start; justify-content: center; gap: clamp(14px, 5vw, 34px); }
.rami-pile { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rami-pilecard {
  inline-size: clamp(52px, 14vw, 76px);
  min-block-size: clamp(74px, 20vw, 106px);
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
}
.rami-pilecard .rami-card { inline-size: 100%; }
.rami-empty {
  display: block; inline-size: clamp(52px, 14vw, 76px); block-size: clamp(74px, 20vw, 106px);
  border: 1px dashed rgba(255, 255, 255, 0.4); border-radius: 7px;
}
.rami-pilelabel {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(10px, 2.3vw, 12px); letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.82;
  font-variant-numeric: tabular-nums;
}
.rami-drawable .rami-pilecard { cursor: pointer; box-shadow: 0 0 0 2px var(--rami-gold), 0 3px 10px rgba(0, 0, 0, 0.35); }
.rami-drawable { cursor: pointer; }
.rami-drawable:hover .rami-pilecard { transform: translateY(-4px); }

/* ── Melds on the table ────────────────────────────────────────────────────── */
.rami-melds { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: clamp(6px, 1.6vw, 12px); min-block-size: clamp(40px, 11vw, 62px); }
.rami-meldsempty { font-size: clamp(12px, 2.6vw, 14px); opacity: 0.6; align-self: center; }
.rami-meld {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 6px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.rami-meldowner {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(9px, 2vw, 11px); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7;
}
.rami-meldcards { display: flex; }
.rami-meldcard { inline-size: clamp(30px, 8vw, 44px); margin-inline-start: -12px; border-radius: 4px; }
.rami-meldcard:first-child { margin-inline-start: 0; }
.rami-meld-layable { cursor: pointer; background: rgba(182, 130, 53, 0.4); box-shadow: inset 0 0 0 1px var(--rami-gold), 0 0 0 2px rgba(182, 130, 53, 0.7); }

/* ── Standings ─────────────────────────────────────────────────────────────── */
.rami-standings { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: clamp(8px, 3vw, 20px); }
.rami-round {
  font-family: var(--font-heading, "Cormorant Garamond", serif);
  font-size: clamp(11px, 2.4vw, 13px); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-neutral-500, #8a8578);
}
.rami-stand { display: inline-flex; align-items: baseline; gap: 6px; padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.rami-standname { font-family: var(--font-heading, "Cormorant Garamond", serif); font-size: clamp(12px, 2.6vw, 14px); letter-spacing: 0.06em; color: var(--color-neutral-500, #8a8578); }
.rami-stand b { font-family: var(--font-heading, "Cormorant Garamond", serif); font-weight: 600; font-size: clamp(16px, 4vw, 21px); color: var(--color-text, #23201b); }
.rami-stand-you b { color: var(--rami-gold); }
.rami-stand-active { background: rgba(182, 130, 53, 0.16); box-shadow: inset 0 0 0 1px rgba(182, 130, 53, 0.5); }

/* ── Status ────────────────────────────────────────────────────────────────── */
.rami-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);
}

/* ── Actions ───────────────────────────────────────────────────────────────── */
.rami-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; min-block-size: 1px; }
.rami-actionhint { flex-basis: 100%; text-align: center; font-size: clamp(12px, 2.6vw, 14px); color: var(--color-neutral-500, #8a8578); }
.rami-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, opacity 0.15s;
}
.rami-btn:hover:not([disabled]) { border-color: var(--rami-gold); }
.rami-btn:active:not([disabled]) { transform: translateY(1px); }
.rami-btn[disabled] { opacity: 0.42; cursor: default; }
.rami-btn-primary:not([disabled]) { background: var(--rami-gold); border-color: var(--rami-gold); color: #fff; }
.rami-btn-primary:not([disabled]):hover { background: #a2732c; }

/* ── Human hand ────────────────────────────────────────────────────────────── */
.rami-hand { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 4px; min-block-size: clamp(66px, 18vw, 100px); }
.rami-cardwrap { line-height: 0; position: relative; transition: transform 0.12s; }
.rami-cardwrap .rami-card { inline-size: clamp(44px, 10.5vw, 68px); }
.rami-card { display: block; border-radius: 5px; block-size: auto; }
.rami-selectable .rami-card { cursor: pointer; box-shadow: 0 2px 7px rgba(0, 0, 0, 0.24); }
.rami-selectable:hover { transform: translateY(-8px); }
.rami-selected { transform: translateY(-14px); }
.rami-selected .rami-card { box-shadow: 0 0 0 3px var(--rami-gold), 0 4px 10px rgba(0, 0, 0, 0.3); }
.rami-selected.rami-selectable:hover { transform: translateY(-16px); }
.rami-hint .rami-card { animation: rami-pulse 1.2s ease; }

@keyframes rami-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 ─────────────────────────────────────────────────────────────── */
.rami-root.mode-dark .rami-table {
  background: radial-gradient(130% 110% at 50% 10%, #245c3c 0%, #1a4830 58%, #123522 100%);
}
.rami-root.mode-dark { color: #ece7dc; }
.rami-root.mode-dark .rami-status,
.rami-root.mode-dark .rami-stand b { color: #ece7dc; }
.rami-root.mode-dark .rami-standname,
.rami-root.mode-dark .rami-round { color: #b9b3a4; }
.rami-root.mode-dark .rami-stand-you b { color: #d9a54e; }
.rami-root.mode-dark .rami-actionhint { color: #b9b3a4; }
.rami-root.mode-dark .rami-btn { background: #2a2721; color: #ece7dc; border-color: #4a463c; }
.rami-root.mode-dark .rami-btn-primary:not([disabled]) { background: var(--rami-gold); color: #1a1712; border-color: var(--rami-gold); }

/* ── Reduced motion ────────────────────────────────────────────────────────── */
.rami-root.no-motion .rami-cardwrap,
.rami-root.no-motion .rami-btn,
.rami-root.no-motion .rami-drawable:hover .rami-pilecard { transition: none; }
.rami-root.no-motion .rami-selectable:hover,
.rami-root.no-motion .rami-drawable:hover .rami-pilecard { transform: none; }
.rami-root.no-motion .rami-hint .rami-card { animation: none; }
