/* ============================================================
   RAVE GAMES — Baloot (بلوت) Styles
   Black & silver glassmorphism, mobile-first, 60fps transforms
   ============================================================ */

.baloot-shell {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overflow: hidden;
}

.baloot-top {
  gap: 8px;
  padding-inline: 10px;
}

.baloot-top-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-shrink: 0;
}

.baloot-top .title {
  white-space: nowrap;
}

@media (max-width: 480px) {
  #roomBadge { display: none !important; }
  .baloot-top .btn-sm { padding: 0 8px; font-size: 12px; }
}

.score-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.score-team {
  display: flex;
  align-items: center;
  gap: 4px;
}

.score-team.us { color: var(--green); }
.score-team.them { color: var(--silver-200); }
.score-sep { color: var(--fg-3); font-weight: 400; }

.contract-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--amber);
  white-space: nowrap;
}

.suit-red { color: var(--red); }
.suit-white { color: #f5f5f5; }

.reconnect-banner {
  position: relative;
  z-index: 40;
  background: rgba(248, 113, 113, 0.16);
  border-bottom: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--red);
  text-align: center;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
}

.baloot-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  padding-bottom: calc(var(--safe-b) + 8px);
}

/* ---------- Mini-Lobby & Waiting ---------- */
.baloot-lobby-card {
  width: min(100%, 420px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.baloot-join-row {
  display: flex;
  gap: 8px;
}

.baloot-join-row .input {
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 800;
}

.waiting-card {
  width: min(100%, 500px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.seats-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.seat-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.seat-slot.team-us { border-color: rgba(52, 211, 153, 0.3); }
.seat-slot.team-them { border-color: rgba(200, 200, 200, 0.2); }

.seat-slot-meta {
  min-width: 0;
  text-align: right;
  flex: 1;
}

.seat-slot-name {
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-slot-tag {
  font-size: 11px;
  color: var(--fg-3);
}

/* ---------- Table Layout ---------- */
.table-stage {
  width: 100%;
  height: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 4px;
  position: relative;
}

.top-seat-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 2px;
}

.middle-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  min-height: 0;
}

/* ---------- Seat Badges ---------- */
.seat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 14px;
  background: rgba(17, 17, 17, 0.8);
  border: 1px solid var(--border);
  min-width: 82px;
  max-width: 118px;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.seat-card.team-us { border-color: rgba(52, 211, 153, 0.3); }
.seat-card.team-them { border-color: rgba(200, 200, 200, 0.16); }

.seat-card.active {
  border-color: var(--amber);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.22);
}

.seat-card.disconnected { opacity: 0.6; }

.avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.avatar-wrap .avatar {
  width: 34px;
  height: 34px;
  border-width: 1.5px;
}

.bot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #252525, #141414);
  border: 1.5px solid #383838;
  display: grid;
  place-items: center;
  font-size: 16px;
}

.turn-ring {
  position: absolute;
  inset: 0;
  width: 40px;
  height: 40px;
  transform: rotate(-90deg);
  pointer-events: none;
}

.turn-ring circle {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.turn-ring .ring-bg { stroke: rgba(255, 255, 255, 0.08); }
.turn-ring .ring-fg { stroke: var(--amber); transition: stroke-dashoffset 0.25s linear; }

.seat-name {
  font-size: 12px;
  font-weight: 800;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
}

.mini-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--silver-200);
}

.mini-badge.bid { background: rgba(251, 191, 36, 0.18); color: var(--amber); }
.mini-badge.dealer { background: rgba(96, 165, 250, 0.16); color: var(--blue); }
.mini-badge.proj { background: rgba(52, 211, 153, 0.16); color: var(--green); }

.mini-backs {
  display: flex;
  justify-content: center;
  height: 14px;
  margin-top: 2px;
}

.mini-back {
  width: 10px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(135deg, #2b2b2b, #141414);
  border: 1px solid rgba(255, 255, 255, 0.22);
  margin-inline-start: -4px;
}
.mini-back:first-child { margin-inline-start: 0; }

/* ---------- Baloot Felt / Carbon Table ---------- */
.baloot-table {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 200px;
  max-height: 360px;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 45%, rgba(122, 179, 224, 0.12) 0%, rgba(14, 26, 40, 0.94) 72%),
    linear-gradient(145deg, #132234, #070d14);
  border: 1.5px solid var(--border);
  box-shadow:
    inset 0 0 40px rgba(4, 12, 22, 0.8),
    0 18px 48px rgba(4, 12, 22, 0.6);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.baloot-table::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.table-watermark {
  font-size: 26px;
  letter-spacing: 10px;
  color: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

/* ---------- Traditional Baloot Table Themes ---------- */
.baloot-table.table-sadu {
  background:
    radial-gradient(circle at 50% 45%, rgba(28, 16, 14, 0.72) 0%, rgba(16, 10, 9, 0.94) 74%),
    repeating-linear-gradient(90deg, #5c1616 0 18px, #161412 18px 34px, #c9a86a 34px 38px, #161412 38px 54px);
  border: 2px solid rgba(201, 168, 106, 0.55);
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.8), 0 18px 48px rgba(92, 22, 22, 0.32);
}
.baloot-table.table-sadu::before {
  border: 2px dashed rgba(201, 168, 106, 0.35);
}
.baloot-table.table-sadu .table-watermark { color: rgba(214, 184, 131, 0.14); }

.baloot-table.table-majlis {
  background:
    radial-gradient(circle at 50% 45%, rgba(92, 24, 34, 0.55) 0%, rgba(30, 10, 14, 0.96) 75%),
    repeating-linear-gradient(45deg, rgba(212, 175, 55, 0.06) 0 10px, transparent 10px 20px),
    linear-gradient(145deg, #42121a, #1d090d);
  border: 2px solid rgba(212, 175, 55, 0.52);
  box-shadow: inset 0 0 46px rgba(0, 0, 0, 0.78), 0 18px 48px rgba(66, 18, 26, 0.4);
}
.baloot-table.table-majlis::before {
  border: 1.5px solid rgba(212, 175, 55, 0.34);
}
.baloot-table.table-majlis .table-watermark { color: rgba(212, 175, 55, 0.14); }

.baloot-table.table-qahwa {
  background:
    radial-gradient(circle at 50% 45%, rgba(120, 74, 42, 0.35) 0%, rgba(28, 17, 11, 0.95) 75%),
    repeating-linear-gradient(0deg, rgba(255, 214, 170, 0.03) 0 4px, transparent 4px 12px),
    linear-gradient(145deg, #362115, #1b100a);
  border: 2px solid rgba(184, 115, 51, 0.52);
  box-shadow: inset 0 0 44px rgba(0, 0, 0, 0.8), 0 18px 48px rgba(54, 33, 21, 0.42);
}
.baloot-table.table-qahwa::before {
  border: 1.5px solid rgba(184, 115, 51, 0.3);
}
.baloot-table.table-qahwa .table-watermark { color: rgba(212, 155, 100, 0.14); }

.baloot-table.table-zal {
  background:
    radial-gradient(circle at 50% 45%, rgba(114, 33, 44, 0.58) 0%, rgba(19, 28, 46, 0.96) 72%),
    repeating-linear-gradient(135deg, rgba(218, 179, 96, 0.08) 0 8px, transparent 8px 18px),
    linear-gradient(145deg, #1b2840, #101726);
  border: 2px solid rgba(218, 179, 96, 0.58);
  box-shadow: inset 0 0 46px rgba(0, 0, 0, 0.8), 0 18px 48px rgba(27, 40, 64, 0.45);
}
.baloot-table.table-zal::before {
  border: 2px double rgba(218, 179, 96, 0.38);
}
.baloot-table.table-zal .table-watermark { color: rgba(218, 179, 96, 0.16); }

/* ---------- Floor Card (Bidding) ---------- */
.floor-box {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: pop 0.3s var(--ease);
}

.floor-card-img {
  width: clamp(64px, 16vw, 88px);
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #fff;
}

.floor-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--silver-300);
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 10px;
  border-radius: 999px;
}

/* ---------- Trick Slots ---------- */
.trick-arena {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.trick-card {
  position: absolute;
  width: clamp(54px, 14vw, 76px);
  aspect-ratio: 5 / 7;
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #fff;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.55s ease;
}

.trick-card.pos-bottom { left: 50%; bottom: 12%; transform: translate(-50%, 0); animation: flyFromBottom 0.25s var(--ease); }
.trick-card.pos-top    { left: 50%; top: 12%;    transform: translate(-50%, 0); animation: flyFromTop 0.25s var(--ease); }
.trick-card.pos-right  { right: 14%; top: 50%;   transform: translate(0, -50%) rotate(-6deg); animation: flyFromRight 0.25s var(--ease); }
.trick-card.pos-left   { left: 14%;  top: 50%;   transform: translate(0, -50%) rotate(6deg);  animation: flyFromLeft 0.25s var(--ease); }

.trick-card.winner-glow {
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.75);
  border-color: var(--amber);
}

.trick-arena.collect-bottom .trick-card { transform: translate(-50%, 90px) scale(0.5); opacity: 0; }
.trick-arena.collect-top .trick-card    { transform: translate(-50%, -90px) scale(0.5); opacity: 0; }
.trick-arena.collect-right .trick-card  { transform: translate(110px, -50%) scale(0.5); opacity: 0; }
.trick-arena.collect-left .trick-card   { transform: translate(-110px, -50%) scale(0.5); opacity: 0; }

@keyframes flyFromBottom { from { opacity: 0; transform: translate(-50%, 45px) scale(0.9); } }
@keyframes flyFromTop    { from { opacity: 0; transform: translate(-50%, -45px) scale(0.9); } }
@keyframes flyFromRight  { from { opacity: 0; transform: translate(45px, -50%) scale(0.9); } }
@keyframes flyFromLeft   { from { opacity: 0; transform: translate(-45px, -50%) scale(0.9); } }

/* ---------- Bidding & Project Panels ---------- */
.bidding-panel {
  position: relative;
  z-index: 20;
  width: min(100%, 440px);
  margin: 0 auto 6px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(16, 16, 18, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: pop 0.2s var(--ease);
}

.bidding-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--amber);
  text-align: center;
}

.bidding-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.bidding-actions .btn {
  flex: 1 1 88px;
  min-height: 44px;
  padding: 0 12px;
}

.project-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.4);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Bottom Player & Fanned Hand ---------- */
.bottom-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
}

.my-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.85);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 800;
}

.my-bar.active {
  border-color: var(--amber);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.25);
}

.hand-fan {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: clamp(92px, 16vh, 130px);
  padding: 6px 10px 2px;
  width: 100%;
  touch-action: manipulation;
}

.hand-card {
  position: relative;
  width: clamp(56px, 13.5vw, 84px);
  aspect-ratio: 5 / 7;
  border-radius: 9px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: #fff;
  box-shadow: -4px 4px 14px rgba(0, 0, 0, 0.55);
  margin-inline-start: clamp(-24px, -4.5vw, -12px);
  cursor: pointer;
  transition: transform 0.18s var(--ease), opacity 0.18s, filter 0.18s, border-color 0.18s;
  flex-shrink: 0;
}

.hand-card:first-child { margin-inline-start: 0; }

.hand-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.hand-card.playable:hover {
  transform: translateY(-10px);
  z-index: 15;
}

.hand-card.selected {
  transform: translateY(-20px) scale(1.06);
  border-color: var(--amber);
  box-shadow: 0 12px 24px rgba(251, 191, 36, 0.35);
  z-index: 25;
}

.hand-card.dimmed {
  opacity: 0.42;
  filter: grayscale(0.45);
  cursor: not-allowed;
}

.tap-hint {
  font-size: 11px;
  color: var(--amber);
  font-weight: 700;
  height: 16px;
}

/* ---------- Last Trick & History Modals ---------- */
.last-trick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.last-trick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.last-trick-item img {
  width: 58px;
  aspect-ratio: 5 / 7;
  border-radius: 7px;
  background: #fff;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
}

.history-table th,
.history-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #1e1e1e;
  text-align: center;
}

.history-table th {
  color: var(--fg-3);
  font-weight: 700;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #1e1e1e;
  font-size: 14px;
}

@media (min-width: 820px) {
  .seat-card { min-width: 110px; max-width: 145px; padding: 8px 12px; }
  .baloot-table { max-height: 410px; max-width: 580px; }
  .hand-card { margin-inline-start: -14px; }
}
