/* ─── Rummikub ─────────────────────────────────────────────────────────── */
.rk-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 4px 0 14px;
}
.rk-title { margin: 0; font-size: 22px; }
.rk-phase-badge {
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.rk-phase-my   { background: rgba(74,92,245,0.12); color: #3646c7; }
.rk-phase-wait { background: rgba(0,0,0,0.06); color: #666; }
.rk-phase-done { background: rgba(0,200,150,0.15); color: #00946f; }

.rk-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rk-meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(0,0,0,0.05); font-size: 13px;
}
.rk-meta-chip-warn { background: rgba(242,152,41,0.15); color: #b06500; }
.rk-meta-chip-warn svg { margin-right: -2px; }

.rk-error { border-left: 4px solid #f5222d; }

/* Table */
.rk-table-wrap { margin: 12px 0 18px; }
.rk-table {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; background: #f6e8c9;         /* felt-like table background */
  border-radius: 10px; border: 2px solid #c8a976;
  max-height: 50vh; overflow-y: auto;
}
.rk-empty-note {
  padding: 24px 12px; text-align: center;
  background: #f6e8c9; border-radius: 10px; border: 2px dashed #c8a976;
  font-style: italic;
}
.rk-set {
  display: block; position: relative;
  background: #fff; border-radius: 8px; padding: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.rk-set-group { border-color: rgba(74,92,245,0.5); }
.rk-set-run   { border-color: rgba(0,200,150,0.5); }
.rk-set-invalid { border-color: rgba(245,34,45,0.5); background: rgba(245,34,45,0.03); }
.rk-set-target-hot { border-color: #4a5cf5; box-shadow: 0 0 0 3px rgba(74,92,245,0.2); }

.rk-set-target {
  width: 100%; background: transparent; border: 0; padding: 0;
  cursor: pointer; text-align: left;
}
.rk-set-tiles { display: flex; gap: 2px; flex-wrap: wrap; }
.rk-set-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 4px; padding-left: 4px;
}

/* Rack */
.rk-rack-wrap {
  position: sticky; bottom: 0;
  background: var(--bg, #fff); padding: 10px 0 8px;
  margin: 12px 0 8px;
  z-index: 2;
}
.rk-rack-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.rk-sort-group { display: inline-flex; gap: 4px; }
.rk-sort-btn   { display: inline-flex; align-items: center; gap: 4px; }
.rk-rack {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 8px; border-radius: 10px;
  background: #d2b48c;                          /* wooden rack */
  border: 2px solid #a0826d;
  min-height: 64px;
}

/* Tiles */
.rk-tile {
  --tile-w: 38px; --tile-h: 52px;
  width: var(--tile-w); height: var(--tile-h);
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fafafa;
  font-size: 22px; font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform 0.08s, box-shadow 0.08s;
  padding: 0;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.06), 0 1px 1px rgba(0,0,0,0.08);
  user-select: none;
}
.rk-tile:hover:not([disabled]) { transform: translateY(-1px); }
.rk-tile[disabled] { cursor: default; opacity: 0.9; }

.rk-tile-c-red    { color: #d92f3a; }
.rk-tile-c-blue   { color: #1f5fd0; }
.rk-tile-c-yellow { color: #c78900; }        /* mustard for contrast on white */
.rk-tile-c-black  { color: #1f2937; }
.rk-tile-c-joker  { color: #ff1493; background: linear-gradient(135deg, #fff, #ffe4f1); }

.rk-tile-selected {
  transform: translateY(-5px);
  box-shadow: 0 4px 8px rgba(74,92,245,0.35), inset 0 -2px 0 rgba(0,0,0,0.06);
  outline: 2px solid #4a5cf5;
}
.rk-tile-picked {
  transform: translateY(-5px) rotate(-2deg);
  box-shadow: 0 6px 10px rgba(242,41,158,0.4);
  outline: 2px solid #f2299e;
}
.rk-tile-played {
  background: #fff8e1;                        /* subtle "just-played" marker on rack */
}

/* Actions */
.rk-actions {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; background: rgba(0,0,0,0.03); border-radius: 10px;
  margin: 12px 0;
}
.rk-actions-waiting { text-align: center; font-style: italic; }
.rk-actions-done { text-align: center; }
.rk-action-hint { font-size: 13px; }
.rk-action-buttons, .rk-turn-buttons {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.rk-action-buttons .btn-primary, .rk-turn-buttons .btn-primary,
.rk-action-buttons .btn-secondary, .rk-turn-buttons .btn-secondary {
  font-size: 14px; padding: 8px 14px;
}
.rk-inline-form { display: inline-block; margin: 0; }

@media (max-width: 480px) {
  .rk-tile { --tile-w: 34px; --tile-h: 46px; font-size: 19px; }
  .rk-header { flex-direction: column; align-items: flex-start; gap: 4px; }
  .rk-action-buttons, .rk-turn-buttons { flex-direction: column; align-items: stretch; }
}
