
/* ============================================================
   CYBER 5-THEME 4-PLAYER WAITING ROOM (PIXEL PERFECT MODULAR)
   ============================================================ */
.tl4-master-chamber-mode {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: 440px !important;
  width: 96vw !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}
.tl4-master-chamber-mode > .modal-title,
.tl4-master-chamber-mode #rwSettingsControlBox,
.tl4-master-chamber-mode #rwVsArena1v1,
.tl4-master-chamber-mode #rwBottomDock,
.tl4-master-chamber-mode #rwFooterActions {
  display: none !important;
}

#rwFourSeatArena {
  width: 100%;
  display: flex;
  justify-content: center;
}

.hdr-theme-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--theme-border);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--theme-accent);
  cursor: pointer;
  box-shadow: 0 0 10px var(--theme-glow);
  transition: all 0.2s ease;
  user-select: none;
}
.hdr-theme-pill:hover, .hdr-theme-pill:active {
  transform: scale(1.05);
  background: var(--theme-glow-ambient);
}


.theme-blue {
      --theme-primary: #00f2fe;
      --theme-secondary: #0066ff;
      --theme-accent: #38bdf8;
      --theme-glow: rgba(0, 242, 254, 0.45);
      --theme-glow-strong: rgba(0, 242, 254, 0.85);
      --theme-glow-ambient: rgba(0, 102, 255, 0.25);
      --theme-panel-bg: rgba(7, 21, 46, 0.88);
      --theme-card-bg: rgba(6, 17, 38, 0.82);
      --theme-border: #00d2ff;
      --theme-border-subtle: rgba(0, 210, 255, 0.35);
      background: #020b18;
      border: 2px solid #00f2fe;
      box-shadow: 0 0 35px rgba(0, 242, 254, 0.3), inset 0 0 30px rgba(0, 102, 255, 0.25);
    }

    /* 2. ROYAL CYBER GOLD */
    .theme-gold {
      --theme-primary: #ffd700;
      --theme-secondary: #f59e0b;
      --theme-accent: #fef08a;
      --theme-glow: rgba(255, 215, 0, 0.45);
      --theme-glow-strong: rgba(255, 215, 0, 0.85);
      --theme-glow-ambient: rgba(245, 158, 11, 0.25);
      --theme-panel-bg: rgba(28, 20, 7, 0.90);
      --theme-card-bg: rgba(22, 15, 4, 0.84);
      --theme-border: #ffd700;
      --theme-border-subtle: rgba(255, 215, 0, 0.35);
      background: #0d0a04;
      border: 2px solid #ffd700;
      box-shadow: 0 0 35px rgba(255, 215, 0, 0.3), inset 0 0 30px rgba(245, 158, 11, 0.22);
    }

    /* 3. PLASMA CYBER PURPLE */
    .theme-purple {
      --theme-primary: #c084fc;
      --theme-secondary: #ec4899;
      --theme-accent: #f472b6;
      --theme-glow: rgba(192, 132, 252, 0.45);
      --theme-glow-strong: rgba(192, 132, 252, 0.85);
      --theme-glow-ambient: rgba(236, 72, 153, 0.22);
      --theme-panel-bg: rgba(27, 10, 42, 0.88);
      --theme-card-bg: rgba(20, 7, 32, 0.82);
      --theme-border: #c084fc;
      --theme-border-subtle: rgba(192, 132, 252, 0.35);
      background: #0b0312;
      border: 2px solid #c084fc;
      box-shadow: 0 0 35px rgba(192, 132, 252, 0.3), inset 0 0 30px rgba(236, 72, 153, 0.2);
    }

    /* 4. QUANTUM MATRIX EMERALD */
    .theme-emerald {
      --theme-primary: #00ff88;
      --theme-secondary: #059669;
      --theme-accent: #6ee7b7;
      --theme-glow: rgba(0, 255, 136, 0.45);
      --theme-glow-strong: rgba(0, 255, 136, 0.85);
      --theme-glow-ambient: rgba(5, 150, 105, 0.25);
      --theme-panel-bg: rgba(4, 28, 20, 0.88);
      --theme-card-bg: rgba(3, 22, 16, 0.82);
      --theme-border: #00ff88;
      --theme-border-subtle: rgba(0, 255, 136, 0.35);
      background: #020f09;
      border: 2px solid #00ff88;
      box-shadow: 0 0 35px rgba(0, 255, 136, 0.3), inset 0 0 30px rgba(5, 150, 105, 0.22);
    }

    /* 5. MECHA SOLAR CRIMSON */
    .theme-crimson {
      --theme-primary: #ff3344;
      --theme-secondary: #ea580c;
      --theme-accent: #fca5a5;
      --theme-glow: rgba(255, 51, 68, 0.45);
      --theme-glow-strong: rgba(255, 51, 68, 0.85);
      --theme-glow-ambient: rgba(234, 88, 12, 0.25);
      --theme-panel-bg: rgba(36, 9, 12, 0.90);
      --theme-card-bg: rgba(26, 6, 8, 0.84);
      --theme-border: #ff3344;
      --theme-border-subtle: rgba(255, 51, 68, 0.35);
      background: #110204;
      border: 2px solid #ff3344;
      box-shadow: 0 0 35px rgba(255, 51, 68, 0.3), inset 0 0 30px rgba(234, 88, 12, 0.22);
    }

    /* ========================================================
       TOP HEADER BAR (Room Info + Close)
       ======================================================== */
    .hdr-bar {
      height: 44px;
      background: var(--theme-panel-bg);
      border: 1.5px solid var(--theme-border);
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 10px;
      box-shadow: 0 0 15px var(--theme-glow), inset 0 1px 0 rgba(255,255,255,0.25);
    }
    .hdr-left {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .hdr-btn-home, .hdr-btn-close {
      width: 30px;
      height: 30px;
      border-radius: 8px;
      background: rgba(255,255,255,0.06);
      border: 1px solid var(--theme-border-subtle);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--theme-primary);
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .hdr-btn-home:hover, .hdr-btn-close:hover {
      background: var(--theme-primary);
      color: #000;
      box-shadow: 0 0 10px var(--theme-glow-strong);
    }
    .hdr-btn-home:active, .hdr-btn-close:active {
      transform: scale(0.92);
    }
    .hdr-title {
      font-size: 11.5px;
      font-weight: 800;
      letter-spacing: 0.3px;
      text-transform: uppercase;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 5px;
    }
    .hdr-title span.room-code {
      color: var(--theme-primary);
      font-family: 'Orbitron', sans-serif;
      text-shadow: 0 0 8px var(--theme-glow-strong);
    }

    /* SUBHEADER: Game Mode & Bet Info */
    .game-bet-bar {
      margin-top: 6px;
      height: 36px;
      background: var(--theme-card-bg);
      border: 1px solid var(--theme-border-subtle);
      border-radius: 11px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 10px;
      font-size: 11px;
      box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    }
    .game-tag {
      display: flex;
      align-items: center;
      gap: 6px;
      font-weight: 800;
    }
    .game-tag span.badge-mode {
      background: rgba(255,255,255,0.08);
      padding: 2px 7px;
      border-radius: 6px;
      border: 1px solid var(--theme-border-subtle);
      color: var(--theme-primary);
    }
    .bet-tag {
      display: flex;
      align-items: center;
      gap: 4px;
      background: rgba(245, 158, 11, 0.12);
      border: 1px solid #f59e0b;
      padding: 2px 8px;
      border-radius: 20px;
      font-weight: 900;
      color: #fbbf24;
      font-family: 'Orbitron', sans-serif;
      box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
    }
    .bet-tag svg {
      width: 14px;
      height: 14px;
      filter: drop-shadow(0 0 4px #fbbf24);
    }

    /* RIBBON BANNER: BÀN CHỜ 4 NGƯỜI */
    .ribbon-banner {
      margin-top: 6px;
      height: 36px;
      background: linear-gradient(90deg, transparent 0%, var(--theme-panel-bg) 18%, var(--theme-panel-bg) 82%, transparent 100%);
      border-top: 1.5px solid var(--theme-border);
      border-bottom: 1.5px solid var(--theme-border);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      font-family: 'Orbitron', sans-serif;
      font-size: 12px;
      font-weight: 900;
      letter-spacing: 1.2px;
      color: #fff;
      text-transform: uppercase;
      box-shadow: 0 0 20px var(--theme-glow), inset 0 0 10px rgba(255,255,255,0.06);
    }
    .ribbon-banner svg.laurel-svg {
      width: 22px;
      height: 22px;
      fill: var(--theme-primary);
      filter: drop-shadow(0 0 8px var(--theme-glow-strong));
    }

    /* ========================================================
       SEATS 2X2 GRID (CHỦ PHÒNG + 3 GHẾ KHÁCH)
       ======================================================== */
    .seats-grid {
      margin-top: 8px;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      flex-grow: 1;
      align-content: center;
    }

    .seat-card {
      background: var(--theme-card-bg);
      border: 1.5px solid var(--theme-border-subtle);
      border-radius: 18px;
      padding: 10px 8px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      position: relative;
      box-shadow: 0 8px 20px rgba(0,0,0,0.6), inset 0 0 15px rgba(255,255,255,0.03);
      transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
      overflow: hidden;
    }
    .seat-card::before {
      content: "";
      position: absolute;
      top: 0; left: 0; right: 0; height: 2px;
      background: linear-gradient(90deg, transparent, var(--theme-primary), transparent);
    }
    .seat-card:hover {
      border-color: var(--theme-border);
      box-shadow: 0 10px 25px var(--theme-glow);
    }

    /* HOST SPECIFIC CARD */
    .seat-card.is-host {
      border-color: #ffd700 !important;
      box-shadow: 0 0 25px rgba(255, 215, 0, 0.35), inset 0 0 20px rgba(255, 215, 0, 0.08) !important;
      background: linear-gradient(180deg, rgba(30, 20, 5, 0.85) 0%, var(--theme-card-bg) 100%);
    }

    /* HOLO PEDESTAL / AVATAR WRAPPER */
    .pedestal-wrap {
      width: 86px;
      height: 86px;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 4px;
    }

    /* Rotating 3D Holographic energy rings */
    .holo-rings {
      position: absolute;
      inset: -4px;
      border-radius: 50%;
      border: 1.5px dashed var(--theme-primary);
      opacity: 0.7;
      animation: spinHolo 12s linear infinite;
      box-shadow: 0 0 12px var(--theme-glow);
    }
    .holo-rings-inner {
      position: absolute;
      inset: 2px;
      border-radius: 50%;
      border: 1.5px solid var(--theme-border-subtle);
      animation: spinHoloReverse 8s linear infinite;
    }
    @keyframes spinHolo {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }
    @keyframes spinHoloReverse {
      from { transform: rotate(360deg); }
      to { transform: rotate(0deg); }
    }

    /* Host 3D Crown on Top */
    .host-crown-3d {
      position: absolute;
      top: -14px;
      width: 40px;
      height: 24px;
      z-index: 5;
      filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.85));
      animation: crownBob 3s ease-in-out infinite alternate;
    }
    @keyframes crownBob {
      from { transform: translateY(0); }
      to { transform: translateY(-3px); }
    }

    /* Avatar Image */
    .seat-avatar-img {
      width: 66px;
      height: 66px;
      border-radius: 50%;
      object-fit: cover;
      position: relative;
      z-index: 2;
      border: 2px solid var(--theme-primary);
      box-shadow: 0 0 16px var(--theme-glow);
    }

    /* Empty Seat Hologram '+' Icon */
    .empty-holo-plus {
      width: 66px;
      height: 66px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
      border: 2px dashed var(--theme-primary);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--theme-primary);
      cursor: pointer;
      position: relative;
      z-index: 2;
      transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
      box-shadow: 0 0 12px var(--theme-glow);
    }
    .empty-holo-plus svg {
      width: 28px;
      height: 28px;
      filter: drop-shadow(0 0 6px var(--theme-glow-strong));
      transition: transform 0.2s ease;
    }
    .empty-holo-plus:hover {
      transform: scale(1.08);
      background: rgba(255,255,255,0.15);
      border-style: solid;
      box-shadow: 0 0 20px var(--theme-glow-strong);
    }
    .empty-holo-plus:active {
      transform: scale(0.92);
    }
    .empty-holo-plus:hover svg {
      transform: rotate(90deg);
    }

    /* Seat Meta & Label */
    .seat-name-pill {
      margin-top: 6px;
      width: 100%;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--theme-border-subtle);
      border-radius: 8px;
      padding: 3px 6px;
      text-align: center;
      font-size: 11px;
      font-weight: 800;
      color: #fff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .seat-sub-tag {
      font-size: 10px;
      font-weight: 700;
      color: var(--theme-primary);
      margin-top: 2px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
    }

    /* SEAT ACTION BUTTONS (MỜI / SẴN SÀNG) */
    .btn-seat-action {
      margin-top: 6px;
      width: 100%;
      height: 28px;
      border-radius: 8px;
      border: 1.2px solid var(--theme-border);
      background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.5) 100%);
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      cursor: pointer;
      box-shadow: 0 2px 8px rgba(0,0,0,0.4);
      transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .btn-seat-action svg {
      width: 14px;
      height: 14px;
      transition: transform 0.2s ease;
      filter: drop-shadow(0 0 4px var(--theme-primary));
    }
    .btn-seat-action:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 14px var(--theme-glow);
    }
    .btn-seat-action:active {
      transform: translateY(1px) scale(0.96);
    }
    .btn-seat-action:hover svg {
      transform: scale(1.25) rotate(-8deg);
    }

    .btn-seat-action.btn-ready {
      background: linear-gradient(135deg, #10b981 0%, #047857 100%);
      border-color: #34d399;
      box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
    }

    /* ========================================================
       BOTTOM MASTER BUTTONS & DOCK
       ======================================================== */
    .bottom-dock {
      margin-top: 8px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    /* GIANT CYBER BUTTON (MỜI VÀO PHÒNG / MỜI NHANH / BẮT ĐẦU) */
    .btn-giant-cyber {
      width: 100%;
      height: 48px;
      border-radius: 14px;
      border: 2px solid var(--theme-border);
      font-family: 'Orbitron', sans-serif;
      font-size: 13.5px;
      font-weight: 900;
      letter-spacing: 0.8px;
      text-transform: uppercase;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
      box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    }
    .btn-giant-cyber svg.icon-3d {
      width: 24px;
      height: 24px;
      transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
      filter: drop-shadow(0 0 8px rgba(255,255,255,0.6));
    }

    /* Light streak reflection animation */
    .btn-giant-cyber::after {
      content: "";
      position: absolute;
      top: -50%; left: -60%;
      width: 40%; height: 200%;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
      transform: rotate(25deg);
      animation: buttonShine 4s infinite ease-in-out;
    }
    @keyframes buttonShine {
      0% { left: -60%; }
      30%, 100% { left: 140%; }
    }

    .btn-giant-cyber:hover {
      transform: translateY(-2px);
    }
    .btn-giant-cyber:active {
      transform: translateY(2px) scale(0.97);
    }
    .btn-giant-cyber:hover svg.icon-3d {
      transform: scale(1.22) translateY(-2px);
    }

    /* Blue invite button */
    .btn-invite-blue {
      background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #075985 100%);
      border-color: #38bdf8;
      color: #fff;
      box-shadow: 0 0 20px rgba(56, 189, 248, 0.45);
    }

    /* Gold Rocket Quick Invite button */
    .btn-quick-gold {
      background: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
      border-color: #fde047;
      color: #fff;
      text-shadow: 0 2px 4px rgba(0,0,0,0.6);
      box-shadow: 0 0 24px rgba(245, 158, 11, 0.55);
    }
    .btn-quick-gold:hover svg.icon-3d {
      animation: rocketRumble 0.3s ease infinite alternate;
    }
    @keyframes rocketRumble {
      0% { transform: scale(1.22) translate(0, 0); }
      100% { transform: scale(1.25) translate(2px, -3px); }
    }

    /* Red / Orange Flame Start Game Button */
    .btn-flame-cyber,
    .btn-start-flame {
      background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%);
      border-color: #fca5a5;
      color: #fff;
      box-shadow: 0 0 28px rgba(239, 68, 68, 0.6);
    }
    .btn-flame-cyber:hover,
    .btn-start-flame:hover svg.icon-3d {
      animation: flamePulse 0.4s ease infinite alternate;
    }
    @keyframes flamePulse {
      0% { transform: scale(1.2) rotate(-5deg); filter: drop-shadow(0 0 10px #fbbf24); }
      100% { transform: scale(1.3) rotate(5deg); filter: drop-shadow(0 0 16px #ef4444); }
    }

    /* RULE & STATUS BARS */
    .rule-note-bar {
      background: rgba(0,0,0,0.5);
      border: 1px solid var(--theme-border-subtle);
      border-radius: 9px;
      padding: 5px 8px;
      font-size: 9.5px;
      color: #cbd5e1;
      display: flex;
      align-items: center;
      gap: 6px;
      line-height: 1.25;
    }
    .rule-note-bar span.icon-bulb {
      font-size: 14px;
      color: #fbbf24;
      filter: drop-shadow(0 0 5px #fbbf24);
    }

    .status-count-bar {
      height: 28px;
      background: rgba(255,255,255,0.04);
      border: 1px solid var(--theme-border-subtle);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      font-size: 10.5px;
      font-weight: 800;
      color: var(--theme-primary);
      text-transform: uppercase;
      font-family: 'Orbitron', sans-serif;
    }

    /* CLOSE ROOM BUTTON */
    .btn-close-room {
      width: 100%;
      height: 38px;
      background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
      border: 1.5px solid #f87171;
      border-radius: 12px;
      color: #fff;
      font-family: 'Orbitron', sans-serif;
      font-size: 12px;
      font-weight: 800;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      cursor: pointer;
      box-shadow: 0 4px 14px rgba(153, 27, 27, 0.45);
      transition: all 0.15s ease;
    }
    .btn-close-room svg {
      width: 16px;
      height: 16px;
      transition: transform 0.2s ease;
    }
    .btn-close-room:hover {
      box-shadow: 0 0 16px rgba(248, 113, 113, 0.6);
    }
    .btn-close-room:hover svg {
      transform: translateX(-3px);
    }
    .btn-close-room:active {
      transform: scale(0.96);
    }

    /* TOAST FEEDBACK: ĐẶT Ở GIỮA MÀN HÌNH GỌN GÀNG */
    .toast-msg {
      position: fixed;
      top: 50%;
      left: 50%;
      bottom: auto;
      right: auto;
      width: auto;
      height: auto;
      min-width: 140px;
      max-width: min(85vw, 340px);
      background: rgba(15, 23, 42, 0.95);
      border: 1.5px solid var(--theme-border);
      box-shadow: 0 0 25px var(--theme-glow-strong);
      color: #fff;
      padding: 12px 20px;
      border-radius: 20px;
      font-weight: 800;
      font-size: 13px;
      z-index: 2147483647;
      pointer-events: none;
      opacity: 0;
      visibility: hidden;
      transform: translate(-50%, -50%) scale(0.85);
      transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .toast-msg.show {
      opacity: 1;
      visibility: visible;
      transform: translate(-50%, -50%) scale(1);
    }

    /* CUSTOM 3D MASTER BUTTON: BẮT ĐẦU */
    .btn-custom-batdau-wrap {
      width: 100%;
      background: transparent;
      border: none;
      padding: 0;
      margin: 2px 0;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      outline: none;
      -webkit-tap-highlight-color: transparent;
      transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
    }
    .btn-custom-batdau-wrap:hover {
      transform: scale(1.03);
    }
    .btn-custom-batdau-wrap:active {
      transform: scale(0.96);
    }
    .btn-custom-batdau-img {
      width: 100%;
      max-width: 370px;
      height: 86px;
      object-fit: contain;
      display: block;
      filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 12px rgba(239, 68, 68, 0.5));
      animation: btnBatDauPulse 2.8s ease-in-out infinite alternate;
    }
    @keyframes btnBatDauPulse {
      0% {
        filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 10px rgba(239, 68, 68, 0.45));
        transform: translateY(0);
      }
      100% {
        filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 20px rgba(255, 215, 0, 0.7)) drop-shadow(0 0 26px rgba(239, 68, 68, 0.65));
        transform: translateY(-2px);
      }
    }
