/* ============================================================================
   TÀI XỈU 3D ONLINE — THUẦN CSS (PURE CSS VIP CASINO THEME)
   Luật chuẩn: 3 - 10 điểm là XỈU | 11 - 18 điểm là TÀI | 30s / Phiên
   Đầy đủ cửa: Chẵn/Lẻ (x1.98), Bộ 3 Đồng Nhất (x30/x180), Cặp Đôi (x11), Tổng (x6-x60)
   ============================================================================ */

:root {
  --bg-deep: #070912;
  --bg-panel: rgba(15, 19, 34, 0.88);
  --bg-card: rgba(22, 28, 48, 0.78);
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-gold: rgba(245, 185, 66, 0.35);

  --gold-main: #f5b942;
  --gold-light: #ffe08a;
  --gold-dark: #b87e14;

  --tai-main: #ef4444;
  --tai-glow: rgba(239, 68, 68, 0.35);
  --tai-soft: rgba(239, 68, 68, 0.14);

  --xiu-main: #3b82f6;
  --xiu-glow: rgba(59, 130, 246, 0.35);
  --xiu-soft: rgba(59, 130, 246, 0.14);

  --purple-main: #a855f7;
  --emerald: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-sans: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #171e38 0%, #090c18 55%, #05070e 100%);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  user-select: none;
}

/* ===== HẠT ÁNH SÁNG NỀN ===== */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 185, 66, 0.65), transparent 70%);
  animation: floatUp linear infinite;
  opacity: 0.35;
}

@keyframes floatUp {
  0% {
    transform: translateY(105vh) scale(0.6);
    opacity: 0;
  }
  25% {
    opacity: 0.45;
  }
  80% {
    opacity: 0.35;
  }
  100% {
    transform: translateY(-10vh) scale(1.2);
    opacity: 0;
  }
}

.hidden {
  display: none !important;
}

/* ===== MODAL VÀO PHÒNG ===== */
.join-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 6, 14, 0.88);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.join-card {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(165deg, #161d35 0%, #0d1224 100%);
  border: 1px solid var(--border-gold);
  border-radius: 24px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.75), 0 0 40px rgba(245, 185, 66, 0.15);
}

.join-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--gold-main);
  background: rgba(245, 185, 66, 0.12);
  border: 1px solid rgba(245, 185, 66, 0.3);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.join-logo-icon {
  font-size: 54px;
  margin-bottom: 8px;
  filter: drop-shadow(0 6px 16px rgba(245, 185, 66, 0.4));
}

.join-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.join-title span {
  color: var(--gold-main);
}

.join-subtitle {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.join-subtitle strong {
  color: #fff;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.join-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-light);
}

.join-form input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(7, 10, 20, 0.85);
  color: #fff;
  font-size: 15px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.join-form input:focus {
  border-color: var(--gold-main);
  box-shadow: 0 0 0 3px rgba(245, 185, 66, 0.2);
}

.join-submit-btn {
  margin-top: 4px;
  padding: 15px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #f5b942 0%, #d97706 100%);
  color: #090b12;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 10px 25px rgba(245, 185, 66, 0.35);
}

.join-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(245, 185, 66, 0.5);
}

.join-Perks {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ===== TOPBAR HEADER ===== */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(10, 14, 26, 0.88);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-dice {
  font-size: 30px;
  filter: drop-shadow(0 0 10px rgba(245, 185, 66, 0.45));
}

.brand-name {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.brand-name span {
  color: var(--gold-main);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.room-pill,
.round-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.6; }
}

.round-pill strong {
  color: var(--gold-main);
  font-family: var(--font-mono);
}

.player-wallet {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(20, 26, 46, 0.9);
  border: 1px solid var(--border-gold);
  padding: 6px 14px;
  border-radius: 14px;
}

.wallet-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--gold-main), #d97706);
  color: #090c15;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wallet-meta {
  display: flex;
  flex-direction: column;
}

.wallet-name {
  font-size: 13px;
  font-weight: 700;
}

.change-name-btn {
  background: none;
  border: none;
  color: var(--gold-main);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
}

.wallet-balance-box {
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
}

.wallet-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.wallet-balance {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--gold-light);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
}

.admin-open-btn {
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid rgba(245, 185, 66, 0.45);
  background: linear-gradient(135deg, rgba(245, 185, 66, 0.2), rgba(217, 119, 6, 0.25));
  color: var(--gold-light);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-open-btn:hover {
  background: linear-gradient(135deg, #f5b942, #d97706);
  color: #090c14;
}

/* ===== MAIN LAYOUT ===== */
.main-layout {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 20px 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* ===== SÂN KHẤU CASINO CHÍNH ===== */
.casino-stage {
  background: radial-gradient(ellipse at center, rgba(26, 35, 64, 0.92) 0%, rgba(12, 16, 30, 0.96) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 26px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), inset 0 0 60px rgba(245, 185, 66, 0.05);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.phase-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(7, 10, 20, 0.72);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.phase-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.4px;
}

.phase-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 12px var(--emerald);
}

.phase-indicator.rolling {
  background: var(--gold-main);
  box-shadow: 0 0 12px var(--gold-main);
}

.phase-indicator.result {
  background: var(--tai-main);
  box-shadow: 0 0 12px var(--tai-main);
}

.rule-reminder {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rule-tag {
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
}

.rule-tag.xiu {
  background: var(--xiu-soft);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.rule-tag.tai {
  background: var(--tai-soft);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.rule-tag.bao {
  background: rgba(245, 185, 66, 0.15);
  color: var(--gold-light);
  border: 1px solid rgba(245, 185, 66, 0.4);
}

/* ===== BÀN 3 CỘT: TÀI — XÚC XẮC 3D — XỈU ===== */
.table-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.bet-side {
  position: relative;
  border-radius: 22px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.2s, box-shadow 0.25s;
  overflow: hidden;
  background: rgba(11, 15, 28, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
}

.side-tai {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.15) 0%, rgba(15, 19, 34, 0.92) 100%);
  border-color: rgba(239, 68, 68, 0.32);
}

.side-xiu {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.15) 0%, rgba(15, 19, 34, 0.92) 100%);
  border-color: rgba(59, 130, 246, 0.32);
}

.side-tai.selected,
.side-tai:hover {
  border-color: #ef4444;
  box-shadow: 0 0 32px rgba(239, 68, 68, 0.35), inset 0 0 25px rgba(239, 68, 68, 0.15);
  transform: translateY(-2px);
}

.side-xiu.selected,
.side-xiu:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 32px rgba(59, 130, 246, 0.35), inset 0 0 25px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.bet-side.winner,
.sub-door.winner,
.mini-door.winner,
.total-door.winner {
  animation: winnerPulse 0.75s ease-in-out infinite alternate;
  border-color: var(--gold-main) !important;
}

@keyframes winnerPulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  100% {
    transform: scale(1.03);
    filter: brightness(1.3);
    box-shadow: 0 0 36px rgba(245, 185, 66, 0.85), inset 0 0 18px rgba(245, 185, 66, 0.35);
  }
}

.side-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.side-range {
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  letter-spacing: 0.5px;
}

.side-tai .side-range {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.2);
}

.side-xiu .side-range {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.2);
}

.side-payout {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-main);
}

.side-title {
  font-size: 50px;
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1.05;
  margin: 2px 0;
}

.side-tai .side-title {
  background: linear-gradient(180deg, #fff 0%, #f87171 50%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 18px rgba(239, 68, 68, 0.5));
}

.side-xiu .side-title {
  background: linear-gradient(180deg, #fff 0%, #60a5fa 50%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 18px rgba(59, 130, 246, 0.5));
}

.side-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.side-stats {
  width: 100%;
  background: rgba(6, 9, 18, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 9px 12px;
  margin-bottom: 8px;
}

.side-total-money {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 800;
  color: var(--gold-light);
}

.side-player-count {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.my-side-bet {
  font-size: 12.5px;
  color: #e2e8f0;
  margin-bottom: 10px;
}

.my-side-bet strong {
  color: var(--gold-main);
  font-family: var(--font-mono);
}

.choose-side-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s, filter 0.2s;
  margin-bottom: 10px;
}

.btn-choose-tai {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.btn-choose-xiu {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.35);
}

.choose-side-btn:hover {
  filter: brightness(1.12);
}

.side-bet-feed {
  width: 100%;
  min-height: 62px;
  max-height: 92px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  font-size: 11px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.bet-feed-item {
  display: flex;
  justify-content: space-between;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
}

.bet-feed-item span:last-child {
  font-family: var(--font-mono);
  color: var(--gold-light);
}

/* ===== TRUNG TÂM: SÂN KHẤU XÚC XẮC 3D ===== */
.center-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.dice-3d-wrapper {
  position: relative;
  width: 300px;
  height: 300px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle, #1e2644 0%, #0d1222 72%, #070a14 100%);
  border: 3px solid rgba(245, 185, 66, 0.45);
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.8), inset 0 0 35px rgba(245, 185, 66, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.timer-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
  z-index: 3;
}

.timer-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 4;
}

.timer-ring-progress {
  fill: none;
  stroke: var(--gold-main);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.4s linear, stroke 0.3s;
}

.dice-canvas-container {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  overflow: hidden;
  z-index: 2;
}

.dice-canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.timer-overlay {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  background: rgba(7, 10, 20, 0.82);
  border: 1px solid rgba(245, 185, 66, 0.45);
  border-radius: 999px;
  padding: 4px 14px;
  display: flex;
  align-items: baseline;
  gap: 5px;
  pointer-events: none;
}

.timer-number {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 800;
  color: var(--gold-light);
}

.timer-number.urgent {
  color: #ef4444;
  animation: pulseLive 0.5s infinite;
}

.timer-unit {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.result-badge {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(9, 12, 22, 0.94);
  border: 2px solid var(--gold-main);
  border-radius: 14px;
  padding: 6px 14px;
  text-align: center;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
  min-width: 210px;
}

.result-dice-faces {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--gold-light);
}

.result-total-score {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.4px;
  margin-top: 2px;
}

.result-total-score.tai {
  color: #f87171;
}

.result-total-score.xiu {
  color: #60a5fa;
}

.bowl-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.nan-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.open-bowl-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--gold-main);
  background: linear-gradient(135deg, #f5b942, #d97706);
  color: #090c14;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  animation: pulseLive 1s infinite;
}

/* ===== LỊCH SỬ CẦU NHANH (ROADMAP) ===== */
.roadmap-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: rgba(8, 11, 22, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 9px 12px;
  overflow: hidden;
}

.roadmap-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.roadmap-ratio {
  display: flex;
  gap: 10px;
}

.ratio-tai { color: #f87171; }
.ratio-xiu { color: #60a5fa; }

.roadmap-beads {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.bead {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  position: relative;
}

.bead.tai {
  background: radial-gradient(circle at 30% 30%, #ef4444, #991b1b);
  color: #fff;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.45);
}

.bead.xiu {
  background: radial-gradient(circle at 30% 30%, #3b82f6, #1e3a8a);
  color: #fff;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.45);
}

.bead.triple {
  border-color: var(--gold-main);
  box-shadow: 0 0 10px var(--gold-main);
}

/* ============================================================================
   BẢNG CÁC CỬA CƯỢC MỞ RỘNG & TỈ LỆ ĂN (SICBO VIP BOARD)
   ============================================================================ */
.sicbo-board {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sicbo-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.sicbo-board-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-light);
  letter-spacing: 0.3px;
}

.quick-bet-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

/* HÀNG 1: LẺ — BỘ 3 ĐỒNG NHẤT BẤT KỲ — CHẴN */
.sicbo-row-parity {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 12px;
}

.sub-door {
  background: rgba(10, 14, 26, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 11px 14px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.sub-door.door-le {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.14), rgba(10, 14, 26, 0.9));
  border-color: rgba(168, 85, 247, 0.35);
}

.sub-door.door-chan {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(10, 14, 26, 0.9));
  border-color: rgba(16, 185, 129, 0.35);
}

.sub-door.door-bao-any {
  background: linear-gradient(135deg, rgba(245, 185, 66, 0.2), rgba(180, 83, 9, 0.18), rgba(10, 14, 26, 0.92));
  border-color: rgba(245, 185, 66, 0.5);
}

.sub-door:hover,
.sub-door.selected {
  transform: translateY(-2px);
  border-color: var(--gold-light);
  box-shadow: 0 0 22px rgba(245, 185, 66, 0.3);
}

.sub-door.has-my-bet,
.mini-door.has-my-bet,
.total-door.has-my-bet {
  border-color: #34d399 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
}

.sub-door-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  gap: 6px;
}

.sub-door-tag {
  color: var(--text-muted);
  font-weight: 700;
}

.sub-door-odds {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--gold-light);
  background: rgba(245, 185, 66, 0.14);
  padding: 2px 8px;
  border-radius: 999px;
}

.sub-door-odds.gold {
  background: linear-gradient(135deg, #f5b942, #d97706);
  color: #090c14;
}

.sub-door-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sub-door-name {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.sub-door-name.gold-text {
  font-size: 16px;
  color: var(--gold-light);
  text-shadow: 0 2px 12px rgba(245, 185, 66, 0.45);
}

.sub-door-amounts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.room-amt {
  color: var(--gold-light);
  font-weight: 700;
}

.my-amt {
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
}

/* HÀNG 2: BỘ 3 ĐỒNG NHẤT CỤ THỂ & CẶP ĐÔI ĐỒNG NHẤT */
.sicbo-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sicbo-group-box {
  background: rgba(9, 13, 25, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sicbo-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: #e2e8f0;
}

.odds-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(245, 185, 66, 0.18);
  color: var(--gold-light);
  border: 1px solid rgba(245, 185, 66, 0.38);
}

.odds-pill.blue {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
}

.odds-pill.emerald {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.sicbo-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.mini-door {
  background: rgba(17, 23, 42, 0.9);
  border: 1.5px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  padding: 7px 4px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.14s, border-color 0.18s, box-shadow 0.18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.mini-door:hover,
.mini-door.selected {
  transform: translateY(-2px);
  border-color: var(--gold-main);
  box-shadow: 0 0 14px rgba(245, 185, 66, 0.35);
}

.mini-dice-icons {
  font-size: 17px;
  line-height: 1.1;
  color: #f8fafc;
}

.mini-dice-icons.red-pip {
  color: #f87171;
}

.mini-door-label {
  font-size: 10.5px;
  font-weight: 800;
  color: #cbd5e1;
}

.mini-door-odds {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--gold-main);
}

.mini-door-room {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.mini-door-my {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  color: #34d399;
  min-height: 12px;
}

/* HÀNG 3: CƯỢC TỔNG ĐIỂM 4 -> 17 */
.sicbo-totals-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 6px;
}

.total-door {
  background: rgba(17, 23, 42, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 6px 3px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.14s, border-color 0.18s, box-shadow 0.18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.total-door.xiu-tone {
  border-color: rgba(59, 130, 246, 0.28);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(15, 20, 36, 0.92));
}

.total-door.tai-tone {
  border-color: rgba(239, 68, 68, 0.28);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.12), rgba(15, 20, 36, 0.92));
}

.total-door:hover,
.total-door.selected {
  transform: translateY(-2px);
  border-color: var(--gold-main);
  box-shadow: 0 0 14px rgba(245, 185, 66, 0.4);
}

.total-num {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 900;
  color: #fff;
}

.total-door.xiu-tone .total-num {
  color: #93c5fd;
}

.total-door.tai-tone .total-num {
  color: #fca5a5;
}

.total-odds {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  color: var(--gold-main);
}

.total-room {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
}

.total-my {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  color: #34d399;
  min-height: 11px;
}

/* ===== BẢNG PHỈNH CƯỢC & NÚT ĐẶT CƯỢC ===== */
.betting-console {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.my-current-bets-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(7, 10, 20, 0.85);
  border: 1px solid rgba(245, 185, 66, 0.22);
  font-size: 12.5px;
  color: var(--text-muted);
}

.my-bets-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.my-bets-label {
  font-weight: 700;
  color: #cbd5e1;
}

.my-bets-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.no-bet-yet {
  color: #94a3b8;
  font-style: italic;
  font-size: 12px;
}

.bet-ticket-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #ecfdf5;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bet-ticket-tag.tai {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(15, 23, 42, 0.92));
  border-color: rgba(239, 68, 68, 0.55);
}

.bet-ticket-tag.xiu {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(15, 23, 42, 0.92));
  border-color: rgba(59, 130, 246, 0.55);
}

.bet-ticket-amt {
  font-family: var(--font-mono);
  color: var(--gold-light);
}

.bet-ticket-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, transform 0.15s;
}

.bet-ticket-btn.add:hover {
  background: #10b981;
  transform: scale(1.1);
}

.bet-ticket-btn.del:hover {
  background: #ef4444;
  transform: scale(1.1);
}

.my-current-bets-bar strong {
  color: var(--gold-light);
}

.my-total-bet-val strong {
  font-family: var(--font-mono);
  color: #34d399;
  font-size: 14px;
}

.chip-rack {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, 0.65);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
}

.chip-1k   { background: radial-gradient(circle, #64748b, #334155); }
.chip-5k   { background: radial-gradient(circle, #10b981, #047857); }
.chip-10k  { background: radial-gradient(circle, #3b82f6, #1d4ed8); }
.chip-50k  { background: radial-gradient(circle, #8b5cf6, #5b21b6); }
.chip-100k { background: radial-gradient(circle, #f59e0b, #b45309); }
.chip-500k { background: radial-gradient(circle, #ef4444, #991b1b); }
.chip-1m   { background: radial-gradient(circle, #ec4899, #9d174d); }
.chip-allin {
  width: 72px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f5b942, #dc2626);
  border-style: solid;
  color: #fff;
}

.chip:hover,
.chip.active {
  transform: translateY(-5px) scale(1.07);
  box-shadow: 0 10px 24px rgba(245, 185, 66, 0.55);
  border-color: var(--gold-light);
}

.bet-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.custom-bet-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(7, 10, 20, 0.88);
  border: 1px solid var(--border-gold);
  padding: 6px 10px;
  border-radius: 14px;
}

.Selected-side-pill {
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 9px;
  background: rgba(245, 185, 66, 0.18);
  color: var(--gold-light);
}

.Selected-side-pill.tai {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

.Selected-side-pill.xiu {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

.Selected-side-pill.multi {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(245, 185, 66, 0.25));
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.btn-clear-select {
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.btn-clear-select:hover {
  background: rgba(239, 68, 68, 0.28);
}

#bet-amount-input {
  width: 145px;
  background: transparent;
  border: none;
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  outline: none;
}

.btn-double-bet {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid rgba(245, 185, 66, 0.4);
  background: rgba(245, 185, 66, 0.15);
  color: var(--gold-light);
  font-weight: 800;
  cursor: pointer;
}

.bet-confirm-buttons {
  display: flex;
  gap: 10px;
}

.btn-place-bet {
  padding: 13px 24px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #f5b942 0%, #d97706 100%);
  color: #090b12;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(245, 185, 66, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-place-bet:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(245, 185, 66, 0.55);
}

.btn-cancel-bet {
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.btn-cancel-bet:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ============================================================================
   BẢNG KẾT QUẢ CÁC PHIÊN TRƯỚC & THỐNG KÊ SOI CẦU
   ============================================================================ */
.history-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-gold);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.history-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.history-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--gold-light);
}

.history-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.history-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hist-filter-btn {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.hist-filter-btn:hover,
.hist-filter-btn.active {
  background: var(--gold-main);
  color: #090c14;
  border-color: var(--gold-main);
}

.history-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.h-stat-card {
  background: rgba(8, 12, 24, 0.82);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.h-stat-card.tai {
  border-color: rgba(239, 68, 68, 0.3);
}

.h-stat-card.xiu {
  border-color: rgba(59, 130, 246, 0.3);
}

.h-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.h-stat-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}

.h-stat-card.tai .h-stat-value { color: #fca5a5; }
.h-stat-card.xiu .h-stat-value { color: #93c5fd; }

.h-stat-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.h-stat-sub.gold {
  color: var(--gold-light);
  font-weight: 700;
}

.h-progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}

.h-progress-fill {
  height: 100%;
  border-radius: 999px;
}

.h-progress-fill.tai {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.h-progress-fill.xiu {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.history-table-wrap {
  width: 100%;
  max-width: 100%;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: rgba(7, 10, 20, 0.75);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.history-table th,
.history-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.history-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0d1326;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.history-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

.hist-round-cell {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--gold-light);
}

.hist-time-cell {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.hist-dice-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dice-pip-box {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(145deg, #ffffff, #e2e8f0);
  color: #0f172a;
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.dice-pip-box.red {
  color: #dc2626;
}

.hist-total-pill {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.hist-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}

.hist-badge.tai {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.hist-badge.xiu {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.hist-badge.chan {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.hist-badge.le {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.hist-badge.triple {
  background: linear-gradient(135deg, #f5b942, #d97706);
  color: #090c14;
}

.hist-badge.pair {
  background: rgba(245, 185, 66, 0.15);
  color: var(--gold-light);
  border: 1px solid rgba(245, 185, 66, 0.35);
}

.hist-badge.normal {
  color: var(--text-muted);
  font-weight: 600;
}

/* ===== SIDEBAR PHẢI: NGƯỜI CHƠI & CHAT ===== */
.room-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 16px;
  backdrop-filter: blur(12px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-header h3 {
  font-size: 14px;
  font-weight: 800;
}

.badge-count,
.chat-hint {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.players-list {
  max-height: 290px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  gap: 6px;
}

.player-row-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.player-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  flex-shrink: 0;
}

.player-row-name {
  font-size: 12.5px;
  font-weight: 700;
}

.player-row-bet {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 800;
  background: rgba(245, 185, 66, 0.16);
  color: var(--gold-light);
}

.player-row-bet.tai {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.player-row-bet.xiu {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.player-row-balance {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-light);
  flex-shrink: 0;
}

/* ===== CHAT ===== */
.chat-messages {
  height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
  margin-bottom: 10px;
}

.chat-item {
  font-size: 12.5px;
  line-height: 1.45;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.chat-item.system {
  background: rgba(245, 185, 66, 0.12);
  border-left: 3px solid var(--gold-main);
  color: var(--gold-light);
}

.chat-sender {
  font-weight: 800;
  color: #60a5fa;
  margin-right: 6px;
}

.chat-time {
  font-size: 10px;
  color: var(--text-muted);
  float: right;
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-form input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(7, 10, 20, 0.85);
  color: #fff;
  font-size: 12.5px;
  outline: none;
}

.chat-form button {
  padding: 9px 14px;
  border-radius: 10px;
  border: none;
  background: var(--gold-main);
  color: #090c14;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
}

/* ===== MODAL ADMIN NHÀ CÁI ===== */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(4, 6, 14, 0.86);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.admin-panel {
  width: 100%;
  max-width: 1140px;
  max-height: 92vh;
  overflow-y: auto;
  background: #0f1426;
  border: 1px solid var(--border-gold);
  border-radius: 22px;
  padding: 22px 24px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}

.admin-header h2 {
  font-size: 20px;
  color: var(--gold-light);
}

.admin-header p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.admin-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.admin-login-box {
  max-width: 420px;
  margin: 24px auto;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 22px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
}

.admin-login-form {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.admin-login-form input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #070a14;
  color: #fff;
}

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.admin-kpi {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-kpi span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.admin-kpi strong {
  font-family: var(--font-mono);
  font-size: 15.5px;
  color: var(--gold-light);
}

.forced-status-badge {
  color: #34d399 !important;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.admin-section {
  background: rgba(7, 10, 20, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-section h3 {
  font-size: 15px;
  color: var(--gold-main);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-sub-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-sub-block label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

.admin-force-sides-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.adm-side-btn {
  padding: 10px 10px;
  border-radius: 10px;
  border: none;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  color: #fff;
}

.adm-side-btn.tai {
  background: linear-gradient(135deg, #ef4444, #991b1b);
}

.adm-side-btn.xiu {
  background: linear-gradient(135deg, #3b82f6, #1e3a8a);
}

.adm-side-btn.chan {
  background: linear-gradient(135deg, #10b981, #047857);
}

.adm-side-btn.le {
  background: linear-gradient(135deg, #a855f7, #6b21a8);
}

.adm-side-btn.clear {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 7px 10px;
}

.admin-triple-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.adm-triple-btn {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(245, 185, 66, 0.4);
  background: rgba(245, 185, 66, 0.14);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}

.adm-triple-btn.any {
  background: linear-gradient(135deg, #f5b942, #d97706);
  color: #090c14;
}

.adm-triple-btn:hover {
  filter: brightness(1.15);
}

.score-picker-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-row-label {
  width: 86px;
  font-size: 11.5px;
  font-weight: 800;
}

.score-row-label.xiu { color: #60a5fa; }
.score-row-label.tai { color: #f87171; }

.score-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.score-btn {
  width: 36px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s, box-shadow 0.15s;
}

.score-btn.xiu {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.45);
}

.score-btn.tai {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
}

.score-btn:hover,
.score-btn.active {
  transform: scale(1.1);
  border-color: var(--gold-light);
  box-shadow: 0 0 12px rgba(245, 185, 66, 0.65);
}

.exact-dice-row,
.quick-money-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.exact-dice-row select,
.quick-money-bar input {
  flex: 1;
  min-width: 110px;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: #090d1a;
  color: #fff;
  font-size: 12.5px;
}

.admin-btn-primary,
.admin-btn-secondary,
.admin-btn-green,
.admin-btn-gold {
  padding: 9px 13px;
  border-radius: 9px;
  border: none;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}

.admin-btn-primary {
  background: #6366f1;
  color: #fff;
}

.admin-btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.admin-btn-green {
  background: #10b981;
  color: #062218;
}

.admin-btn-gold {
  background: linear-gradient(135deg, #f5b942, #d97706);
  color: #090c14;
}

.admin-players-table-wrap {
  max-height: 290px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.admin-players-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-players-table th,
.admin-players-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-players-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 700;
}

.adm-quick-btns {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}

.adm-mini-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.adm-mini-btn:hover {
  background: #10b981;
  color: #051b11;
}

.adm-custom-input {
  width: 88px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: #060913;
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 11px;
}

.adm-players-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-btn-danger {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.55);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(153, 27, 27, 0.35));
  color: #fca5a5;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.admin-btn-danger:hover {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
}

.adm-del-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.adm-del-btn:hover {
  background: #ef4444;
  color: #fff;
}

.adm-side-btn.active,
.adm-triple-btn.active {
  outline: 2px solid var(--gold-light);
  box-shadow: 0 0 16px rgba(245, 185, 66, 0.75);
  transform: translateY(-1px);
}

/* ===== HIỂN THỊ NGƯỜI CHƠI KHÁC ĐẶT CƯỢC TRONG TỪNG Ô CỬA ===== */
.door-players-bets {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  margin-top: 3px;
  max-height: 46px;
  overflow-y: auto;
}

.sub-door .door-players-bets {
  justify-content: flex-start;
  max-height: 54px;
  padding-top: 3px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.door-bet-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(245, 185, 66, 0.28);
  font-size: 9.5px;
  line-height: 1.25;
  color: #e2e8f0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.door-bet-chip.is-me {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.door-bet-chip strong {
  font-family: var(--font-mono);
  color: var(--gold-light);
  font-weight: 800;
}

/* ===== POPUP THÔNG BÁO THẮNG / THUA SAU MỖI PHIÊN ===== */
.round-result-popup {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 380;
  width: min(92vw, 440px);
  pointer-events: auto;
  animation: popDownIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popDownIn {
  from {
    opacity: 0;
    transform: translate(-50%, -24px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.round-result-card {
  position: relative;
  border-radius: 20px;
  padding: 18px 20px;
  text-align: center;
  background: linear-gradient(165deg, rgba(16, 22, 42, 0.97), rgba(8, 12, 24, 0.98));
  border: 2px solid var(--gold-main);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(245, 185, 66, 0.25);
  backdrop-filter: blur(14px);
}

.round-result-card.win {
  border-color: #10b981;
  background: linear-gradient(165deg, rgba(6, 62, 46, 0.96), rgba(10, 16, 32, 0.98));
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(16, 185, 129, 0.35);
}

.round-result-card.lose {
  border-color: #ef4444;
  background: linear-gradient(165deg, rgba(68, 14, 20, 0.96), rgba(10, 16, 32, 0.98));
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(239, 68, 68, 0.3);
}

.round-result-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.round-result-icon {
  font-size: 34px;
  margin-bottom: 4px;
}

.round-result-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: #fff;
}

.round-result-meta {
  font-size: 12px;
  color: var(--gold-light);
  margin-top: 3px;
  font-weight: 700;
}

.round-result-amount {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 900;
  margin: 8px 0 4px;
}

.round-result-card.win .round-result-amount {
  color: #34d399;
  text-shadow: 0 0 18px rgba(16, 185, 129, 0.55);
}

.round-result-card.lose .round-result-amount {
  color: #f87171;
  text-shadow: 0 0 18px rgba(239, 68, 68, 0.45);
}

.round-result-sub {
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 700;
  margin-bottom: 8px;
}

.round-result-details {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  font-size: 11px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
}

.round-detail-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.round-detail-pill.win {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.round-detail-pill.lose {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* ===== TOAST THÔNG BÁO ===== */
.toast-container {
  position: fixed;
  top: 76px;
  right: 22px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-msg {
  min-width: 260px;
  max-width: 390px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(14, 19, 36, 0.95);
  border-left: 4px solid var(--gold-main);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
  animation: slideInRight 0.25s ease-out;
}

.toast-msg.win {
  border-left-color: #10b981;
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.95), rgba(14, 19, 36, 0.95));
}

.toast-msg.error {
  border-left-color: #ef4444;
}

@keyframes slideInRight {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1180px) {
  .main-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 12px 28px;
  }
  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .sicbo-totals-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar {
    padding: 10px 12px;
    gap: 8px;
  }
  .topbar-left,
  .topbar-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .brand-name {
    font-size: 16px;
  }
  .brand-sub {
    display: none;
  }
  .player-wallet {
    flex: 1;
    justify-content: space-between;
    padding: 5px 10px;
  }
  .casino-stage,
  .history-section,
  .sidebar-card {
    padding: 12px;
    border-radius: 18px;
  }
  .phase-banner {
    padding: 8px 10px;
    margin-bottom: 12px;
    gap: 6px;
  }
  .phase-status {
    font-size: 12.5px;
  }
  .rule-tag {
    font-size: 10px;
    padding: 3px 7px;
  }
  /* Trên điện thoại: Sân khấu xúc xắc 3D ở trên, 2 cửa TÀI & XỈU nằm song song 2 cột ngay bên dưới */
  .table-board {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }
  .center-stage {
    grid-column: 1 / -1;
    order: -1;
  }
  .dice-3d-wrapper {
    width: min(230px, 64vw);
    height: min(230px, 64vw);
  }
  .timer-overlay {
    top: 8px;
    padding: 2px 10px;
  }
  .timer-number {
    font-size: 18px;
  }
  .result-badge {
    bottom: 8px;
    min-width: 160px;
    max-width: 88%;
    padding: 4px 8px;
  }
  .result-dice-faces {
    font-size: 11px;
  }
  .result-total-score {
    font-size: 12px;
  }
  .bet-side {
    padding: 12px 8px;
    border-radius: 16px;
  }
  .side-header {
    flex-direction: column;
    gap: 3px;
  }
  .side-range {
    font-size: 10px;
    padding: 2px 7px;
  }
  .side-payout {
    font-size: 11px;
  }
  .side-title {
    font-size: 32px;
    letter-spacing: 1px;
  }
  .side-subtitle {
    font-size: 10.5px;
    margin-bottom: 6px;
  }
  .side-stats {
    padding: 6px 8px;
    margin-bottom: 6px;
  }
  .side-total-money {
    font-size: 14px;
  }
  .my-side-bet {
    font-size: 11px;
    margin-bottom: 6px;
  }
  .choose-side-btn {
    padding: 8px 6px;
    font-size: 11px;
    margin-bottom: 6px;
  }
  .side-bet-feed {
    max-height: 64px;
    min-height: 44px;
    font-size: 10px;
  }
  /* Hàng Chẵn / Lẻ / Bão trên điện thoại: Lẻ & Chẵn 2 cột, Bão nằm ngang full cột */
  .sicbo-row-parity {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }
  .sub-door.door-bao-any {
    grid-column: 1 / -1;
    order: -1;
  }
  .sub-door {
    padding: 9px 10px;
  }
  .sub-door-name {
    font-size: 18px;
  }
  .sub-door-name.gold-text {
    font-size: 13.5px;
  }
  .sicbo-two-cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .sicbo-grid-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .sicbo-totals-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
  }
  .chip {
    width: 46px;
    height: 46px;
    font-size: 11px;
  }
  .chip-allin {
    width: 64px;
  }
  .custom-bet-input-wrap {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  #bet-amount-input {
    flex: 1;
    min-width: 90px;
  }
  .bet-confirm-buttons {
    width: 100%;
  }
  .btn-place-bet {
    flex: 1;
    padding: 12px 12px;
    font-size: 12.5px;
  }
  .history-summary-cards,
  .admin-kpis,
  .admin-force-sides-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .join-modal,
  .admin-modal {
    padding: 10px;
    align-items: flex-start;
    overflow-y: auto;
  }
  .join-card {
    margin: auto 0;
    padding: 20px 16px;
    max-height: 92dvh;
    overflow-y: auto;
  }
  .admin-panel {
    margin: auto 0;
    padding: 14px 12px;
    max-height: 92dvh;
  }
  .admin-players-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    align-items: center;
  }
  .toast-msg {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    font-size: 12px;
    padding: 9px 12px;
  }
}

@media (max-width: 480px) {
  .sicbo-totals-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .room-pill span:last-child {
    font-size: 11px;
  }
  .admin-open-btn {
    padding: 7px 10px;
    font-size: 11.5px;
  }
}
