/* rummy/public/css/game.css — only what is specific to Rummy's table.
   Page chrome, seats, cards, tray, lobby and reveal screens all come from
   the shared kit stylesheets. */

/* Room reserved around the felt for the top bar, info strip and this game's
   tray (status row, melds on the table, the hand, a row or two of buttons). */
.table-felt { --tbl-felt-chrome: 480px; }
#game-table { padding: 46px 38px; }

/* ── Piles in the felt centre ─────────────────────────────────────── */
#table-center { align-items: center; gap: 26px; }
.rm-pile { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pile-label { font-size: 0.66rem; color: var(--tbl-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.pile-count { font-size: 0.68rem; color: var(--tbl-text-muted); min-height: 1em; }
.pile-slot { border-radius: 8px; }
.pile-slot.clickable { cursor: pointer; transition: transform 0.12s ease; }
.pile-slot.clickable .pcard { box-shadow: 0 0 0 3px rgba(255, 228, 56, 0.55), 0 2px 4px rgba(0,0,0,0.3); }
.pile-slot.clickable:hover { transform: translateY(-3px); }
.pcard.rm-empty { background: transparent; border: 2px dashed rgba(255,255,255,0.28); box-shadow: none; }
.rm-history-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.68rem; color: var(--tbl-text-muted); text-decoration: underline;
}
.rm-history-link:hover { color: var(--tbl-text); }

/* ── Hand ─────────────────────────────────────────────────────────── */
#hand-area { gap: 6px; max-width: 640px; margin: 0 auto 6px; }
#hand-area .pcard { position: relative; width: 46px; height: 66px; font-size: 15px; }
#hand-area .pcard .pc-suit { font-size: 18px; }
#hand-area .pcard.selected,
#hand-area .pcard.selectable.selected:hover { transform: translateY(-9px); box-shadow: 0 0 0 3px var(--accent), 0 6px 14px rgba(0,0,0,0.3); }
#hand-area .pcard.rm-new::after {
  content: 'new'; position: absolute; top: -8px; right: -6px;
  font-size: 0.5rem; font-weight: 800; letter-spacing: 0.03em;
  background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 1px 5px;
}

#action-row { gap: 8px; }
#action-row button { padding: 0.5rem 0.9rem; font-size: 0.82rem; }

/* ── Melds on the table (tray) ────────────────────────────────────── */
#rm-melds { width: 100%; max-width: 640px; margin: 0 auto 8px; }
#rm-melds:empty { display: none; }
.rm-melds-title { font-size: 0.66rem; color: var(--tbl-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 4px; text-align: center; }
.rm-melds-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px;
  max-height: 150px; overflow-y: auto; overscroll-behavior: contain;
  padding: 2px;
}
.rm-meld {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 5px 7px; text-align: left;
  border-radius: 10px; border: 2px solid var(--tbl-panel-border); background: rgba(255,255,255,0.03);
  color: var(--tbl-text); font: inherit; cursor: pointer;
}
.rm-meld-head { display: flex; gap: 6px; align-items: baseline; font-size: 0.66rem; font-weight: 700; max-width: 100%; }
.rm-meld-head > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-meld-kind { text-transform: uppercase; letter-spacing: 0.06em; color: var(--tbl-text-muted); font-weight: 700; }
.rm-meld-cards { display: flex; flex-wrap: wrap; gap: 2px; }
.rm-meld.fits { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.rm-meld.no-fit { opacity: 0.55; }

/* Small face-up card (melds, reveal, history) */
.rm-mini {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 34px; padding: 0 2px; border-radius: 4px;
  background: #f4f1ea; color: #23241f; border: 1px solid rgba(0,0,0,0.25);
  font-family: var(--font-display); font-weight: 800; font-size: 0.7rem;
}
.rm-mini.red { color: #c0392b; }

/* ── Status strip / tokens ────────────────────────────────────────── */
.rm-target-chip { color: var(--tbl-accent); font-weight: 700; }
.tk-badge.rm-dealer { background: var(--accent); color: var(--on-accent); }
.tk-seat.sitting-out { opacity: 0.6; }
.tk-muted { font-size: 0.66rem; color: var(--tbl-text-muted); }

/* ── GM setup panel in the lobby (same look as Pitch's) ───────────── */
.gm-panel { display: flex; flex-direction: column; gap: 12px; background: var(--tbl-panel-bg); border: 1px solid var(--tbl-panel-border); border-radius: 12px; padding: 12px 14px; }
.gm-panel-row { display: flex; flex-direction: column; gap: 6px; }
.gm-panel-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tbl-text-muted); font-weight: 700; }
.rm-hint { font-size: 0.78rem; color: var(--tbl-text-mid); margin: 0; text-align: center; }
.toggle-row { display: flex; gap: 6px; flex-wrap: wrap; }
.toggle-btn {
  flex: 1; min-width: 60px;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--tbl-panel-border); background: rgba(255,255,255,0.04);
  color: var(--tbl-text-mid); font-family: var(--font-body); font-weight: 700; font-size: 0.82rem; cursor: pointer;
}
.toggle-btn.active { border-color: var(--tbl-accent); color: var(--tbl-accent); background: color-mix(in srgb, var(--tbl-accent) 12%, transparent); }

/* ── Reveal ───────────────────────────────────────────────────────── */
.rm-reveal-block {
  width: 100%; max-width: 480px;
  padding: 8px 12px; margin: 0 auto 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--tbl-panel-border);
}
.rm-reveal-block.winner { border-color: #43a047; }
.rm-reveal-name { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.rm-reveal-score { color: var(--tbl-accent); }
.rm-reveal-score small { color: var(--tbl-text-muted); font-weight: 400; }
.rm-reveal-left { color: var(--tbl-text-muted); font-weight: 600; font-size: 0.82rem; }
.rm-reveal-cards { display: flex; flex-wrap: wrap; gap: 3px; }
.rm-reveal-melds { width: 100%; max-width: 480px; margin: 12px auto 0; }
.rm-reveal-meld-row { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-mini-meld { display: flex; gap: 2px; padding: 3px; border-radius: 6px; border: 1px solid #1f8a4c; }

/* ── Score table (game over + Scoreboard) ─────────────────────────── */
.rm-score-table { width: 100%; max-width: 560px; margin: 0 auto; border-collapse: collapse; font-size: 0.78rem; }
.rm-score-table th, .rm-score-table td { padding: 5px 6px; text-align: right; border-bottom: 1px solid var(--tbl-panel-border); }
.rm-score-table th:first-child, .rm-score-table td:first-child { text-align: left; font-weight: 700; }
.rm-score-table td.total { font-weight: 800; }
.rm-score-table tr.leader td.total { color: var(--tbl-accent); }
.rm-modal-box { max-width: 560px; width: 92%; max-height: 80dvh; overflow: auto; }
.rm-modal-box h2 { margin: 0 0 10px; font-family: var(--font-display); font-size: 1.1rem; text-align: center; }
.rm-modal-body { margin-bottom: 14px; }
.rm-modal-note { font-size: 0.8rem; color: var(--tbl-text-muted); margin: 0 0 8px; }
.rm-history-cards { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }

@media (max-width: 480px) {
  #hand-area { gap: 4px; }
  #hand-area .pcard { width: 38px; height: 54px; font-size: 13px; }
  #hand-area .pcard .pc-suit { font-size: 15px; }
  #action-row { gap: 6px; }
  #action-row button { padding: 0.45rem 0.7rem; font-size: 0.76rem; }
  .rm-melds-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); max-height: 128px; }
  .rm-mini { min-width: 22px; height: 30px; font-size: 0.64rem; }
  .rm-score-table { font-size: 0.7rem; }
  .rm-score-table th, .rm-score-table td { padding: 4px 3px; }
}
