/* ========================================================
   🧋 XÌ DÁCH TRÂN CHÂU - MINIGAME TIỆM TÀ TỮA
   Chủ quán làm Chủ Quầy - So tài đếm trân châu cùng khách quen quán trà
   ======================================================== */

.xidach-modal {
  position: fixed;
  inset: 0;
  background: rgba(18, 12, 10, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 10px;
  overflow-y: auto;
}

.xidach-modal[hidden] {
  display: none !important;
}

.xd-card-container {
  background: #1b382b;
  background: radial-gradient(circle at 50% 35%, #24523b 0%, #133022 70%, #0c2016 100%);
  border: 4px solid #d4af37;
  border-radius: 28px;
  box-shadow: 0 16px 45px rgba(0,0,0,0.5), inset 0 0 30px rgba(0,0,0,0.4);
  max-width: 580px;
  width: 100%;
  padding: 16px 14px;
  box-sizing: border-box;
  font-family: inherit;
  color: #fff;
  position: relative;
  animation: xdPop 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes xdPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Header */
.xd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed rgba(212, 175, 55, 0.4);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.xd-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #f7d56b;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.xd-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.xd-btn-sm {
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(212, 175, 55, 0.6);
  border-radius: 18px;
  color: #fff;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.xd-btn-sm:hover {
  background: #d4af37;
  color: #1a2016;
}

.xd-close-btn {
  background: #fdf3e4;
  border: 2px solid #8a5a3b;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7a5a48;
  font-weight: 800;
  transition: all 0.15s;
}
.xd-close-btn:hover {
  background: #ef6f8e;
  color: #fff;
  border-color: #ef6f8e;
}

/* Wallet bar */
.xd-wallet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1b382b;
  background: radial-gradient(circle at 50% 35%, #24523b 0%, #133022 70%, #0c2016 100%);
  border: 2px solid #d4af37;
  border-radius: 14px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 12px;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.3);
}
.xd-wallet-bar span:first-child {
  color: #f7d56b;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.xd-wallet-bar .xd-money {
  color: #fbbf24;
  font-size: 1.15rem;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* Sân chơi Xì Dách */
.xd-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Khu vực Nhà Con (Khách hàng) */
.xd-players-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 8px 6px;
}

.xd-player-seat {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  transition: all 0.2s;
}
.xd-player-seat.active-turn {
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.12);
}
.xd-player-seat.settled-win {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
}
.xd-player-seat.settled-lose {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.15);
}

.xd-p-info {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.xd-p-avatar {
  font-size: 1.4rem;
  line-height: 1;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.xd-p-name-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.2;
}
.xd-p-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xd-p-bet {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fcd34d;
}

/* Các thẻ trân châu */
.xd-cards-hand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: -14px;
  min-height: 58px;
  padding: 2px 0;
}

.xd-card {
  width: 36px;
  height: 52px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #c4b5a5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 4px;
  box-sizing: border-box;
  font-weight: 800;
  font-size: 0.8rem;
  line-height: 1;
  user-select: none;
  margin-left: -12px;
  transition: transform 0.15s;
}
.xd-card:first-child {
  margin-left: 0;
}
.xd-card:hover {
  transform: translateY(-4px);
  z-index: 5;
}
.xd-card.tc-den {
  color: #451a03;
  border-color: #d6bc9f;
}
.xd-card.tc-vang {
  color: #b45309;
  border-color: #fde047;
}
.xd-card.tc-trang {
  color: #0369a1;
  border-color: #bae6fd;
}
.xd-card.tc-dau {
  color: #e11d48;
  border-color: #fecdd3;
}
.xd-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  line-height: 1;
}
.xd-card-val {
  font-size: 0.75rem;
  font-weight: 900;
}
.xd-card-mini-suit {
  font-size: 0.55rem;
  line-height: 1;
}
.xd-card-suit {
  font-size: 0.95rem;
  align-self: center;
  line-height: 1;
  margin: 1px 0;
}
.xd-card-bottom {
  display: flex;
  justify-content: flex-end;
  line-height: 1;
  transform: rotate(180deg);
}

/* Thẻ trân châu úp */
.xd-card.face-down {
  background: linear-gradient(135deg, #78350f 0%, #451a03 100%) !important;
  border: 1.5px solid #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fef3c7;
  font-size: 1.1rem;
}
.xd-card.face-down::after {
  content: '🧋';
  font-size: 1.1rem;
}

/* Trạng thái & Điểm số của Khách Hàng */
.xd-p-status {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(0,0,0,0.4);
  color: #e2e8f0;
  text-align: center;
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.xd-p-status.win {
  background: #166534;
  color: #86efac;
}
.xd-p-status.lose {
  background: #991b1b;
  color: #fca5a5;
}
.xd-p-status.draw {
  background: #475569;
  color: #cbd5e1;
}

.xd-p-xet-btn {
  background: #f59e0b;
  color: #1a1a1a;
  border: none;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.xd-p-xet-btn:hover {
  background: #fbbf24;
  transform: scale(1.05);
}
.xd-p-xet-btn:disabled {
  background: #64748b;
  color: #cbd5e1;
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Khu vực Nhà Cái (Chủ quán) */
.xd-dealer-area {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #d4af37;
  border-radius: 20px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.2);
}

.xd-dealer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.xd-dealer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fde047;
}

.xd-dealer-score-badge {
  background: #b45309;
  color: #fef08a;
  padding: 3px 12px;
  border-radius: 20px;
  font-weight: 900;
  font-size: 0.95rem;
  border: 1.5px solid #fde047;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.xd-dealer-score-badge.quac {
  background: #991b1b;
  color: #fee2e2;
  border-color: #f87171;
}
.xd-dealer-score-badge.xidach {
  background: #15803d;
  color: #bbf7d0;
  border-color: #4ade80;
}

.xd-dealer-cards-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 64px;
}
.xd-dealer-cards-wrap .xd-card {
  width: 44px;
  height: 62px;
  font-size: 0.95rem;
  margin-left: -14px;
  border-radius: 8px;
}
.xd-dealer-cards-wrap .xd-card:first-child {
  margin-left: 0;
}

/* Nút hành động Nhà Cái */
.xd-action-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.xd-btn {
  padding: 8px 16px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  gap: 6px;
}
.xd-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.xd-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.xd-btn-hit {
  background: #3b82f6;
  color: #fff;
}
.xd-btn-stand {
  background: #64748b;
  color: #fff;
}
.xd-btn-xet-all {
  background: #eab308;
  color: #1a1a1a;
}
.xd-btn-new-round {
  background: #22c55e;
  color: #fff;
  font-size: 1rem;
  padding: 10px 24px;
}

/* Thanh thông báo kết quả */
.xd-result-banner {
  background: rgba(0, 0, 0, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 8px 12px;
  text-align: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #f1f5f9;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal Luật chơi */
.xd-rules-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 12, 0.95);
  border-radius: 24px;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.xd-rules-overlay h3 {
  color: #fbbf24;
  margin: 0;
  font-size: 1.15rem;
  text-align: center;
}
.xd-rules-list {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.xd-rules-list b {
  color: #fde047;
}

/* Nút Xì Dách trên giao diện chính (cạnh Bầu Cua) */
#xdBtn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: #f0fdf4;
  border-color: #86efac;
  font-size: 1.15rem;
  cursor: pointer;
  animation: xdPulseBtn 2.2s infinite ease-in-out;
}
#xdBtn:hover {
  background: #dcfce7;
}

@keyframes xdPulseBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); box-shadow: 0 0 10px rgba(74, 222, 128, 0.6); }
}

/* ===== ĐOÀN KIỂM TRA VỆ SINH AN TOÀN THỰC PHẨM & BIÊN BẢN NHẮC NHỞ ===== */
.police-raid-overlay {
  position: absolute;
  inset: 0;
  background: rgba(18, 12, 10, 0.95);
  border-radius: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  box-sizing: border-box;
  text-align: center;
  animation: xdRaidFlash 0.6s infinite alternate;
}

@keyframes xdRaidFlash {
  0% { box-shadow: inset 0 0 30px rgba(239, 68, 68, 0.6); }
  100% { box-shadow: inset 0 0 70px rgba(239, 68, 68, 0.95); }
}

.police-badge-icon {
  font-size: 3rem;
  margin-bottom: 8px;
  animation: policePulse 0.5s infinite alternate;
}

.police-title {
  color: #ff5252 !important;
  font-size: 1.25rem !important;
  font-weight: 900 !important;
  margin: 0 0 10px !important;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  line-height: 1.25;
}

.police-sub {
  color: #fef08a !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  margin-bottom: 16px !important;
  line-height: 1.4;
  max-width: 420px;
}

.police-timer-bar-wrap {
  width: 100%;
  max-width: 320px;
  height: 14px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.4);
}

.police-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f59e0b);
  border-radius: 8px;
  transition: width 0.1s linear;
}

.police-hide-btn {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  color: #1a1a1a !important;
  border: 2px solid #fff !important;
  border-radius: 16px !important;
  padding: 12px 20px !important;
  font-size: 1rem !important;
  font-weight: 900 !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.6) !important;
  transition: transform 0.1s !important;
}
.police-hide-btn:active {
  transform: scale(0.96) !important;
}

/* Thẻ biên bản xử phạt */
.police-fine-card {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 3px solid #ef4444 !important;
  border-radius: 20px !important;
  padding: 20px 18px !important;
  box-shadow: 0 14px 40px rgba(0,0,0,0.6) !important;
  max-width: 440px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  text-align: center !important;
}

.police-fine-header {
  font-size: 1.25rem !important;
  font-weight: 900 !important;
  color: #dc2626 !important;
  border-bottom: 2px dashed #fca5a5 !important;
  padding-bottom: 10px !important;
  margin-bottom: 14px !important;
}

.police-fine-body {
  font-size: 0.95rem !important;
  line-height: 1.55 !important;
  color: #334155 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  text-align: left !important;
}

.police-fine-amt {
  font-size: 1.6rem !important;
  font-weight: 900 !important;
  color: #dc2626 !important;
  text-align: center !important;
  margin: 6px 0 !important;
}

.police-fine-confirm-btn {
  background: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #cbd5e1 !important;
  border-radius: 14px !important;
  padding: 12px 24px !important;
  font-weight: 900 !important;
  font-size: 1rem !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
  margin-top: 14px !important;
  display: inline-block !important;
  transition: transform 0.15s, background 0.15s !important;
}
.police-fine-confirm-btn:hover {
  background: #f8fafc !important;
  transform: translateY(-2px) !important;
}

/* ===== MỨC CƯỢC CHUẨN XÌ DÁCH ===== */
.xd-chips-section {
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  border-radius: 16px;
  padding: 6px 8px;
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.xd-chips-label {
  font-size: 0.74rem;
  font-weight: 800;
  color: #fcd34d;
  letter-spacing: 0.3px;
}
.xd-chips-bar {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.xd-chip {
  min-width: 44px;
  height: 30px;
  border-radius: 15px;
  border: 2px solid #8a5a3b;
  font-weight: 800;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 8px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.25);
  transition: transform 0.1s, box-shadow 0.1s;
}
.xd-chip:active {
  transform: translateY(2px);
  box-shadow: none;
}
.xd-chip.selected {
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
  transform: translateY(-2px);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.7);
}
.xd-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.xd-chip-10k  { background: #e0e7ff; color: #3730a3; border-color: #6366f1; }
.xd-chip-50k  { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.xd-chip-100k { background: #dcfce7; color: #166534; border-color: #22c55e; }
.xd-chip-500k { background: #ffe4e6; color: #9f1239; border-color: #f43f5e; }
.xd-chip-1m   { background: #fef08a; color: #854d0e; border-color: #eab308; }
.xd-chip-all  { background: #fbcfe8; color: #831843; border-color: #ec4899; }


