/* ===================================================
   الشكّبة الليبية — Hi-fi Prototype
   =================================================== */

:root {
  --libyan-gold: #C9A961;
  --libyan-gold-bright: #FFD700;
  --phoenician-red: #8B2635;
  --mediterranean: #1B4965;
  --sand: #E8DCC4;
  --olive-libya: #6B7F50;
  --terracotta: #C65D32;
  --midnight: #1A1A2E;
  --ivory: #FFF8E7;
  --felt-green: #1F4D3A;
  --felt-dark: #163B2C;
  --felt-deep: #0E2A1F;
  --hayya-glow: #FFD700;
  --wood: #4a2f1c;
  --wood-light: #6b4427;
  --wood-shadow: #2a1810;

  --pace: 600ms;
  --pace-fast: 300ms;
  --pace-slow: 1200ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
  background: #0a0a0f;
  color: var(--ivory);
  direction: rtl;
}

button { font-family: inherit; cursor: pointer; border: none; }

@media (max-width: 900px) {
  .scene { grid-template-rows: clamp(160px, 20vh, 200px) 1fr clamp(180px, 22vh, 240px); }
  .bot-zone, .player-zone { grid-template-columns: 1fr; }
  .player-zone .profile-with-pile { justify-self: start; flex-direction: row; }
  .captures-pile { width: 64px; height: 88px; }
  .captures-pile .cp-stack { width: 56px; height: 78px; }
  .captures-pile .cp-count { font-size: 24px; }
  .felt { padding: 12px; }
}
@media (max-width: 600px) {
  .scene { grid-template-rows: 150px 1fr 200px; }
  .table-cards-grid { gap: 8px 10px; }
}

/* ============ SCENE ============ */
.scene {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: clamp(180px, 22vh, 240px) 1fr clamp(200px, 26vh, 280px);
  background: var(--bg-base, radial-gradient(ellipse at 50% 50%, #1a2a22 0%, #050807 90%));
  transition: background 600ms ease;
  container-type: inline-size;
}

/* === BACKGROUND THEMES === */
.scene[data-bg="midnight"] {
  --bg-base:
    radial-gradient(ellipse at 30% 20%, rgba(70,30,90,0.35) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(30,60,120,0.3) 0%, transparent 50%),
    linear-gradient(180deg, #0a0a1f 0%, #050510 100%);
}
.scene[data-bg="medina"] {
  --bg-base:
    radial-gradient(ellipse at 50% 100%, rgba(180,90,40,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 0%, rgba(40,30,20,0.5) 0%, transparent 60%),
    linear-gradient(180deg, #2a1810 0%, #1a0e08 50%, #0a0604 100%);
}
.scene[data-bg="medina"]::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0px, transparent 60px, rgba(201,169,97,0.025) 60px, rgba(201,169,97,0.025) 61px),
    repeating-linear-gradient(90deg, transparent 0px, transparent 60px, rgba(201,169,97,0.025) 60px, rgba(201,169,97,0.025) 61px);
  pointer-events: none;
  z-index: 1;
}
.scene[data-bg="desert"] {
  --bg-base:
    radial-gradient(ellipse at 50% 60%, rgba(255,180,80,0.25) 0%, transparent 50%),
    linear-gradient(180deg, #1a0a05 0%, #2a1a0a 30%, #4a2a10 60%, #1a0a05 100%);
}
.scene[data-bg="oasis"] {
  --bg-base:
    radial-gradient(ellipse at 50% 30%, rgba(80,140,100,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(40,80,60,0.4) 0%, transparent 50%),
    linear-gradient(180deg, #0a1a14 0%, #050a08 100%);
}
.scene[data-bg="velvet"] {
  --bg-base:
    radial-gradient(ellipse at 50% 50%, rgba(120,30,40,0.35) 0%, transparent 60%),
    linear-gradient(180deg, #1a0508 0%, #0a0204 100%);
}

/* dramatic spotlight overhead */
.scene::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 35%, rgba(255, 220, 150, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(0,0,0,0.5) 0%, transparent 70%),
    radial-gradient(ellipse 80% 70% at 50% 50%, transparent 40%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  z-index: 2;
}

/* ============ PROFILE + PILE LAYOUT ============ */
.profile-with-pile {
  display: flex;
  align-items: center;
  gap: 14px;
}
.bot-zone .profile-with-pile { justify-self: start; }
.player-zone .profile-with-pile { justify-self: end; flex-direction: row-reverse; }

/* ============ CAPTURES PILE (compact) ============ */
.captures-pile {
  position: relative;
  width: 80px;
  height: 110px;
  flex-shrink: 0;
}
.captures-pile .cp-stack {
  position: relative;
  width: 70px;
  height: 100px;
  margin: 0 auto;
}
.captures-pile .cp-shadow {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #8B2635 0%, #6a1a25 60%, #5a1419 100%);
  border: 1.5px solid rgba(201,169,97,0.6);
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}
.captures-pile .cp-top {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(20,12,8,0.95), rgba(10,6,4,0.98));
  border: 2px solid rgba(201,169,97,0.5);
  box-shadow: 0 6px 14px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,215,0,0.15);
  display: grid;
  place-items: center;
  z-index: 10;
  transform: translate(-2px, -2px);
}
.captures-pile .cp-count {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: #FFD700;
  line-height: 1;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.captures-pile .cp-count-label {
  position: absolute;
  bottom: 8px; left: 0; right: 0;
  text-align: center;
  font-family: 'Cairo', sans-serif;
  font-size: 9px;
  color: rgba(255,215,0,0.55);
  letter-spacing: 1px;
}
.captures-pile .cp-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(201,169,97,0.3);
  border-radius: 9px;
  font-family: 'Cairo', sans-serif;
  font-size: 11px;
  color: rgba(255,248,231,0.35);
}
.captures-pile .cp-hayya-pip {
  position: absolute;
  top: -8px; right: -8px;
  width: 24px; height: 24px;
  background: radial-gradient(circle, #dc283c, #8a0e1c);
  border: 2px solid #FFD700;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  z-index: 11;
  box-shadow: 0 0 12px rgba(220,40,60,0.7);
  animation: hayya-pulse 1.6s ease-in-out infinite;
}
@keyframes hayya-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(220,40,60,0.6); }
  50% { box-shadow: 0 0 20px rgba(220,40,60,0.95); }
}
.captures-pile .cp-label {
  position: absolute;
  bottom: -18px; left: 0; right: 0;
  text-align: center;
  font-family: 'Cairo', sans-serif;
  font-size: 10px;
  color: rgba(255,248,231,0.55);
  letter-spacing: 1px;
}
.captures-pile.last-capturer .cp-top {
  border-color: #FFD700;
  box-shadow: 0 0 18px rgba(255,215,0,0.45), 0 6px 14px rgba(0,0,0,0.55);
  animation: last-cap-glow 2s ease-in-out infinite;
}
@keyframes last-cap-glow {
  0%, 100% { box-shadow: 0 0 14px rgba(255,215,0,0.4), 0 6px 14px rgba(0,0,0,0.55); }
  50% { box-shadow: 0 0 22px rgba(255,215,0,0.7), 0 6px 14px rgba(0,0,0,0.55); }
}

.bot-zone-spacer { flex: 1; }

.bot-zone {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  align-items: center;
  padding: clamp(8px, 1.5vh, 16px) clamp(16px, 3vw, 32px) 0;
  gap: clamp(8px, 2vw, 24px);
}

.bot-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bot-avatar {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #f5d989 0%, #c9a961 45%, #8a6e2f 100%);
  box-shadow:
    0 0 0 3px rgba(201, 169, 97, 0.3),
    0 0 0 6px rgba(201, 169, 97, 0.15),
    0 8px 24px rgba(0,0,0,0.4),
    inset 0 -8px 16px rgba(0,0,0,0.25);
  display: grid;
  place-items: center;
  font-size: 38px;
  transition: transform var(--pace-fast) var(--ease-out);
}

.bot-avatar.thinking {
  animation: bot-think 1.4s ease-in-out infinite;
}
.bot-avatar.thinking::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--libyan-gold);
  animation: bot-pulse-ring 1.4s ease-out infinite;
}
.bot-avatar.thinking::after {
  content: '';
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  border: 2px solid var(--libyan-gold);
  opacity: 0;
  animation: bot-pulse-ring 1.4s ease-out 0.7s infinite;
}

.bot-avatar.acting {
  animation: bot-act 0.6s var(--ease-back);
}

@keyframes bot-think {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes bot-pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}
@keyframes bot-act {
  0% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(1.15) rotate(-6deg); }
  60% { transform: scale(1.08) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.bot-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bot-name {
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--libyan-gold);
}

.bot-status {
  font-size: 13px;
  color: rgba(255, 248, 231, 0.6);
  min-height: 18px;
}

/* speech bubble */
.bubble {
  position: absolute;
  top: 92px;
  right: 20px;
  background: linear-gradient(180deg, #fff8e7 0%, #f0e3c0 100%);
  color: var(--midnight);
  padding: 10px 16px;
  border-radius: 14px;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(201,169,97,0.4);
  opacity: 0;
  transform: translateY(-8px) scale(0.9);
  pointer-events: none;
  z-index: 10;
}
.bubble::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 28px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #fff8e7;
}
.bubble.show {
  animation: bubble-pop 2.4s var(--ease-back) forwards;
}
@keyframes bubble-pop {
  0% { opacity: 0; transform: translateY(-8px) scale(0.7); }
  10% { opacity: 1; transform: translateY(0) scale(1.05); }
  20% { transform: translateY(0) scale(1); }
  85% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

.bot-hand {
  display: flex;
  justify-content: center;
  perspective: 1200px;
  position: relative;
  height: clamp(140px, 16vh, 180px);
}

.score-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, rgba(20,30,25,0.8), rgba(10,15,12,0.9));
  border: 1px solid rgba(201, 169, 97, 0.3);
  border-radius: 18px;
  padding: 14px 22px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  justify-self: end;
}
.bot-zone .score-pill { justify-self: start; }
.score-pill .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,248,231,0.5);
}
.score-pill .num {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--libyan-gold);
  line-height: 1;
  font-feature-settings: "tnum";
  white-space: nowrap;
}
.score-pill .label { white-space: nowrap; }
.score-pill.flash .num {
  animation: score-flash 0.8s var(--ease-out);
}
@keyframes score-flash {
  0% { transform: scale(1); color: var(--libyan-gold); }
  40% { transform: scale(1.4); color: var(--libyan-gold-bright); text-shadow: 0 0 20px var(--libyan-gold-bright); }
  100% { transform: scale(1); color: var(--libyan-gold); }
}

/* ============ MIDDLE: TABLE ============ */
.table-zone {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  align-items: center;
  padding: 0 32px;
  gap: 24px;
}

.deck-column {
  justify-self: end;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}
.pile-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pile-label {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(201,169,97,0.7);
}
.pile-sub {
  font-family: 'Cairo', sans-serif;
  font-size: 10px;
  color: rgba(255,248,231,0.45);
}
.discard-stack {
  position: relative;
  width: 70px;
  height: 100px;
}
.discard-empty {
  position: absolute;
  inset: 0;
  border: 2px dashed rgba(201,169,97,0.25);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: 'Cairo', sans-serif;
  font-size: 11px;
  color: rgba(255,248,231,0.3);
}
.discard-card {
  position: absolute;
  inset: 0;
  transition: transform 0.4s cubic-bezier(0.22,1,0.36,1);
}
.discard-card .card.small {
  width: 70px;
  height: 100px;
}
.discard-counter {
  top: -10px;
  right: -10px;
  background: var(--midnight);
  border-color: #c9a961;
  color: #c9a961;
}

.deck-stack {
  justify-self: end;
  position: relative;
  width: 100px;
  height: 150px;
}
.deck-stack .deck-card {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background:
    linear-gradient(135deg, #8B2635 0%, #6a1a25 30%, #5a1419 60%, #7a2230 100%);
  border: 3px solid #c9a961;
  box-shadow:
    inset 0 0 0 1px rgba(255,215,0,0.3),
    inset 0 0 16px rgba(0,0,0,0.4),
    0 4px 12px rgba(0,0,0,0.35);
  overflow: hidden;
}
.deck-stack .deck-card::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1.5px solid rgba(201,169,97,0.7);
  border-radius: 6px;
  background-image:
    radial-gradient(ellipse at center, rgba(255,215,0,0.12), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 90'><g fill='none' stroke='%23d4b56a' stroke-width='0.7' opacity='0.85'><polygon points='30,8 52,30 30,52 8,30'/><polygon points='30,14 46,30 30,46 14,30'/><polygon points='30,20 40,30 30,40 20,30'/><circle cx='30' cy='30' r='2.5' fill='%23d4b56a'/><polygon points='30,38 52,60 30,82 8,60'/><polygon points='30,44 46,60 30,76 14,60'/><polygon points='30,50 40,60 30,70 20,60'/><circle cx='30' cy='60' r='2.5' fill='%23d4b56a'/></g><g fill='%23d4b56a' opacity='0.4'><circle cx='8' cy='8' r='1'/><circle cx='52' cy='8' r='1'/><circle cx='8' cy='82' r='1'/><circle cx='52' cy='82' r='1'/></g></svg>");
  background-size: 100% 100%;
  pointer-events: none;
}
.deck-stack .deck-card::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid rgba(255,215,0,0.6);
  background: radial-gradient(circle, rgba(255,215,0,0.35), transparent 70%);
  pointer-events: none;
}
/* When the deck empties, dim the counter — the stack itself is hidden via JS. */
.deck-stack.empty .deck-counter {
  background: rgba(40,30,15,0.45);
  border-color: rgba(201,169,97,0.25);
  color: rgba(255,248,231,0.4);
}
.deck-counter {
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--midnight);
  border: 2px solid var(--libyan-gold);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--libyan-gold);
  z-index: 5;
}

.captures-stack {
  justify-self: start;
  position: relative;
  width: 100px;
  height: 150px;
  margin-left: 220px;
}
.captures-stack .label {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(255,248,231,0.5);
  white-space: nowrap;
}

/* The felt table */
.felt {
  position: relative;
  height: clamp(280px, 36vh, 380px);
  border-radius: 28px;
  padding: clamp(14px, 2vw, 22px);
  background: var(--frame-bg,
    repeating-linear-gradient(90deg, #5a3820 0px, #6b4427 2px, #4a2f1c 4px, #5a3820 6px),
    linear-gradient(180deg, #6b4427 0%, #4a2f1c 100%));
  box-shadow:
    0 30px 60px rgba(0,0,0,0.6),
    0 0 0 1px rgba(0,0,0,0.4),
    inset 0 0 0 2px rgba(201,169,97,0.15);
  transition: background 500ms ease;
}

/* === TABLE THEMES === */
.felt[data-table="walnut"] {
  --frame-bg:
    repeating-linear-gradient(90deg, #5a3820 0px, #6b4427 2px, #4a2f1c 4px, #5a3820 6px),
    linear-gradient(180deg, #6b4427 0%, #4a2f1c 100%);
  --felt-c1: #1a4a30;
  --felt-c2: #0e3520;
  --felt-c3: #051a10;
}
.felt[data-table="ebony"] {
  --frame-bg:
    repeating-linear-gradient(90deg, #1a1410 0px, #2a1f18 2px, #14100a 4px, #1a1410 6px),
    linear-gradient(180deg, #2a1f18 0%, #0a0805 100%);
  --felt-c1: #2a1018;
  --felt-c2: #15080c;
  --felt-c3: #080306;
}
.felt[data-table="royal-blue"] {
  --frame-bg:
    linear-gradient(135deg, #2a1a08 0%, #4a3010 50%, #2a1a08 100%);
  --felt-c1: #1a3a6e;
  --felt-c2: #0e2548;
  --felt-c3: #050f25;
}
.felt[data-table="oasis-emerald"] {
  --frame-bg:
    linear-gradient(180deg, #5a4020 0%, #3a2810 50%, #5a4020 100%);
  --felt-c1: #0e6e4e;
  --felt-c2: #084230;
  --felt-c3: #021a14;
}
.felt[data-table="ruby"] {
  --frame-bg:
    linear-gradient(180deg, #1a0a08 0%, #3a1410 100%);
  --felt-c1: #6e1a28;
  --felt-c2: #4a0e18;
  --felt-c3: #1a0408;
}
.felt[data-table="sand"] {
  --frame-bg:
    linear-gradient(180deg, #2a1a08 0%, #4a2a14 100%);
  --felt-c1: #8a6028;
  --felt-c2: #5a4018;
  --felt-c3: #2a1f08;
}

/* zellij corners */
.felt::before, .felt::after {
  content: '';
  position: absolute;
  width: 56px;
  height: 56px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'><g fill='none' stroke='%23c9a961' stroke-width='1.2' opacity='0.7'><polygon points='28,4 52,28 28,52 4,28'/><polygon points='28,12 44,28 28,44 12,28'/><circle cx='28' cy='28' r='4'/><line x1='28' y1='4' x2='28' y2='52'/><line x1='4' y1='28' x2='52' y2='28'/></g></svg>");
  pointer-events: none;
  z-index: 4;
}
.felt::before { top: 6px; right: 6px; }
.felt::after { bottom: 6px; left: 6px; }

.felt-inner {
  position: relative;
  height: 100%;
  border-radius: 14px;
  background:
    radial-gradient(ellipse 60% 80% at 50% 35%, rgba(255, 230, 160, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at center, var(--felt-c1, var(--felt-green)) 0%, var(--felt-c2, var(--felt-dark)) 60%, var(--felt-c3, var(--felt-deep)) 100%);
  box-shadow:
    inset 0 8px 24px rgba(0,0,0,0.6),
    inset 0 -4px 16px rgba(0,0,0,0.4),
    inset 0 0 0 2px rgba(201,169,97,0.25);
  overflow: hidden;
  transition: background 500ms ease;
}

.felt-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'><g fill='none' stroke='%23ffffff' stroke-width='0.4' opacity='0.06'><circle cx='100' cy='100' r='90'/><circle cx='100' cy='100' r='60'/><circle cx='100' cy='100' r='30'/><polygon points='100,10 190,100 100,190 10,100'/></g></svg>");
  background-size: 180px 180px;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  opacity: 0.5;
}

.table-cards {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.table-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 14px 18px;
  padding: 16px;
}

/* ============ BOTTOM: PLAYER ZONE ============ */
.player-zone {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  align-items: end;
  padding: 0 clamp(16px, 3vw, 32px) clamp(12px, 2vh, 24px);
  gap: clamp(8px, 2vw, 24px);
}

.player-hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  perspective: 1200px;
  position: relative;
  height: clamp(160px, 18vh, 200px);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 16px;
  align-self: end;
  padding-bottom: 10px;
}
.player-info.right { flex-direction: row-reverse; }

.player-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #6fa6d9 0%, #1B4965 60%, #0d2a3d 100%);
  box-shadow:
    0 0 0 2px rgba(27, 73, 101, 0.4),
    0 6px 16px rgba(0,0,0,0.4);
  display: grid;
  place-items: center;
  font-size: 28px;
  flex-shrink: 0;
}
.player-avatar.acting { animation: bot-act 0.6s var(--ease-back); }

.player-name {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ivory);
}
.player-turn-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--libyan-gold);
  margin-left: 6px;
  box-shadow: 0 0 10px var(--libyan-gold);
  animation: turn-pulse 1.2s ease-in-out infinite;
}
@keyframes turn-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}
.player-info.dim .player-turn-dot { display: none; }
.player-info.dim { opacity: 0.55; }

/* ============ CARDS ============ */
.card {
  width: clamp(74px, 6.4vw, 96px);
  height: clamp(112px, 9.6vw, 144px);
  border-radius: 10px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--pace-fast) var(--ease-out),
              box-shadow var(--pace-fast) var(--ease-out),
              filter var(--pace-fast) ease;
  user-select: none;
  flex-shrink: 0;
  background: transparent;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: default;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 30%, rgba(255,255,255,0) 70%, rgba(0,0,0,0.10) 100%);
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: overlay;
}
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  pointer-events: none;
  z-index: 4;
}
.card.small { width: 72px; height: 108px; }
.card.tiny { width: 56px; height: 84px; }

.card-face, .card-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
}

.card-back {
  background:
    linear-gradient(135deg, #8B2635 0%, #6a1a25 30%, #5a1419 60%, #7a2230 100%);
  border: 3px solid #c9a961;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,215,0,0.3), inset 0 0 16px rgba(0,0,0,0.4);
}
.card-back::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1.5px solid rgba(201,169,97,0.7);
  border-radius: 6px;
  background-image:
    radial-gradient(ellipse at center, rgba(255,215,0,0.12), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 90'><g fill='none' stroke='%23d4b56a' stroke-width='0.7' opacity='0.85'><polygon points='30,8 52,30 30,52 8,30'/><polygon points='30,14 46,30 30,46 14,30'/><polygon points='30,20 40,30 30,40 20,30'/><circle cx='30' cy='30' r='2.5' fill='%23d4b56a'/><polygon points='30,38 52,60 30,82 8,60'/><polygon points='30,44 46,60 30,76 14,60'/><polygon points='30,50 40,60 30,70 20,60'/><circle cx='30' cy='60' r='2.5' fill='%23d4b56a'/></g><g fill='%23d4b56a' opacity='0.4'><circle cx='8' cy='8' r='1'/><circle cx='52' cy='8' r='1'/><circle cx='8' cy='82' r='1'/><circle cx='52' cy='82' r='1'/></g></svg>");
  background-size: 100% 100%;
}
.card-back::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid rgba(255,215,0,0.6);
  background: radial-gradient(circle, rgba(255,215,0,0.35), transparent 70%);
}

.card.flipped .card-face { transform: rotateY(180deg); }
.card.flipped .card-back { transform: rotateY(0deg); }

/* card hover/select */
.player-hand .card.hand-card {
  cursor: pointer;
  transition: transform 0.35s var(--ease-out),
              box-shadow 0.35s var(--ease-out),
              filter 0.35s ease;
}
.player-hand .card.hand-card:hover {
  transform: var(--fan-transform) translateY(-30px) rotateX(8deg) scale(1.08) !important;
  box-shadow: 0 8px 18px rgba(0,0,0,0.22), 0 0 30px rgba(201,169,97,0.3);
  z-index: 100 !important;
}
.player-hand .card.hand-card.selected {
  transform: var(--fan-transform) translateY(-50px) rotateX(0deg) scale(1.12) !important;
  box-shadow: 0 10px 22px rgba(0,0,0,0.25), 0 0 40px var(--libyan-gold-bright);
  z-index: 200 !important;
  animation: selected-glow 1.6s ease-in-out infinite;
}
@keyframes selected-glow {
  0%, 100% { box-shadow: 0 10px 22px rgba(0,0,0,0.25), 0 0 30px var(--libyan-gold); }
  50% { box-shadow: 0 10px 22px rgba(0,0,0,0.25), 0 0 50px var(--libyan-gold-bright); }
}

.card.disabled { filter: grayscale(0.7); opacity: 0.5; pointer-events: none; }

/* table card capture-candidate highlight */
.card.capture-candidate {
  animation: capture-pulse 1.4s ease-in-out infinite;
  cursor: pointer;
}
.card.capture-candidate:hover {
  transform: translateY(-10px) scale(1.06) !important;
  z-index: 50;
}
@keyframes capture-pulse {
  0%, 100% { box-shadow: 0 6px 16px rgba(0,0,0,0.4), 0 0 0 2px var(--libyan-gold), 0 0 16px rgba(201,169,97,0.4); }
  50% { box-shadow: 0 6px 16px rgba(0,0,0,0.4), 0 0 0 3px var(--libyan-gold-bright), 0 0 30px rgba(255,215,0,0.7); }
}

.card.capture-selected {
  box-shadow: 0 6px 16px rgba(0,0,0,0.4), 0 0 0 3px var(--libyan-gold-bright), 0 0 40px var(--libyan-gold-bright) !important;
  transform: translateY(-12px) scale(1.08) !important;
}

/* HAYYA permanent glow */
.card.is-hayya .card-face {
  box-shadow: inset 0 0 30px rgba(255, 215, 0, 0.5);
}
.card.is-hayya {
  box-shadow: 0 6px 16px rgba(0,0,0,0.4), 0 0 20px rgba(255,215,0,0.4) !important;
  animation: hayya-idle 3s ease-in-out infinite;
}
@keyframes hayya-idle {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.1) saturate(1.15) drop-shadow(0 0 12px rgba(255,215,0,0.5)); }
}

/* ============ FLY-CARD ANIMATION ============ */
.fly-card {
  position: fixed;
  z-index: 500;
  pointer-events: none;
  width: 96px;
  height: 144px;
  border-radius: 10px;
  transition: transform var(--pace) var(--ease-out),
              opacity var(--pace) var(--ease-out);
  will-change: transform, opacity;
}

/* trail behind a flying card */
.fly-card .trail {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255,215,0,0.5) 0%, transparent 70%);
  filter: blur(8px);
  opacity: 0;
  animation: trail-fade 0.8s ease-out;
}
@keyframes trail-fade {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.6); }
}

/* ============ BIG BANNER ============ */
.banner {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  z-index: 800;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 120px;
  font-weight: 800;
  color: var(--libyan-gold-bright);
  text-shadow:
    0 0 30px var(--libyan-gold-bright),
    0 0 60px var(--libyan-gold),
    0 6px 0 #5a3a00,
    0 12px 30px rgba(0,0,0,0.8);
  letter-spacing: 4px;
  pointer-events: none;
  opacity: 0;
}
.banner.show { animation: banner-pop 2.2s var(--ease-back) forwards; }
.banner.opponent { color: var(--terracotta); text-shadow: 0 0 30px var(--terracotta), 0 0 60px var(--phoenician-red), 0 6px 0 #3a0e15, 0 12px 30px rgba(0,0,0,0.8); }
@keyframes banner-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-8deg); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); }
  35% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2) rotate(0deg); }
}

/* ============ SCREEN FLASH ============ */
.screen-flash {
  position: fixed;
  inset: 0;
  z-index: 700;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255,215,0,0.4) 0%, transparent 60%);
  opacity: 0;
}
.screen-flash.fire { background: radial-gradient(ellipse at center, rgba(200,50,50,0.5) 0%, transparent 60%); }
.screen-flash.show { animation: flash 0.6s ease-out; }
@keyframes flash {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

/* ============ SHAKE ============ */
.shake { animation: shake 0.5s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-12px) translateY(4px); }
  20% { transform: translateX(10px) translateY(-3px); }
  30% { transform: translateX(-8px) translateY(2px); }
  40% { transform: translateX(7px); }
  50% { transform: translateX(-5px); }
  60% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
  80% { transform: translateX(1px); }
}

/* ============ HAYYA SNAKE OVERLAY ============ */
.snake-overlay {
  position: fixed;
  inset: 0;
  z-index: 750;
  pointer-events: none;
  display: grid;
  place-items: center;
  opacity: 0;
}
.snake-overlay.show { animation: snake-show 3s ease-out; }
@keyframes snake-show {
  0% { opacity: 0; }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}
.snake-overlay svg {
  width: 480px;
  height: 480px;
  filter: drop-shadow(0 0 30px rgba(255,215,0,0.8)) drop-shadow(0 0 60px rgba(255,180,0,0.5));
}
.snake-overlay .snake-path {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: snake-draw 2.4s var(--ease-out) forwards;
}
@keyframes snake-draw {
  0% { stroke-dashoffset: 1200; }
  60% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}

.whisper {
  position: fixed;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 760;
  font-family: 'Amiri', 'Reem Kufi', serif;
  font-style: italic;
  font-size: 28px;
  color: rgba(255, 215, 0, 0.9);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
  letter-spacing: 8px;
  opacity: 0;
  pointer-events: none;
}
.whisper.show { animation: whisper-rise 3s ease-out; }
@keyframes whisper-rise {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px); letter-spacing: 4px; }
  30% { opacity: 1; letter-spacing: 12px; }
  70% { opacity: 1; letter-spacing: 14px; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); letter-spacing: 18px; }
}

/* ============ SHAKKBA WAVE ============ */
.gold-wave {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  border-radius: 14px;
  overflow: hidden;
  opacity: 0;
}
.gold-wave.show { animation: wave-show 1.8s ease-out; }
@keyframes wave-show {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}
.gold-wave::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -100%;
  width: 60%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,215,0,0.4) 30%,
    rgba(255,255,200,0.95) 50%,
    rgba(255,215,0,0.4) 70%,
    transparent 100%);
  filter: blur(2px);
  animation: wave-sweep 1.8s var(--ease-out);
}
@keyframes wave-sweep {
  0% { left: -100%; }
  100% { left: 110%; }
}

/* particles */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 720;
}
.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--libyan-gold-bright);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--libyan-gold-bright);
}

/* ============ TWEAKS / TRIGGER PANEL ============ */
.trigger-panel {
  position: fixed;
  top: 60px;
  left: 16px;
  z-index: 900;
  background: rgba(15, 20, 18, 0.92);
  border: 1px solid rgba(201, 169, 97, 0.3);
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 200px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}
.trigger-panel.collapsed {
  transform: translateX(calc(-100% + 36px));
}
.trigger-panel .toggle-btn {
  position: absolute;
  top: 12px;
  right: -2px;
  background: var(--libyan-gold);
  color: var(--midnight);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.trigger-panel h4 {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 13px;
  color: var(--libyan-gold);
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.trigger-btn {
  background: linear-gradient(180deg, rgba(201,169,97,0.15), rgba(201,169,97,0.05));
  border: 1px solid rgba(201,169,97,0.3);
  color: var(--ivory);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  text-align: right;
  font-family: 'Cairo', sans-serif;
  transition: all 0.2s ease;
}
.trigger-btn:hover {
  background: linear-gradient(180deg, rgba(201,169,97,0.3), rgba(201,169,97,0.15));
  border-color: var(--libyan-gold);
  transform: translateX(-2px);
}
.trigger-btn .ico { margin-left: 6px; }

/* turn indicator badge */
.turn-badge {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  background: rgba(15, 20, 18, 0.85);
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 30px;
  padding: 8px 24px;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 14px;
  color: var(--libyan-gold);
  backdrop-filter: blur(8px);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}
.turn-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--libyan-gold);
  box-shadow: 0 0 8px var(--libyan-gold);
  animation: turn-pulse 1.2s ease-in-out infinite;
}

/* arrow indicator from bot to chosen card */
.bot-arrow {
  position: fixed;
  z-index: 450;
  pointer-events: none;
  opacity: 0;
}
.bot-arrow.show { animation: arrow-show 1.6s ease-out; }
@keyframes arrow-show {
  0% { opacity: 0; transform: scale(0.6); }
  20% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1); }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ POINTS DISPLAY MODES ============ */
/* The host picks one of three modes when creating the table. Engine state
   includes rules.points_display; game.js mirrors it onto the scene as
   data-points. CSS hides the appropriate UI bits below — JS no longer
   needs to per-element toggle because mode changes via re-render. */

/* "total_only": no breakdown chips on any profile, but score numbers
   stay visible. */
.scene[data-points="total_only"] .breakdown-chips,
.scene[data-points="hidden"] .breakdown-chips { display: none !important; }

/* "hidden": no score block at all on any profile, no team scoreline. The
   round-end modal is the only place totals are revealed. */
.scene[data-points="hidden"] .player-score-row,
.scene[data-points="hidden"] .bot-score-row,
.scene[data-points="hidden"] .side-score-row { display: none !important; }
.scene[data-points="hidden"] .captures-pile,
.scene[data-points="hidden"] .side-pile { display: none !important; }
/* Hide the deck-side card-count too — it's effectively a score peek. */
.scene[data-points="hidden"] .deck-counter { display: none !important; }

/* ============ TEAM 2v2 — side opponents (left + right) ============ */
/* Hidden by default; the scene flips data-mode="team_2v2" via game.js to
   reveal them. The bot-zone (top) becomes the partner in 2v2 mode. */
.side-zone { display: none; }

.scene[data-mode="team_2v2"] .side-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: fixed;
  z-index: 4;
  pointer-events: none;
}
.scene[data-mode="team_2v2"] .side-zone-left {
  left: clamp(6px, 1.6vw, 18px);
  top: 50%;
  transform: translateY(-50%);
}
.scene[data-mode="team_2v2"] .side-zone-right {
  right: clamp(6px, 1.6vw, 18px);
  top: 50%;
  transform: translateY(-50%);
}

.side-profile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(20,30,25,0.85), rgba(10,15,12,0.92));
  border: 1px solid rgba(201, 169, 97, 0.3);
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  min-width: 110px;
}
.side-profile.active {
  border-color: var(--libyan-gold-bright);
  box-shadow: 0 6px 22px rgba(255,215,0,0.35);
}
.side-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f5d989 0%, #c9a961 45%, #8a6e2f 100%);
  display: grid;
  place-items: center;
  color: #1A1A2E;
  font-weight: 800;
  font-size: 14px;
  font-family: 'Reem Kufi', sans-serif;
  box-shadow: 0 0 0 2px rgba(201,169,97,0.3);
}
.side-name {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 13px;
  color: var(--libyan-gold);
  text-align: center;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-score-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: 'Reem Kufi', sans-serif;
}
.side-score-row .num {
  font-size: 18px;
  font-weight: 700;
  color: var(--libyan-gold);
  font-feature-settings: "tnum";
}
.side-score-row .num-label {
  font-size: 9px;
  color: rgba(255,248,231,0.45);
}
.side-hand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}
.side-hand .card {
  width: 44px !important;
  height: 66px !important;
  margin-top: -28px;
}
.side-hand .card:first-child { margin-top: 0; }
.side-pile {
  margin-top: 6px;
  width: 56px !important;
  height: 78px !important;
}
.side-pile .cp-stack {
  width: 50px !important;
  height: 70px !important;
}
.side-pile .cp-count { font-size: 18px !important; }
.side-pile .cp-label { font-size: 9px !important; bottom: -14px !important; }

/* Team 2v2 — partner up top instead of "البوت". The label is set by JS. */
.scene[data-mode="team_2v2"] #bot-profile-pile .cp-label { color: rgba(201,169,97,0.7); }

/* Team 2v2 — all 4 profile boxes use the SAME compact dimensions + layout
   so the table reads as four equals around the felt instead of "you + bot
   + two small side guys". The captures-pile next to each profile is also
   shrunk to match the .side-pile next to side opponents. */
.scene[data-mode="team_2v2"] .profile-card {
  min-width: 0;
  padding: 6px 10px;
  gap: 8px;
  border-radius: 12px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.scene[data-mode="team_2v2"] .profile-card .player-avatar,
.scene[data-mode="team_2v2"] .profile-card .bot-avatar {
  width: 48px;
  height: 48px;
  font-size: 14px;
  font-weight: 800;
  font-family: 'Reem Kufi', sans-serif;
}
.scene[data-mode="team_2v2"] .profile-card .player-info,
.scene[data-mode="team_2v2"] .profile-card .bot-info {
  align-items: center;
  text-align: center;
}
.scene[data-mode="team_2v2"] .profile-card .player-name,
.scene[data-mode="team_2v2"] .bot-name {
  font-size: 13px;
}
.scene[data-mode="team_2v2"] .profile-card .num {
  font-size: 18px;
}
.scene[data-mode="team_2v2"] .bot-status { display: none; }
/* Note: breakdown-chips visibility in team_2v2 follows points_display (the
   data-points attribute on the scene). The host picks which level of
   detail to show — see "POINTS DISPLAY MODES" near the bottom. */

/* Shrink the captures-pile on bottom + top to match the side-pile size. */
.scene[data-mode="team_2v2"] #player-captures-pile,
.scene[data-mode="team_2v2"] #bot-captures-pile {
  width: 56px;
  height: 78px;
}
.scene[data-mode="team_2v2"] #player-captures-pile .cp-stack,
.scene[data-mode="team_2v2"] #bot-captures-pile .cp-stack {
  width: 50px;
  height: 70px;
}
.scene[data-mode="team_2v2"] #player-captures-pile .cp-count,
.scene[data-mode="team_2v2"] #bot-captures-pile .cp-count { font-size: 18px; }

/* Bottom + top zones become single-column compact layouts. The bot-zone
   already has a bot-hand area; we keep that but stop it from forcing a
   tall row. */
.scene[data-mode="team_2v2"] .bot-zone,
.scene[data-mode="team_2v2"] .player-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
}
.scene[data-mode="team_2v2"] .bot-zone .profile-with-pile,
.scene[data-mode="team_2v2"] .player-zone .profile-with-pile {
  justify-self: center;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}
.scene[data-mode="team_2v2"] .bot-hand,
.scene[data-mode="team_2v2"] .player-hand {
  height: auto;
  min-height: 0;
}

/* Keep the side-zone profile in lock-step with the bottom/top compact
   profile — same avatar size, same score-row sizing, same border-radius. */
.scene[data-mode="team_2v2"] .side-profile {
  padding: 6px 10px;
  border-radius: 12px;
  min-width: 0;
}
.scene[data-mode="team_2v2"] .side-avatar {
  width: 48px;
  height: 48px;
  font-size: 14px;
}
.scene[data-mode="team_2v2"] .side-name {
  font-size: 13px;
}
.scene[data-mode="team_2v2"] .side-score-row .num {
  font-size: 18px;
}

/* Team scoreline pinned to the top of the felt — visible only in team mode. */
.team-scoreline {
  position: fixed;
  top: clamp(6px, 1.5vh, 14px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(20,30,25,0.9), rgba(10,15,12,0.95));
  border: 1.5px solid rgba(201, 169, 97, 0.4);
  border-radius: 999px;
  padding: 6px 14px;
  z-index: 50;
  font-family: 'Reem Kufi', sans-serif;
  box-shadow: 0 8px 24px rgba(0,0,0,0.55);
  pointer-events: none;
}
.team-scoreline[hidden] { display: none; }
.team-pill { display: flex; align-items: center; gap: 6px; }
.team-pill-label { font-size: 12px; color: rgba(255,248,231,0.7); }
.team-pill-score {
  font-size: 18px;
  font-weight: 800;
  font-feature-settings: "tnum";
}
.team-pill.team-a .team-pill-score { color: var(--libyan-gold-bright); }
.team-pill.team-b .team-pill-score { color: #ff8a96; }
.team-vs { color: rgba(255,248,231,0.45); font-size: 14px; }

/* In team_2v2 mode, push the table-cards-grid inward so it doesn't overlap
   the side zones on narrow screens. The deck-column floats out of the grid
   (position:fixed below) — switch table-zone to flex so the felt is the
   only flow child and stays centered. */
.scene[data-mode="team_2v2"] .table-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(140px, 16vw, 200px);
}
.scene[data-mode="team_2v2"] .table-zone > div:empty {
  display: none;
}

/* In team_2v2 the deck "follows" the dealer — it should sit right in front
   of whoever has the kartah. We pull deck-column out of the grid and float
   it absolutely, then snap it to one of four anchor positions based on
   data-dealer. The smooth transition makes the deck visibly slide as the
   kartah rotates between rounds. */
.scene[data-mode="team_2v2"] .deck-column {
  position: fixed;
  z-index: 5;
  transition: top 420ms cubic-bezier(0.65, 0, 0.35, 1),
              right 420ms cubic-bezier(0.65, 0, 0.35, 1),
              left  420ms cubic-bezier(0.65, 0, 0.35, 1),
              bottom 420ms cubic-bezier(0.65, 0, 0.35, 1),
              transform 420ms cubic-bezier(0.65, 0, 0.35, 1);
  pointer-events: none;
}
.scene[data-mode="team_2v2"][data-dealer="player"] .deck-column {
  bottom: clamp(180px, 22vh, 240px);
  left: 50%;
  transform: translateX(-50%);
  top: auto; right: auto;
}
.scene[data-mode="team_2v2"][data-dealer="partner"] .deck-column {
  top: clamp(180px, 22vh, 240px);
  left: 50%;
  transform: translateX(-50%);
  bottom: auto; right: auto;
}
.scene[data-mode="team_2v2"][data-dealer="right"] .deck-column {
  right: clamp(140px, 14vw, 180px);
  top: 50%;
  transform: translateY(-50%);
  bottom: auto; left: auto;
}
.scene[data-mode="team_2v2"][data-dealer="left"] .deck-column {
  left: clamp(140px, 14vw, 180px);
  top: 50%;
  transform: translateY(-50%);
  bottom: auto; right: auto;
}
/* While data-dealer hasn't been set yet (e.g. game-end view), keep the
   deck visually parked on the right edge — same default as 1v1. */
.scene[data-mode="team_2v2"]:not([data-dealer]) .deck-column {
  right: clamp(140px, 14vw, 180px);
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 720px) {
  .scene[data-mode="team_2v2"] .side-zone-left,
  .scene[data-mode="team_2v2"] .side-zone-right {
    /* On tiny viewports, scale the side zones down so they fit alongside
       the felt without overlapping. */
    transform: translateY(-50%) scale(0.78);
    transform-origin: left center;
  }
  .scene[data-mode="team_2v2"] .side-zone-right { transform-origin: right center; }
  .scene[data-mode="team_2v2"] .table-zone {
    padding: 0 60px;  /* leave room for the side zones */
  }
  /* Mobile-sized deck — still visible, still snaps to the dealer's side,
     just smaller so it doesn't overlap the felt. */
  .scene[data-mode="team_2v2"] .deck-column {
    transform: scale(0.7);
    transform-origin: center;
  }
  .scene[data-mode="team_2v2"][data-dealer="player"] .deck-column {
    bottom: clamp(120px, 18vh, 180px);
    transform: translateX(-50%) scale(0.7);
  }
  .scene[data-mode="team_2v2"][data-dealer="partner"] .deck-column {
    top: clamp(120px, 18vh, 180px);
    transform: translateX(-50%) scale(0.7);
  }
  .scene[data-mode="team_2v2"][data-dealer="right"] .deck-column {
    right: clamp(60px, 14vw, 80px);
    transform: translateY(-50%) scale(0.7);
  }
  .scene[data-mode="team_2v2"][data-dealer="left"] .deck-column {
    left: clamp(60px, 14vw, 80px);
    transform: translateY(-50%) scale(0.7);
  }
}
