/* ============================================================================
   AUTH & PROFILE SYSTEM (BOF) — ระบบล็อกอินด้วยชื่อผู้ใช้ (Username) + รหัสผ่าน (Password)
   รองรับทั้ง:
   1. Cloud Sync (Firebase Auth + Firestore) — ซิงค์ข้ามเครื่องอัตโนมัติเมื่อใส่ FIREBASE_CONFIG
   2. Local Account + รหัสย้ายเครื่อง (Transfer Code) — ใช้งานได้ทันทีโดยไม่ต้องตั้งค่าเซิร์ฟเวอร์!
   ============================================================================ */

#lb-auth-bar {
  position: absolute;
  left: 24px;
  top: 56px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: rgba(22, 26, 58, 0.92);
  border: 1px solid rgba(243, 201, 105, 0.45);
  color: #e8eaf7;
  font: 600 14px/1.2 var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
}

#lb-auth-bar:hover {
  border-color: #f3c969;
  background: rgba(34, 40, 84, 0.96);
  transform: translateY(-1px);
}

.lb-auth-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  border: 2px solid #f3c969;
  background: #0b0d1a;
  flex-shrink: 0;
}

.lb-auth-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.lb-auth-name {
  font: 700 14px/1.15 var(--font-display, 'Kanit', sans-serif);
  color: #ffe39a;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-auth-sub {
  font: 500 11px/1.1 var(--font-body, 'IBM Plex Sans Thai', sans-serif);
  color: #b9bee0;
}

.lb-auth-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(62, 224, 143, 0.18);
  border: 1px solid rgba(62, 224, 143, 0.55);
  color: #3ee08f;
  font-size: 11px;
  font-weight: 600;
}

/* ---------- หน้าต่าง Modal ล็อกอิน / โปรไฟล์ ---------- */
#bof-auth-dialog {
  margin: auto;
  border: 0;
  border-radius: 20px;
  padding: 0;
  width: min(460px, calc(100vw - 28px));
  background: transparent;
  color: #e8eaf7;
  box-shadow: none;
  overflow: visible;
}

#bof-auth-dialog::backdrop {
  background: rgba(7, 8, 15, 0.82);
}

.bof-auth-panel {
  padding: 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, #161a38 0%, #0d1024 85%);
  border: 1px solid rgba(243, 201, 105, 0.45);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(243, 201, 105, 0.15);
  font-family: var(--font-body, 'IBM Plex Sans Thai', sans-serif);
  max-height: min(92dvh, 700px);
  overflow-y: auto;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(243, 201, 105, 0.3) rgba(15, 23, 42, 0.5);
}

.bof-auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.bof-auth-title {
  font: 700 24px/1.2 var(--font-display, 'Kanit', sans-serif);
  color: #f3c969;
  margin: 0;
}

.bof-auth-close-x {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(160, 175, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: #b9bee0;
  font-size: 18px;
  cursor: pointer;
}

.bof-auth-close-x:hover {
  color: #fff;
  border-color: #f3c969;
}

/* แท็บสลับ เข้าสู่ระบบ / สมัครสมาชิก */
.bof-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  background: #0b0d1a;
  border: 1px solid rgba(160, 175, 255, 0.18);
  margin-bottom: 16px;
}

.bof-auth-tab {
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #b9bee0;
  font: 600 14px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.bof-auth-tab.is-active {
  background: linear-gradient(135deg, #ffe39a, #e0a83c);
  color: #1a1405;
}

.bof-auth-field {
  margin-bottom: 14px;
}

.bof-auth-field label {
  display: block;
  margin-bottom: 6px;
  font: 600 13px var(--font-display, 'Kanit', sans-serif);
  color: #cbd5e1;
}

.bof-auth-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(160, 175, 255, 0.28);
  background: #0b0d1a;
  color: #fff;
  font: 500 15px var(--font-body, 'IBM Plex Sans Thai', sans-serif);
}

.bof-auth-input:focus {
  outline: none;
  border-color: #f3c969;
  box-shadow: 0 0 0 2px rgba(243, 201, 105, 0.25);
}

/* ช่องกรอกพร้อมปุ่มดูรหัสผ่าน */
.bof-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.bof-input-wrap .bof-auth-input {
  padding-right: 42px;
}

.bof-pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, transform 0.15s;
}

.bof-pw-toggle:hover {
  color: #f3c969;
  transform: translateY(-50%) scale(1.1);
}

/* บัญชีที่เคยบันทึกไว้ในเครื่องนี้ (Quick Switch) */
.bof-saved-accounts-section {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(160, 175, 255, 0.05);
  border: 1px dashed rgba(160, 175, 255, 0.25);
}

.bof-saved-accounts-title {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.bof-saved-accounts-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bof-account-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  background: rgba(22, 26, 58, 0.85);
  border: 1px solid rgba(243, 201, 105, 0.35);
  color: #ffe39a;
  font: 600 12px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.bof-account-chip:hover {
  border-color: #f3c969;
  background: rgba(34, 40, 84, 0.95);
  transform: translateY(-1px);
}

.bof-account-chip img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

/* ส่วนตั้งชื่อเล่น Guest ด่วน */
.bof-guest-quick-section {
  margin-top: 14px;
  padding-top: 10px;
}

.bof-guest-quick-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin-bottom: 10px;
  color: #64748b;
  font-size: 11px;
}

.bof-guest-quick-divider::before,
.bof-guest-quick-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bof-guest-quick-divider span {
  padding: 0 10px;
}

.bof-guest-quick-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(160, 175, 255, 0.15);
  border-radius: 10px;
  padding: 10px 12px;
}

.bof-guest-quick-box label {
  display: block;
  font-size: 12px;
  color: #cbd5e1;
}

/* เลือกรูปโปรไฟล์ลีดเดอร์ / เด็คเริ่มต้น */
.bof-avatar-scroll-wrap {
  max-height: 185px;
  overflow-y: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(243, 201, 105, 0.3) rgba(15, 23, 42, 0.5);
}

.bof-avatar-scroll-wrap::-webkit-scrollbar {
  width: 5px;
}

.bof-avatar-scroll-wrap::-webkit-scrollbar-thumb {
  background: rgba(243, 201, 105, 0.3);
  border-radius: 4px;
}

.bof-avatar-scroll-wrap::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}

.bof-avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.bof-avatar-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 6px;
  border-radius: 12px;
  border: 1.5px solid rgba(160, 175, 255, 0.18);
  background: rgba(11, 13, 26, 0.7);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.bof-avatar-option:hover {
  border-color: rgba(243, 201, 105, 0.5);
  background: rgba(243, 201, 105, 0.08);
  transform: translateY(-2px);
}

.bof-avatar-option.is-selected {
  border-color: #f3c969;
  background: rgba(243, 201, 105, 0.15);
  box-shadow: 0 0 12px rgba(243, 201, 105, 0.3);
  transform: translateY(-2px);
}

.bof-avatar-option img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  border: 2px solid rgba(160, 175, 255, 0.25);
  display: block;
  margin: 0 auto;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.bof-avatar-option:hover img {
  border-color: rgba(243, 201, 105, 0.6);
}

.bof-avatar-option.is-selected img {
  border-color: #f3c969;
  box-shadow: 0 0 12px rgba(243, 201, 105, 0.65);
  transform: scale(1.06);
}

.bof-avatar-option span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 500;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 78px;
  line-height: 1.2;
}

.bof-avatar-option.is-selected span {
  color: #ffe39a;
  font-weight: 600;
}

.bof-auth-msg {
  min-height: 20px;
  margin: 8px 0 12px;
  font-size: 13px;
  color: #fbbf24;
}

.bof-auth-msg.is-error {
  color: #f87171;
}

.bof-auth-msg.is-ok {
  color: #4ade80;
}

.bof-auth-submit {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffe39a, #e0a83c);
  color: #1a1405;
  font: 700 17px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(224, 168, 60, 0.35);
}

.bof-auth-submit:hover {
  filter: brightness(1.06);
}

.bof-auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* มุมมองโปรไฟล์เมื่อล็อกอินแล้ว */
.bof-profile-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(23, 28, 64, 0.85) 0%, rgba(13, 16, 36, 0.95) 100%);
  border: 1px solid rgba(243, 201, 105, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  margin-bottom: 12px;
}

.bof-profile-card img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  border: 2.5px solid #f3c969;
  box-shadow: 0 0 14px rgba(243, 201, 105, 0.4);
  flex-shrink: 0;
}

.bof-profile-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bof-profile-info h3 {
  margin: 0;
  font: 800 22px/1.2 var(--font-display, 'Kanit', sans-serif);
  color: #ffe39a;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bof-profile-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bof-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.bof-stat-box {
  padding: 10px 6px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(23, 28, 64, 0.6) 0%, rgba(11, 13, 26, 0.8) 100%);
  border: 1px solid rgba(160, 175, 255, 0.18);
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, border-color 0.15s;
}

.bof-stat-box:hover {
  transform: translateY(-1px);
  border-color: rgba(243, 201, 105, 0.4);
}

.bof-stat-val {
  display: block;
  font: 800 24px/1.1 var(--font-display, 'Kanit', sans-serif);
}

.bof-stat-lbl {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  margin-top: 4px;
}

/* กล่องสำรองข้อมูล & ย้ายเครื่อง */
.bof-backup-box {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.5) 0%, rgba(15, 23, 42, 0.7) 100%);
  border: 1px solid rgba(243, 201, 105, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.bof-backup-title {
  font-size: 13px;
  font-weight: 700;
  color: #fde047;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bof-backup-desc {
  font-size: 11.5px;
  color: #94a3b8;
  margin: 3px 0 10px 0;
  line-height: 1.4;
}

.bof-backup-btns {
  display: flex;
  gap: 8px;
}

.bof-backup-btn {
  flex: 1;
  height: 36px;
  border-radius: 9px;
  font: 600 12.5px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}

.bof-backup-btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1a1405;
  border: none;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.bof-backup-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.bof-backup-btn-sub {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(160, 175, 255, 0.25);
  color: #e2e8f0;
}

.bof-backup-btn-sub:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: #38bdf8;
  color: #fff;
}

/* ส่วนเปลี่ยนรูปโปรไฟล์ */
.bof-avatar-section {
  margin-bottom: 16px;
}

.bof-avatar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.bof-avatar-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  margin: 0;
}

.bof-avatar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.bof-btn-upload-avatar {
  cursor: pointer;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: 1px solid rgba(96, 165, 250, 0.4);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
  transition: all 0.15s;
}

.bof-btn-upload-avatar:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.bof-btn-reset-avatar {
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(160, 175, 255, 0.2);
  cursor: pointer;
  transition: all 0.15s;
}

.bof-btn-reset-avatar:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.bof-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.bof-btn-secondary {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(160, 175, 255, 0.28);
  background: #1a2042;
  color: #e8eaf7;
  font: 600 14px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
}

.bof-btn-secondary:hover {
  border-color: #f3c969;
  background: #232b59;
}

.bof-btn-danger {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.22) 0%, rgba(153, 27, 27, 0.35) 100%);
  color: #fca5a5;
  font: 700 14px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.bof-btn-danger:hover {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.4) 0%, rgba(185, 28, 28, 0.55) 100%);
  border-color: #f87171;
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
  transform: translateY(-1px);
}

.bof-mode-note {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px dashed rgba(148, 163, 184, 0.3);
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.45;
}

/* ============================================================================
   MULTIPLAYER ONLINE ROOM MODAL (ดวลการ์ดกับเพื่อน)
   ============================================================================ */
#pvp-room-modal .modal-box {
  max-width: 500px !important;
  width: min(500px, calc(100vw - 24px)) !important;
  box-sizing: border-box !important;
  background: linear-gradient(180deg, #171c40 0%, #0d1024 85%) !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 35px rgba(56, 189, 248, 0.2) !important;
  padding: 22px !important;
  color: #e8eaf7 !important;
  text-align: left !important;
  position: relative;
  overflow: hidden;
}

#pvp-room-modal .mp-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid rgba(160, 175, 255, 0.15) !important;
  border-radius: 0 !important;
  padding: 0 0 12px 0 !important;
  margin-bottom: 14px !important;
}

.mp-title-group h2 {
  margin: 0;
  font: 700 20px/1.2 var(--font-display, 'Kanit', sans-serif);
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-title-group p {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: #94a3b8;
}

#pvp-room-modal .mp-player-banner {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: rgba(56, 189, 248, 0.08) !important;
  border: 1px solid rgba(56, 189, 248, 0.25) !important;
  border-radius: 12px !important;
  padding: 8px 12px !important;
  margin-bottom: 14px !important;
}

.mp-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mp-banner-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #38bdf8;
  background: #080a14;
  flex-shrink: 0;
}

.mp-banner-text {
  font-size: 13px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-banner-text strong {
  color: #ffe39a;
  font-weight: 700;
}

.mp-edit-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font: 600 11.5px var(--font-display, 'Kanit', sans-serif);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.mp-edit-badge:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #7dd3fc;
  color: #fff;
  transform: translateY(-1px);
}

.mp-guest-edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #080a14 !important;
  border: 1px solid rgba(160, 175, 255, 0.3) !important;
  border-radius: 10px !important;
  padding: 8px 12px !important;
  margin-bottom: 14px !important;
}

.mp-guest-edit-row input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: #fff;
  font: 500 13.5px var(--font-body, 'IBM Plex Sans Thai', sans-serif);
  outline: none;
}

.mp-pill-btn-blue {
  background: #2563eb;
  border: none;
  border-radius: 8px;
  color: #fff;
  font: 600 12px var(--font-display, 'Kanit', sans-serif);
  padding: 6px 12px;
  cursor: pointer;
}

.mp-pill-btn-gray {
  background: #475569;
  border: none;
  border-radius: 8px;
  color: #cbd5e1;
  font: 600 12px var(--font-display, 'Kanit', sans-serif);
  padding: 6px 10px;
  cursor: pointer;
}

.mp-card {
  box-sizing: border-box !important;
  background: #111429 !important;
  border: 1px solid rgba(160, 175, 255, 0.2) !important;
  border-radius: 14px !important;
  padding: 14px !important;
  margin-bottom: 14px !important;
  width: 100% !important;
  transition: border-color 0.2s;
}

.mp-card:hover {
  border-color: rgba(56, 189, 248, 0.45) !important;
}

.mp-card-title {
  font: 700 14px var(--font-display, 'Kanit', sans-serif);
  color: #cbd5e1;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-btn-host {
  width: 100% !important;
  height: 48px !important;
  box-sizing: border-box !important;
  background: linear-gradient(135deg, #f3c969, #e0a83c) !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  color: #1a1405 !important;
  font: 700 15px var(--font-display, 'Kanit', sans-serif) !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  box-shadow: 0 6px 20px rgba(243, 201, 105, 0.3) !important;
  transition: transform 0.15s, filter 0.15s !important;
}

.mp-btn-host:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.mp-code-box-wrap {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #080a14;
  border: 1px solid rgba(74, 222, 128, 0.4);
  text-align: center;
  animation: fadeIn 0.2s ease-out;
}

.mp-code-box-label {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.mp-code-val {
  font: 800 36px/1 monospace;
  letter-spacing: 8px;
  color: #4ade80;
  text-shadow: 0 0 16px rgba(74, 222, 128, 0.5);
  margin-bottom: 12px;
}

.mp-share-group {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.mp-btn-copy, .mp-btn-link {
  flex: 1;
  height: 38px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(160, 175, 255, 0.3);
  border-radius: 9px;
  color: #e8eaf7;
  font: 600 12.5px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  transition: all 0.15s;
}

.mp-btn-copy:hover {
  background: rgba(74, 222, 128, 0.15);
  border-color: #4ade80;
  color: #86efac;
}

.mp-btn-link:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #7dd3fc;
}

.mp-waiting-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: #38bdf8;
  margin-top: 8px;
}

.mp-radar-ping {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
  animation: mp-ping 1.5s infinite;
}

.mp-btn-cancel {
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #f87171;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s;
}

.mp-btn-cancel:hover {
  background: rgba(248, 113, 113, 0.18);
}

/* Guest Join Layout: Clean Row with zero overflow */
.mp-join-row {
  display: flex !important;
  gap: 10px !important;
  align-items: stretch !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.mp-input-wrap {
  position: relative !important;
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
}

.mp-join-input {
  width: 100% !important;
  height: 48px !important;
  box-sizing: border-box !important;
  background: rgba(8, 10, 24, 0.95) !important;
  border: 1px solid rgba(160, 175, 255, 0.3) !important;
  border-radius: 12px !important;
  color: #ffe39a !important;
  font-family: var(--font-display, 'Kanit', sans-serif) !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  letter-spacing: 1px !important;
  padding: 0 62px 0 16px !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

.mp-join-input::placeholder {
  font-family: var(--font-body, 'IBM Plex Sans Thai', sans-serif) !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  letter-spacing: normal !important;
  color: #64748b !important;
}

.mp-join-input:focus {
  outline: none !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}

.mp-paste-inside {
  position: absolute !important;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  height: 32px !important;
  padding: 0 10px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(160, 175, 255, 0.25) !important;
  border-radius: 8px !important;
  color: #cbd5e1 !important;
  font: 600 12px var(--font-display, 'Kanit', sans-serif) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.15s !important;
}

.mp-paste-inside:hover {
  background: rgba(243, 201, 105, 0.18) !important;
  border-color: #f3c969 !important;
  color: #ffe39a !important;
}

.mp-btn-join {
  flex: 0 0 auto !important;
  height: 48px !important;
  padding: 0 20px !important;
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  border: 1px solid rgba(74, 222, 128, 0.5) !important;
  border-radius: 12px !important;
  color: #fff !important;
  font: 700 15px var(--font-display, 'Kanit', sans-serif) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35) !important;
  transition: transform 0.15s, filter 0.15s !important;
}

.mp-btn-join:hover {
  filter: brightness(1.1) !important;
  transform: translateY(-1px) !important;
}

.mp-btn-join:disabled, .mp-btn-host:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.mp-status-msg {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
}

.mp-status-msg.is-info {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.mp-status-msg.is-ok {
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #86efac;
}

.mp-status-msg.is-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.mp-invite-banner {
  background: linear-gradient(135deg, rgba(243, 201, 105, 0.18), rgba(56, 189, 248, 0.18));
  border: 1px solid #f3c969;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: #ffe39a;
}

.mp-btn-green {
  background: #16a34a;
  border: none;
  border-radius: 8px;
  color: #fff;
  font: 700 12.5px var(--font-display, 'Kanit', sans-serif);
  padding: 6px 12px;
  cursor: pointer;
}

@media (max-width: 767px) {
  #lb-auth-bar {
    position: relative;
    left: auto;
    top: auto;
    padding: 4px 12px 4px 4px;
  }

  #bof-auth-dialog {
    width: calc(100vw - 20px);
    border-radius: 16px;
  }

  .bof-auth-panel {
    padding: 16px 14px;
    border-radius: 16px;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bof-auth-title {
    font-size: 20px;
  }

  .bof-auth-input {
    font-size: 16px; /* ป้องกัน iOS Auto Zoom */
    height: 42px;
  }

  .bof-avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .bof-avatar-option {
    padding: 6px 2px 4px;
    border-radius: 10px;
    touch-action: manipulation;
  }

  .bof-avatar-option img {
    width: 44px;
    height: 44px;
  }

  .bof-avatar-option span {
    font-size: 10px;
    max-width: 66px;
  }

  .bof-stats-grid {
    gap: 6px;
  }

  .bof-stat-box {
    padding: 6px 4px;
  }

  .bof-stat-val {
    font-size: 18px;
  }

  .bof-stat-lbl {
    font-size: 10.5px;
  }

  .bof-auth-submit, .bof-btn-secondary, .bof-btn-danger {
    touch-action: manipulation;
  }
}
