@import url('video-history-overlay.css');

/* ==========================================================================
   Telegram Web Clone - Modern Telegram K/Z Design System
   ========================================================================== */

:root {
  --tg-font-family: -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", "Helvetica Neue", sans-serif;
  
  /* Telegram Dark Theme (Default) */
  --tg-bg-page: #0f1721;
  --tg-bg-sidebar: #17212b;
  --tg-bg-sidebar-hover: #202b36;
  --tg-bg-sidebar-active: #2b5278;
  --tg-bg-header: #17212b;
  --tg-bg-chat: #0e1621;
  --tg-bg-input: #17212b;
  --tg-bg-surface: #242f3d;
  --tg-bg-surface-hover: #2c3847;
  --tg-bg-modal: #17212b;
  
  --tg-msg-in: #182533;
  --tg-msg-out: #2b5278;
  --tg-msg-in-hover: #1e2c3c;
  --tg-msg-out-hover: #325e89;
  
  --tg-primary: #2aabee;
  --tg-primary-hover: #229ed9;
  --tg-primary-active: #1d8bc0;
  
  --tg-text-main: #f5f5f5;
  --tg-text-muted: #7f91a4;
  --tg-text-meta: #6c7883;
  --tg-text-link: #5288c1;
  --tg-border: #242f3d;
  --tg-border-light: rgba(255, 255, 255, 0.08);
  
  --tg-badge-unread: #2481cc;
  --tg-badge-admin: #f59e0b;
  --tg-online: #4fae4e;
  
  --tg-color-admin: #00a8ff;
  --tg-color-user1: #e17076;
  --tg-color-user2: #7bc862;
  --tg-color-user3: #65aadd;
  --tg-color-user4: #ee7aae;
  --tg-color-user5: #e56555;
  --tg-color-user6: #2f80ed;
  
  --tg-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --tg-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --tg-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
  
  --tg-header-height: 58px;
  --tg-sidebar-width: 360px;
  --tg-drawer-width: 360px;
  --tg-radius-sm: 6px;
  --tg-radius-md: 10px;
  --tg-radius-lg: 16px;
  --tg-radius-full: 9999px;
  --tg-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --tg-bg-page: #f1f1f1;
  --tg-bg-sidebar: #ffffff;
  --tg-bg-sidebar-hover: #f4f4f5;
  --tg-bg-sidebar-active: #e3edf8;
  --tg-bg-header: #ffffff;
  --tg-bg-chat: #92b1cd;
  --tg-bg-input: #ffffff;
  --tg-bg-surface: #ffffff;
  --tg-bg-surface-hover: #f3f4f6;
  --tg-bg-modal: #ffffff;
  
  --tg-msg-in: #ffffff;
  --tg-msg-out: #eeffde;
  --tg-msg-in-hover: #fcfcfc;
  --tg-msg-out-hover: #e5f9d3;
  
  --tg-primary: #3390ec;
  --tg-primary-hover: #2678c7;
  --tg-primary-active: #1d63a6;
  
  --tg-text-main: #000000;
  --tg-text-muted: #707579;
  --tg-text-meta: #686c72;
  --tg-text-link: #3390ec;
  --tg-border: #e0e0e0;
  --tg-border-light: rgba(0, 0, 0, 0.08);
  
  --tg-badge-unread: #3390ec;
  --tg-badge-admin: #d97706;
  --tg-online: #00c73c;
  
  --tg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --tg-shadow-md: 0 4px 10px rgba(0, 0, 0, 0.1);
  --tg-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--tg-font-family);
  background-color: var(--tg-bg-page);
  color: var(--tg-text-main);
  height: 100% !important;
  height: 100dvh !important;
  height: 100vh;
  width: 100vw !important;
  max-width: 100vw !important;
  overflow: hidden !important;
  margin: 0;
  padding: 0;
  display: flex !important;
  flex-direction: column !important;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* Telegram App Container */
.tg-app {
  display: flex !important;
  flex-direction: row !important;
  flex: 1 1 0% !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  position: relative;
  background-color: var(--tg-bg-chat);
  overflow: hidden !important;
}


/* ==========================================================================
   Left Sidebar: Chats & Header
   ========================================================================== */
.tg-sidebar {
  width: var(--tg-sidebar-width);
  height: 100% !important;
  max-height: 100vh !important;
  background-color: var(--tg-bg-sidebar);
  border-right: 1px solid var(--tg-border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  flex-shrink: 0;
  overflow: hidden !important;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s ease, opacity 0.2s ease;
}

.tg-sidebar-header {
  height: var(--tg-header-height);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--tg-border-light);
}

.tg-btn-icon {
  background: transparent;
  border: none;
  color: var(--tg-text-muted);
  width: 40px;
  height: 40px;
  border-radius: var(--tg-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--tg-transition);
}

.tg-btn-icon:hover {
  background-color: var(--tg-bg-sidebar-hover);
  color: var(--tg-text-main);
}

.tg-search-bar {
  flex: 1;
  display: flex;
  align-items: center;
  background-color: var(--tg-bg-surface);
  border-radius: 20px;
  padding: 6px 14px;
  gap: 8px;
}

.tg-search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--tg-text-main);
  font-size: 14px;
  width: 100%;
}

.tg-search-bar input::placeholder {
  color: var(--tg-text-muted);
}

/* Active User & Admin Status Pill in Sidebar */
.tg-user-status-card {
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(42, 171, 238, 0.12), rgba(36, 129, 204, 0.05));
  border-bottom: 1px solid var(--tg-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--tg-transition);
}

.tg-user-status-card:hover {
  background: rgba(42, 171, 238, 0.18);
}

.tg-current-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.tg-avatar-user {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.tg-avatar-user .tg-online-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background-color: var(--tg-online);
  border: 2px solid var(--tg-bg-sidebar);
  border-radius: 50%;
}

.tg-current-user-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tg-current-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tg-admin-badge-pill {
  font-size: 10px;
  padding: 2px 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-radius: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tg-current-user-email {
  font-size: 11px;
  color: var(--tg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-switch-btn {
  font-size: 11px;
  padding: 5px 10px;
  background-color: var(--tg-primary);
  color: #fff;
  border: none;
  border-radius: var(--tg-radius-full);
  cursor: pointer;
  font-weight: 500;
  transition: var(--tg-transition);
  white-space: nowrap;
}

.tg-switch-btn:hover {
  background-color: var(--tg-primary-hover);
}

/* User Status Card Action Buttons */
.tg-user-status-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.tg-card-btn-profile {
  font-size: 11px;
  padding: 5px 9px;
  background: rgba(0, 136, 204, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(0, 136, 204, 0.35);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--tg-transition);
}

.tg-card-btn-profile:hover {
  background: rgba(0, 136, 204, 0.3);
  color: #fff;
}

.tg-card-btn-auth {
  font-size: 11px;
  padding: 5px 9px;
  background: var(--tg-bg-surface);
  color: var(--tg-text-main);
  border: 1px solid var(--tg-border-light);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--tg-transition);
}

.tg-card-btn-auth:hover {
  background: var(--tg-bg-sidebar-hover);
}

.tg-card-btn-logout {
  font-size: 11px;
  padding: 5px 9px;
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--tg-transition);
}

.tg-card-btn-logout:hover {
  background: rgba(239, 68, 68, 0.28) !important;
  color: #ffffff !important;
}

/* Header Profile Button */
.tg-header-profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  background: rgba(0, 136, 204, 0.14);
  color: #38bdf8;
  border: 1px solid rgba(0, 136, 204, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  padding: 0;
}

.tg-header-profile-btn:hover {
  background: rgba(0, 136, 204, 0.28);
  transform: scale(1.05);
}

.tg-drawer-back-btn {
  display: none;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--tg-text-main);
  background: transparent;
  border: none;
}

/* Chat List Items */
.tg-chats-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.tg-chats-list::-webkit-scrollbar {
  width: 5px;
}
.tg-chats-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.tg-chat-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  gap: 12px;
  cursor: pointer;
  transition: var(--tg-transition);
  position: relative;
}

.tg-chat-item:hover {
  background-color: var(--tg-bg-sidebar-hover);
}

.tg-chat-item.active {
  background-color: var(--tg-bg-sidebar-active);
}

.tg-chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(135deg, #0088cc, #2481cc);
}

.tg-chat-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tg-chat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tg-chat-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tg-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tg-verified-icon {
  color: var(--tg-primary);
  font-size: 13px;
}

.tg-chat-time {
  font-size: 11px;
  color: var(--tg-text-meta);
  white-space: nowrap;
}

.tg-chat-preview {
  font-size: 13px;
  color: var(--tg-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-chat-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-badge-count {
  background-color: var(--tg-badge-unread);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 7px;
  border-radius: 10px;
}

.tg-badge-pinned {
  color: var(--tg-text-meta);
  font-size: 13px;
}

/* Sidebar Footer / Quick Actions */
.tg-sidebar-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--tg-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--tg-bg-sidebar);
}

.tg-db-status-badge {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--tg-text-muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--tg-radius-sm);
  background-color: var(--tg-bg-surface);
  border: 1px solid rgba(16, 185, 129, 0.2);
  transition: all 0.2s ease;
  user-select: none;
}

.tg-db-status-badge:hover {
  background-color: var(--tg-bg-input);
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

.tg-db-status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  position: relative;
  flex-shrink: 0;
}

.tg-db-status-badge .dot.live-dot {
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: tgLivePulse 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes tgLivePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.tg-spin {
  display: inline-block;
  animation: tgSpin 0.8s linear infinite;
}

@keyframes tgSpin {
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Chat Room Main View
   ========================================================================== */
.tg-chat-area {
  flex: 1 1 0% !important;
  height: 100% !important;
  max-height: 100vh !important;
  min-height: 0 !important;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden !important;
  background-color: var(--tg-bg-chat);
  /* Telegram classic subtle doodle background */
  background-image: radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                    radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

/* Header */
.tg-chat-header {
  height: var(--tg-header-height);
  background-color: var(--tg-bg-header);
  border-bottom: 1px solid var(--tg-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 5;
  box-shadow: var(--tg-shadow-sm);
}

.tg-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.tg-chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, #0088cc, #2481cc);
  color: #fff;
}

.tg-chat-header-titles {
  display: flex;
  flex-direction: column;
}

.tg-chat-header-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--tg-text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-chat-header-sub {
  font-size: 12px;
  color: var(--tg-text-muted);
}

.tg-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-header-stream-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(0, 136, 204, 0.45);
  background: rgba(0, 136, 204, 0.12);
  color: #38bdf8;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
}

.tg-header-stream-toggle-btn:hover {
  background: rgba(0, 136, 204, 0.25);
  transform: translateY(-1px);
}

.tg-header-stream-toggle-btn.is-off {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
}

.tg-header-stream-toggle-btn.is-off:hover {
  background: rgba(239, 68, 68, 0.24);
}

.tg-stream-off-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.2s ease;
}

.tg-stream-off-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.6);
}

@media (max-width: 600px) {
  .tg-header-stream-toggle-btn {
    padding: 3px 6px;
    font-size: 10px;
    gap: 3px;
  }
}

/* Pinned Message Bar */
.tg-pinned-bar {
  background-color: var(--tg-bg-header);
  border-bottom: 1px solid var(--tg-border-light);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  z-index: 4;
  transition: var(--tg-transition);
}

.tg-pinned-bar:hover {
  background-color: var(--tg-bg-surface-hover);
}

.tg-pinned-left {
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 3px solid var(--tg-primary);
  padding-left: 10px;
  flex: 1;
  overflow: hidden;
}

.tg-pinned-texts {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tg-pinned-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--tg-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-pinned-snippet {
  font-size: 12px;
  color: var(--tg-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-pinned-close-btn {
  background: transparent;
  border: none;
  color: var(--tg-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.tg-pinned-close-btn:hover {
  color: #ef4444;
}

/* Messages Container with Native Hardware Momentum Scrolling */
.tg-messages-canvas {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  scroll-behavior: auto !important;
  transform: translateZ(0);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tg-stream-post-wrapper,
.tg-auto-video-stream-card {
  contain: layout paint;
  content-visibility: auto;
  contain-intrinsic-size: 280px;
}

.tg-messages-canvas::-webkit-scrollbar {
  width: 6px;
}
.tg-messages-canvas::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

/* Date Separator Pill */
.tg-date-pill {
  align-self: center;
  background-color: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  margin: 12px 0 6px 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Message Item */
.tg-msg-wrapper {
  display: flex;
  gap: 8px;
  max-width: 75%;
  position: relative;
  animation: fadeInMsg 0.2s ease;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tg-msg-wrapper.incoming {
  align-self: flex-start;
}

.tg-msg-wrapper.outgoing {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.tg-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  flex-shrink: 0;
  margin-top: auto;
  margin-bottom: 2px;
}

/* Message Bubble */
.tg-msg-bubble {
  background-color: var(--tg-msg-in);
  padding: 8px 12px;
  border-radius: var(--tg-radius-lg);
  box-shadow: var(--tg-shadow-sm);
  position: relative;
  word-break: break-word;
  user-select: text;
  min-width: 120px;
}

.tg-msg-wrapper.incoming .tg-msg-bubble {
  border-bottom-left-radius: 4px;
}

.tg-msg-wrapper.outgoing .tg-msg-bubble {
  background-color: var(--tg-msg-out);
  border-bottom-right-radius: 4px;
}

/* Bubble Header (Author Name + Admin Badge) */
.tg-msg-author {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.tg-badge-admin-tag {
  font-size: 9px;
  padding: 1px 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.tg-badge-mod-tag {
  font-size: 9px;
  padding: 1px 6px;
  background: #0284c7;
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Quoted Reply inside Bubble (Rich Interactive Embed) */
.tg-quote-box {
  background-color: rgba(15, 23, 42, 0.45);
  border-left: 3.5px solid var(--tg-primary, #0088cc);
  padding: 5px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.tg-quote-box:hover {
  background-color: rgba(42, 171, 238, 0.16);
  border-left-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(42, 171, 238, 0.25);
}

.tg-quote-box:active {
  transform: scale(0.99);
}

.tg-quote-user {
  font-weight: 700;
  color: var(--tg-primary, #38bdf8);
  font-size: 11.5px;
  letter-spacing: 0.2px;
}

.tg-quote-text {
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
  line-height: 1.35;
}

/* Message Text */
.tg-msg-content {
  font-size: 14px;
  line-height: 1.45;
  color: var(--tg-text-main);
  white-space: pre-wrap;
}

.tg-msg-content a {
  color: #64b5f6;
  text-decoration: underline;
}

/* Media preview if any */
.tg-msg-media {
  margin-top: 6px;
  border-radius: var(--tg-radius-md);
  overflow: hidden;
  max-width: 340px;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tg-msg-media:hover {
  transform: scale(1.015);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.tg-msg-media:active {
  transform: scale(0.985);
}

.tg-msg-media img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: filter 0.2s ease;
}

.tg-msg-media:hover img {
  filter: brightness(1.05);
}

.tg-media-zoom-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #fff;
  border-radius: 20px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.9;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tg-msg-media:hover .tg-media-zoom-overlay {
  opacity: 1;
  transform: scale(1.05);
}

/* Message Meta (Time & Status Checks) */
.tg-msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  float: right;
  margin-left: 12px;
}

.tg-msg-time {
  font-size: 11px;
  color: var(--tg-text-meta);
}

.tg-msg-ticks {
  font-size: 12px;
  color: #4fae4e;
}

/* Reactions Bar below bubble */
.tg-reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tg-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(0, 0, 0, 0.25);
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--tg-transition);
  border: 1px solid transparent;
}

.tg-reaction-chip:hover {
  background-color: rgba(0, 0, 0, 0.4);
}

.tg-reaction-chip.reacted {
  background-color: rgba(42, 171, 238, 0.2);
  border-color: var(--tg-primary);
}

/* Hover & Tap Action Buttons for Message */
.tg-msg-actions {
  position: absolute;
  top: -12px;
  right: 8px;
  background-color: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: 18px;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  box-shadow: var(--tg-shadow-md);
  z-index: 20;
}

.tg-msg-wrapper:hover .tg-msg-actions,
.tg-msg-wrapper.show-actions .tg-msg-actions,
.tg-msg-wrapper:focus-within .tg-msg-actions {
  display: flex !important;
}

.tg-action-btn {
  background: transparent;
  border: none;
  color: var(--tg-text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: var(--tg-transition);
}

.tg-action-btn:hover {
  background-color: var(--tg-bg-sidebar-hover);
  color: var(--tg-text-main);
  transform: scale(1.1);
}

.tg-action-btn.tg-action-reply:hover {
  color: var(--tg-primary);
  background-color: rgba(42, 171, 238, 0.18);
}

/* Quick 1-Tap Reply Icon on Message Meta Bar */
.tg-msg-quick-reply-btn {
  background: transparent;
  border: none;
  color: var(--tg-text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 0 4px;
  margin-left: 2px;
  opacity: 0.65;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tg-msg-quick-reply-btn:hover {
  opacity: 1;
  color: var(--tg-primary);
  transform: scale(1.2);
}

.tg-quote-box {
  transition: all 0.2s ease;
}

.tg-quote-box:hover {
  background-color: rgba(42, 171, 238, 0.18);
  border-left-color: #38bdf8;
}

/* ==========================================================================
   Chat Input Area & Reply Preview
   ========================================================================== */
.tg-chat-input-wrapper {
  background-color: var(--tg-bg-input);
  border-top: 1px solid var(--tg-border-light);
  display: flex;
  flex-direction: column;
  padding: 10px 18px;
  gap: 8px;
  position: relative;
  z-index: 10;
  flex-shrink: 0 !important;
}

/* Replying Banner */
.tg-reply-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--tg-bg-surface);
  padding: 6px 12px;
  border-radius: var(--tg-radius-md);
  border-left: 3px solid var(--tg-primary);
}

.tg-reply-banner-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tg-reply-banner-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--tg-primary);
}

.tg-reply-banner-snippet {
  font-size: 12px;
  color: var(--tg-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-reply-close {
  background: transparent;
  border: none;
  color: var(--tg-text-muted);
  cursor: pointer;
  padding: 4px;
}

.tg-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.tg-input-box-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  background: var(--tg-bg-surface);
  border-radius: 20px;
  padding: 6px 14px;
  border: 1px solid var(--tg-border-light);
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tg-input-box-wrapper:focus-within {
  border-color: var(--tg-primary);
  box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.2);
}

.tg-input-textarea {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  background: transparent;
  border: none;
  outline: none;
  color: var(--tg-text-main);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  line-height: 1.4;
  padding: 0;
  box-sizing: border-box;
}

.tg-input-textarea::placeholder {
  color: var(--tg-text-muted);
}

.tg-send-btn {
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  background: linear-gradient(135deg, #0088cc, #2AABEE) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-radius: 20px;
  color: #fff;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0 !important;
  transition: var(--tg-transition);
  box-shadow: 0 2px 10px rgba(42, 171, 238, 0.45);
  visibility: visible !important;
  opacity: 1 !important;
}

.tg-send-btn:hover {
  background: linear-gradient(135deg, #0099e6, #38bdf8) !important;
  transform: scale(1.04);
  box-shadow: 0 4px 14px rgba(42, 171, 238, 0.65);
}

.tg-send-btn:active {
  transform: scale(0.95);
}

.tg-send-btn-label {
  display: inline-block !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  letter-spacing: 0.3px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

/* ==========================================================================
   Emoji & Sticker Picker Popover
   ========================================================================== */
.tg-picker-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px;
  width: 340px;
  max-width: calc(100vw - 24px);
  height: 290px;
  background-color: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: var(--tg-radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
  display: none;
  flex-direction: column;
  z-index: 500 !important;
  overflow: hidden;
  touch-action: pan-y;
}

.tg-picker-popover.open {
  display: flex !important;
  animation: tgFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-picker-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--tg-border-light);
  background-color: var(--tg-bg-sidebar);
  position: relative;
}

.tg-picker-tab {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  font-size: 13px;
  cursor: pointer;
  color: var(--tg-text-muted);
  font-weight: 500;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tg-picker-tab:hover {
  color: var(--tg-text-main);
}

.tg-picker-tab.active {
  color: var(--tg-primary);
  border-bottom: 2px solid var(--tg-primary);
  font-weight: 700;
  background: rgba(42, 171, 238, 0.08);
}

.tg-picker-close-btn {
  background: transparent;
  border: none;
  color: var(--tg-text-muted);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  margin-right: 6px;
  transition: all 0.15s ease;
}

.tg-picker-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.tg-picker-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
  font-size: 22px;
}

.tg-picker-emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: transform 0.1s;
}

.tg-picker-emoji-item:hover {
  background-color: var(--tg-bg-sidebar-hover);
  transform: scale(1.2);
}

/* Sticker Grid & Items */
.tg-picker-grid.is-stickers {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px;
}

.tg-picker-sticker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.tg-picker-sticker-item:hover {
  background: var(--tg-bg-sidebar-hover);
  border-color: var(--tg-border-light);
  transform: translateY(-2px) scale(1.08);
}

.tg-picker-sticker-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.2));
}

.tg-picker-sticker-name {
  font-size: 10px;
  color: var(--tg-text-muted);
  margin-top: 3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58px;
}

/* Telegram Sticker Message Bubble */
.tg-msg-bubble.is-sticker-bubble {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  max-width: 180px;
  position: relative;
}

.tg-sticker-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
  padding: 2px;
}

.tg-sticker-img {
  width: 140px;
  height: 140px;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
}

.tg-sticker-img:hover {
  transform: scale(1.06);
}

.tg-sticker-meta-pill {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

/* Quick Reaction Bar on Hover */
.tg-quick-reactions {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: 24px;
  padding: 4px 8px;
  display: none;
  gap: 6px;
  box-shadow: var(--tg-shadow-lg);
  z-index: 20;
}

.tg-quick-reaction-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s;
  padding: 2px 4px;
}

.tg-quick-reaction-btn:hover {
  transform: scale(1.3);
}

/* ==========================================================================
   Group Info Slide-out Drawer
   ========================================================================== */
.tg-group-drawer {
  width: var(--tg-drawer-width);
  height: 100%;
  background-color: var(--tg-bg-sidebar);
  border-left: 1px solid var(--tg-border);
  display: flex;
  flex-direction: column;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 20;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s;
  box-shadow: var(--tg-shadow-lg);
  visibility: hidden;
  pointer-events: none;
}

.tg-group-drawer.open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.tg-drawer-header {
  height: var(--tg-header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--tg-border-light);
}

.tg-drawer-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--tg-text-main);
}

.tg-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tg-drawer-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.tg-drawer-big-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  background: linear-gradient(135deg, #0088cc, #2481cc);
  color: #fff;
  box-shadow: var(--tg-shadow-md);
}

.tg-drawer-group-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--tg-text-main);
}

.tg-drawer-group-members {
  font-size: 13px;
  color: var(--tg-text-muted);
}

.tg-drawer-section {
  background-color: var(--tg-bg-surface);
  border-radius: var(--tg-radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tg-drawer-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--tg-text-muted);
  letter-spacing: 0.5px;
}

.tg-invite-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.tg-invite-link-text {
  color: var(--tg-primary);
  font-family: monospace;
}

.tg-copy-btn {
  background: transparent;
  border: none;
  color: var(--tg-text-muted);
  cursor: pointer;
  padding: 4px;
}

.tg-copy-btn:hover {
  color: #fff;
}

/* Members List */
.tg-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--tg-border-light);
}

.tg-member-item:last-child {
  border-bottom: none;
}

.tg-member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
}

.tg-member-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tg-member-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-member-status {
  font-size: 11px;
  color: var(--tg-text-muted);
}

.tg-member-role-badge {
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

.tg-role-owner {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.tg-role-admin {
  background: rgba(42, 171, 238, 0.2);
  color: #2aabee;
}

/* ==========================================================================
   Modals: Admin Switcher & DB Status
   ========================================================================== */
.tg-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.tg-modal-overlay.open {
  display: flex !important;
  z-index: 2147483648 !important;
  pointer-events: auto !important;
}

.tg-modal-box {
  background-color: var(--tg-bg-modal);
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius-lg);
  width: 90%;
  max-width: 480px;
  box-shadow: var(--tg-shadow-lg);
  overflow: hidden;
  animation: modalPop 0.2s ease;
  position: relative !important;
  z-index: 2147483649 !important;
  pointer-events: auto !important;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.tg-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--tg-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tg-modal-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tg-admin-highlight-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(42, 171, 238, 0.15));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--tg-radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tg-user-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--tg-radius-md);
  background-color: var(--tg-bg-surface);
  cursor: pointer;
  transition: var(--tg-transition);
}

.tg-user-pick-item:hover {
  background-color: var(--tg-bg-surface-hover);
}

.tg-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--tg-border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.tg-btn-secondary {
  padding: 8px 16px;
  background-color: var(--tg-bg-surface);
  color: var(--tg-text-main);
  border: 1px solid var(--tg-border-light);
  border-radius: var(--tg-radius-md);
  cursor: pointer;
  font-weight: 600;
}

.tg-btn-primary {
  padding: 8px 16px;
  background-color: var(--tg-primary);
  color: #fff;
  border: none;
  border-radius: var(--tg-radius-md);
  cursor: pointer;
  font-weight: 600;
}

.tg-btn-primary:hover {
  background-color: var(--tg-primary-hover);
}

/* Audio Waveform Animation for Voice Note */
.tg-voice-recording {
  display: none;
  align-items: center;
  gap: 8px;
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
}

.tg-voice-recording.active {
  display: flex;
}

.tg-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ef4444;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
  100% { transform: scale(0.9); opacity: 1; }
}

/* ==========================================================================
   Responsive Desktop & Mobile Synchronization Layout
   Seamlessly handles desktop full screen, half screen / split-window, 
   and mobile viewports while connecting to the live database together.
   ========================================================================== */
@media (max-width: 768px) {
  .tg-app {
    overflow: hidden;
    position: relative;
  }
  .tg-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 50 !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }
  .tg-app.chat-open .tg-sidebar {
    transform: translateX(-100%) !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
  .tg-chat-area {
    width: 100% !important;
    max-width: 100% !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 10 !important;
    transform: translateX(100%) !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .tg-app.chat-open .tg-chat-area {
    transform: translateX(0) !important;
    z-index: 50 !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }
  .tg-mobile-back-btn {
    display: inline-flex !important;
    visibility: visible !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 22px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    z-index: 100 !important;
    flex-shrink: 0 !important;
  }
  .tg-desktop-toggle-sidebar-btn {
    display: none !important;
  }
  .tg-sidebar-collapse-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 20px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    z-index: 100 !important;
    flex-shrink: 0 !important;
  }
  .tg-drawer-back-btn {
    display: inline-flex !important;
    visibility: visible !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 22px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    z-index: 100 !important;
    flex-shrink: 0 !important;
  }
  .tg-chat-header {
    padding: 0 8px !important;
    gap: 6px !important;
  }
  .tg-chat-header-info {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
    gap: 8px !important;
  }
  .tg-chat-header-avatar {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    font-size: 16px !important;
  }
  .tg-chat-header-titles {
    min-width: 0 !important;
    overflow: hidden !important;
  }
  .tg-chat-header-name {
    font-size: 13px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .tg-chat-header-sub {
    font-size: 10.5px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .tg-chat-header-actions {
    gap: 4px !important;
    flex-shrink: 0 !important;
  }
  .tg-group-drawer {
    width: 100% !important;
    max-width: 100% !important;
    z-index: 60 !important;
  }
}

@media (min-width: 769px) {
  .tg-sidebar {
    position: relative !important;
    width: var(--tg-sidebar-width, 360px) !important;
    transform: none !important;
    pointer-events: auto !important;
    z-index: 10 !important;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s ease, opacity 0.2s ease !important;
  }
  .tg-chat-area {
    position: relative !important;
    flex: 1 1 0% !important;
    width: auto !important;
    z-index: 5 !important;
  }
  .tg-mobile-back-btn {
    display: none !important;
  }
  .tg-desktop-toggle-sidebar-btn {
    display: inline-flex !important;
  }
  .tg-sidebar-collapse-btn {
    display: inline-flex !important;
  }
  .tg-drawer-back-btn {
    display: none !important;
  }
}

/* Sidebar hidden state (Collapse left corner group/chat list) */
.tg-app.sidebar-hidden .tg-sidebar {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border-right: none !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(-100%) !important;
}

.tg-app.sidebar-hidden .tg-chat-area {
  width: 100% !important;
  flex: 1 1 100% !important;
  max-width: 100vw !important;
}

.tg-desktop-toggle-sidebar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

.tg-sidebar-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--tg-text-muted);
  cursor: pointer;
  padding: 4px;
}

.tg-sidebar-collapse-btn:hover {
  color: var(--tg-text-main);
  background-color: var(--tg-bg-sidebar-hover);
}

/* ==========================================================================
   Raw Camera & Live Media Studio Styles
   ========================================================================== */
.tg-camera-modal-box {
  max-width: 580px;
  max-height: 94dvh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.tg-camera-modal-box .tg-modal-body {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  max-height: calc(94dvh - 70px) !important;
  padding: 14px 16px 24px 16px !important;
  display: flex !important;
  flex-direction: column !important;
}

.tg-camera-tabs {
  display: flex;
  background-color: var(--tg-bg-sidebar);
  border-bottom: 1px solid var(--tg-border-light);
}

.tg-camera-tab {
  flex: 1;
  padding: 10px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-text-muted);
  cursor: pointer;
  transition: var(--tg-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tg-camera-tab.active {
  color: var(--tg-primary);
  border-bottom: 2px solid var(--tg-primary);
  background-color: rgba(42, 171, 238, 0.06);
}

.tg-camera-tab.locked {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.tg-policy-notice {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--tg-radius-md);
  padding: 8px 12px;
  font-size: 11px;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-camera-viewfinder-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: #000;
  border-radius: var(--tg-radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.tg-camera-viewfinder-container.round-mode {
  width: 280px;
  height: 280px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  margin: 0 auto;
  border: 3px solid var(--tg-primary);
  box-shadow: 0 0 25px rgba(42, 171, 238, 0.4);
}

.tg-camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror selfie feed */
}

.tg-camera-canvas {
  display: none;
}

.tg-camera-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
}

.tg-hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tg-hud-live-tag {
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.5px;
}

.tg-hud-center-crosshair {
  align-self: center;
  width: 32px;
  height: 32px;
  border: 1px dashed rgba(255, 255, 255, 0.4);
  border-radius: 50%;
}

.tg-camera-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0 4px 0;
}

.tg-shutter-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid #fff;
  background-color: var(--tg-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  transition: transform 0.15s, background-color 0.15s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.tg-shutter-btn:hover {
  transform: scale(1.08);
  background-color: var(--tg-primary-hover);
}

.tg-shutter-btn:active {
  transform: scale(0.92);
}

.tg-video-record-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid #fff;
  background-color: #ef4444;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: transform 0.15s, background-color 0.15s;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.tg-video-record-btn.recording {
  animation: pulseRecord 1.2s infinite;
  border-radius: 12px;
  width: 52px;
  height: 52px;
}

@keyframes pulseRecord {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Captured Preview Box */
.tg-capture-preview-box {
  display: none;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.tg-capture-preview-box.active {
  display: flex;
}

.tg-preview-media-container {
  width: 100%;
  max-height: 230px !important;
  border-radius: var(--tg-radius-md);
  overflow: hidden;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tg-preview-media-container.round-preview {
  width: 200px !important;
  height: 200px !important;
  max-height: 200px !important;
  border-radius: 50%;
  margin: 0 auto;
  border: 3px solid var(--tg-primary);
}

.tg-preview-media-container img,
.tg-preview-media-container video {
  max-width: 100%;
  max-height: 230px !important;
  object-fit: contain;
}

/* Ensure Post Sending Button is Always 100% Visible & Prominent */
#tg-btn-send-capture {
  background: linear-gradient(135deg, #0088cc, #2AABEE) !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  padding: 12px 20px !important;
  border-radius: 8px !important;
  border: none !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  box-shadow: 0 4px 14px rgba(0, 136, 204, 0.45) !important;
  min-height: 42px !important;
  transition: all 0.2s ease !important;
}
#tg-btn-send-capture:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 136, 204, 0.6) !important;
}
#tg-btn-retake {
  min-height: 42px !important;
  padding: 10px 16px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

/* In-Chat Message Badges & Media Formats */
.tg-raw-camera-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 8px;
  margin-top: 6px;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tg-raw-camera-tag:hover {
  background: rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.tg-raw-camera-tag .tg-zoom-hint,
.tg-video-note-badge .tg-zoom-hint {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  margin-left: 2px;
}

/* Telegram Round Video Note in Chat */
.tg-round-video-wrapper {
  margin-top: 6px;
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--tg-shadow-md);
  border: 2px solid rgba(42, 171, 238, 0.6);
  background-color: #000;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tg-round-video-wrapper.is-full-size,
.tg-round-video-wrapper.is-admin-mp4 {
  width: 100% !important;
  max-width: 840px !important;
  height: auto !important;
  aspect-ratio: 16 / 9 !important;
  border-radius: 12px !important;
  border: 2px solid rgba(245, 158, 11, 0.7) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.25) !important;
}

.tg-round-video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tg-round-video-wrapper.is-full-size video {
  object-fit: contain !important;
  border-radius: 10px !important;
}

.tg-video-note-badge {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 22, 33, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  pointer-events: auto !important;
  cursor: pointer !important;
  z-index: 25 !important;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
}

.tg-video-note-badge:hover {
  background: rgba(2, 132, 199, 0.95);
  border-color: #38bdf8;
  color: #fff;
  transform: translateX(-50%) scale(1.04);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4);
}

.tg-video-note-badge:active {
  transform: translateX(-50%) scale(0.96);
}

.tg-round-cinema-pill,
.tg-round-expand-pill {
  position: absolute;
  top: 8px;
  background: rgba(14, 22, 33, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 25 !important;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.tg-round-cinema-pill {
  right: 8px;
}

.tg-round-cinema-pill:hover {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
  transform: scale(1.05);
}

.tg-round-expand-pill {
  left: 8px;
}

.tg-round-expand-pill:hover {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
  transform: scale(1.05);
}

/* Telegram Voice Note Bubble */
.tg-voice-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  min-width: 220px;
  max-width: 320px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease;
}

.tg-voice-bubble:active {
  opacity: 0.9;
}

.tg-voice-play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--tg-primary);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 15px;
  padding: 0;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, background-color 0.2s ease;
}

.tg-voice-play-btn:hover {
  transform: scale(1.06);
}

.tg-voice-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.tg-voice-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  width: 100%;
  cursor: pointer;
  padding: 2px 0;
}

.tg-waveform-bar {
  flex: 1;
  min-width: 2px;
  max-width: 4px;
  border-radius: 2px;
  transition: background-color 0.12s ease;
}

/* Default / Dark Theme - Incoming */
.tg-msg-wrapper.incoming .tg-voice-bubble .tg-waveform-bar {
  background-color: rgba(255, 255, 255, 0.35);
}
.tg-msg-wrapper.incoming .tg-voice-bubble .tg-waveform-bar.played {
  background-color: var(--tg-primary);
}
.tg-msg-wrapper.incoming .tg-voice-bubble .tg-voice-play-btn {
  background-color: var(--tg-primary);
  color: #fff;
}
.tg-msg-wrapper.incoming .tg-voice-bubble .tg-voice-duration {
  color: var(--tg-text-meta);
}
.tg-msg-wrapper.incoming .tg-voice-bubble .tg-voice-badge {
  color: var(--tg-text-meta);
}

/* Default / Dark Theme - Outgoing */
.tg-msg-wrapper.outgoing .tg-voice-bubble .tg-waveform-bar {
  background-color: rgba(255, 255, 255, 0.4);
}
.tg-msg-wrapper.outgoing .tg-voice-bubble .tg-waveform-bar.played {
  background-color: #ffffff;
}
.tg-msg-wrapper.outgoing .tg-voice-bubble .tg-voice-play-btn {
  background-color: #2aabee;
  color: #fff;
}
.tg-msg-wrapper.outgoing .tg-voice-bubble .tg-voice-duration {
  color: rgba(255, 255, 255, 0.75);
}
.tg-msg-wrapper.outgoing .tg-voice-bubble .tg-voice-badge {
  color: rgba(255, 255, 255, 0.65);
}

/* Light Theme Overrides - High Contrast & Authentic Telegram Colors */
[data-theme="light"] .tg-msg-wrapper.incoming .tg-voice-bubble .tg-waveform-bar {
  background-color: #b0b7bc; /* Crisply visible slate-gray on pure white */
}
[data-theme="light"] .tg-msg-wrapper.incoming .tg-voice-bubble .tg-waveform-bar.played {
  background-color: #3390ec;
}
[data-theme="light"] .tg-msg-wrapper.incoming .tg-voice-bubble .tg-voice-play-btn {
  background-color: #3390ec;
  color: #fff;
}
[data-theme="light"] .tg-msg-wrapper.incoming .tg-voice-bubble .tg-voice-duration {
  color: #707579;
}
[data-theme="light"] .tg-msg-wrapper.incoming .tg-voice-bubble .tg-voice-badge {
  color: #8c9398;
}

[data-theme="light"] .tg-msg-wrapper.outgoing .tg-voice-bubble .tg-waveform-bar {
  background-color: #92d690; /* Authentic Telegram crisp green waveform on #eeffde */
}
[data-theme="light"] .tg-msg-wrapper.outgoing .tg-voice-bubble .tg-waveform-bar.played {
  background-color: #388e3c;
}
[data-theme="light"] .tg-msg-wrapper.outgoing .tg-voice-bubble .tg-voice-play-btn {
  background-color: #4fae4e;
  color: #fff;
}
[data-theme="light"] .tg-msg-wrapper.outgoing .tg-voice-bubble .tg-voice-duration {
  color: #388e3c;
}
[data-theme="light"] .tg-msg-wrapper.outgoing .tg-voice-bubble .tg-voice-badge {
  color: #4a804c;
}

/* Voice Info Row (Duration + Label) */
.tg-voice-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1;
}

.tg-voice-duration {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tg-voice-badge {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.8;
  letter-spacing: 0.2px;
}

/* Lightbox Voice Card */
.tg-lightbox-voice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: rgba(23, 33, 43, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 28px 24px;
  width: 90%;
  max-width: 380px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.tg-lightbox-voice-mic-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0088cc, #2aabee);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: 0 0 24px rgba(42, 171, 238, 0.4);
  animation: micPulseRing 2s infinite ease-in-out;
}

@keyframes micPulseRing {
  0% { transform: scale(1); box-shadow: 0 0 16px rgba(42, 171, 238, 0.3); }
  50% { transform: scale(1.05); box-shadow: 0 0 32px rgba(42, 171, 238, 0.6); }
  100% { transform: scale(1); box-shadow: 0 0 16px rgba(42, 171, 238, 0.3); }
}

.tg-lightbox-voice-card .tg-voice-bubble {
  width: 100%;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
}

/* ==========================================================================
   1-Click Remove Post & Banned Users UI
   ========================================================================== */
.tg-toast-pill {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: rgba(23, 33, 43, 0.95);
  backdrop-filter: blur(10px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
}

.tg-toast-pill.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tg-action-del:hover {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #ef4444 !important;
}

.tg-action-ban:hover {
  background-color: rgba(245, 158, 11, 0.2) !important;
  color: #f59e0b !important;
}

.tg-member-ban-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--tg-transition);
}

.tg-member-ban-btn:hover {
  background: #ef4444;
  color: #fff;
}

.tg-member-unban-btn {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--tg-transition);
}

.tg-member-unban-btn:hover {
  background: #10b981;
  color: #fff;
}

.tg-member-purge-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--tg-transition);
}

.tg-member-purge-btn:hover {
  background: #f59e0b;
  color: #fff;
}

/* ==========================================================================
   Telegram User Profile Settings Dashboard
   ========================================================================== */
.tg-profile-modal-box {
  max-width: 500px;
  background-color: var(--tg-bg-modal);
}

.tg-profile-header-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(42, 171, 238, 0.12) 0%, transparent 100%);
  border-bottom: 1px solid var(--tg-border-light);
}

.tg-profile-avatar-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.tg-profile-avatar-big {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: bold;
  color: #fff;
  overflow: hidden;
}

.tg-profile-avatar-big img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tg-avatar-edit-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--tg-primary);
  border: 2px solid var(--tg-bg-sidebar);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: var(--tg-shadow-sm);
}

.tg-profile-title-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--tg-text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-profile-status-online {
  font-size: 12px;
  color: var(--tg-online);
}

.tg-profile-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
}

.tg-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tg-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--tg-text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  pointer-events: auto !important;
}

.tg-form-input, .tg-form-textarea {
  background-color: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: var(--tg-radius-md);
  padding: 9px 12px;
  color: var(--tg-text-main);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--tg-transition);
}

.tg-form-input:focus, .tg-form-textarea:focus {
  border-color: var(--tg-primary);
  background-color: var(--tg-bg-surface-hover);
}

.tg-form-textarea {
  resize: vertical;
  min-height: 60px;
}

.tg-avatar-colors-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.tg-color-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}

.tg-color-circle:hover {
  transform: scale(1.15);
}

.tg-color-circle.selected {
  border-color: #fff;
  transform: scale(1.15);
}

/* ==========================================================================
   Telegram Admin Panel Dashboard
   ========================================================================== */
.tg-admin-panel-box {
  width: 95%;
  max-width: 860px;
  height: 85vh;
  max-height: 720px;
  background-color: var(--tg-bg-modal);
  display: flex;
  flex-direction: column;
}

.tg-admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.tg-stat-card {
  background: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: var(--tg-radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tg-stat-card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--tg-text-muted);
}

.tg-stat-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--tg-text-main);
}

.tg-admin-tabs-nav {
  display: flex;
  background-color: var(--tg-bg-sidebar);
  border-bottom: 1px solid var(--tg-border-light);
  overflow-x: auto;
  position: relative;
  z-index: 10;
  -webkit-overflow-scrolling: touch;
}

.tg-admin-tab-btn {
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-text-muted);
  cursor: pointer !important;
  pointer-events: auto !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: var(--tg-transition);
  position: relative;
  z-index: 10;
}

.tg-admin-tab-btn:hover {
  color: var(--tg-text-main);
  background-color: rgba(255, 255, 255, 0.04);
}

.tg-admin-tab-btn.active {
  color: var(--tg-primary);
  border-bottom-color: var(--tg-primary);
  background-color: rgba(42, 171, 238, 0.08);
}

.tg-admin-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tg-admin-tab-content.active {
  display: flex;
}

/* Admin Members Table */
.tg-table-wrapper {
  background: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: var(--tg-radius-md);
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  width: 100% !important;
  max-width: 100% !important;
}

.tg-admin-table {
  width: 100%;
  min-width: 660px !important;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.tg-admin-table th {
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--tg-text-muted);
  border-bottom: 1px solid var(--tg-border-light);
}

.tg-admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--tg-border-light);
  color: var(--tg-text-main);
}

.tg-admin-table tr:last-child td {
  border-bottom: none;
}

.tg-role-select {
  background-color: var(--tg-bg-sidebar);
  border: 1px solid var(--tg-border-light);
  color: var(--tg-text-main);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}

/* Audit Log Items */
.tg-audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: var(--tg-radius-md);
  font-size: 12px;
}

/* ==========================================================================
   ADMIN MEDIA SHOWCASE VAULT & RANDOM / RECENT / MOST VIEWED
   ========================================================================== */
.tg-showcase-modal-box {
  max-width: 820px;
  width: 92vw;
  height: 84vh;
  display: flex;
  flex-direction: column;
}

.tg-showcase-tabs-nav {
  display: flex;
  background-color: var(--tg-bg-sidebar);
  border-bottom: 1px solid var(--tg-border-light);
  padding: 0 8px;
}

.tg-showcase-tab-btn {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--tg-transition);
}

.tg-showcase-tab-btn:hover {
  color: var(--tg-text-main);
}

.tg-showcase-tab-btn.active {
  color: var(--tg-primary);
  border-bottom-color: var(--tg-primary);
  background-color: rgba(42, 171, 238, 0.08);
}

.tg-showcase-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--tg-border-light);
  gap: 8px;
  flex-wrap: wrap;
}

.tg-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tg-filter-chip {
  background: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  color: var(--tg-text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--tg-radius-full);
  cursor: pointer;
  transition: var(--tg-transition);
}

.tg-filter-chip:hover {
  color: var(--tg-text-main);
  background: var(--tg-bg-surface-hover);
}

.tg-filter-chip.active {
  background: var(--tg-primary);
  color: #ffffff;
  border-color: var(--tg-primary);
  box-shadow: 0 2px 6px rgba(42, 171, 238, 0.35);
}

.tg-btn-shuffle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  background: var(--tg-bg-surface);
  color: var(--tg-primary);
  border: 1px solid rgba(42, 171, 238, 0.35);
  border-radius: var(--tg-radius-full);
  cursor: pointer;
  transition: var(--tg-transition);
}

.tg-btn-shuffle:hover {
  background: rgba(42, 171, 238, 0.15);
  transform: rotate(15deg);
}

.tg-showcase-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.tg-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

/* Media Item Card */
.tg-showcase-card {
  background: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: var(--tg-radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  position: relative;
}

.tg-showcase-card:hover {
  transform: translateY(-3px);
  border-color: rgba(42, 171, 238, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.tg-showcase-card-thumb-box {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #0a0f16;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tg-showcase-card-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.tg-showcase-card:hover .tg-showcase-card-thumb-box img {
  transform: scale(1.05);
}

.tg-showcase-card-thumb-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tg-showcase-play-btn {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: var(--tg-transition);
}

.tg-showcase-card:hover .tg-showcase-play-btn {
  transform: scale(1.15);
  background: var(--tg-primary);
  border-color: #fff;
}

/* Badges on Card Thumbnail */
.tg-showcase-views-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tg-showcase-type-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #38bdf8;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.tg-showcase-card-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.tg-showcase-card-caption {
  font-size: 12px;
  color: var(--tg-text-main);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.tg-showcase-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  font-size: 11px;
  color: var(--tg-text-muted);
}

.tg-showcase-jump-btn {
  background: transparent;
  border: none;
  color: var(--tg-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.tg-showcase-jump-btn:hover {
  background: rgba(42, 171, 238, 0.15);
  text-decoration: underline;
}

/* Drawer Media Preview Row */
.tg-drawer-media-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.tg-drawer-media-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--tg-radius-sm);
  background: var(--tg-bg-surface);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--tg-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tg-drawer-media-thumb img,
.tg-drawer-media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tg-drawer-media-thumb:hover {
  border-color: var(--tg-primary);
  transform: scale(1.04);
}

/* ==========================================================================
   FULLSCREEN TELEGRAM LIGHTBOX & VIDEO PLAYER
   ========================================================================== */
.tg-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(5, 8, 13, 0.94);
  backdrop-filter: blur(20px);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  user-select: none;
}

.tg-lightbox-header {
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tg-lightbox-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tg-lightbox-counter {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.tg-lightbox-views-pill {
  background: rgba(42, 171, 238, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(42, 171, 238, 0.4);
  padding: 2px 8px;
  border-radius: var(--tg-radius-full);
  font-size: 12px;
  font-weight: 600;
}

.tg-lightbox-content {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.tg-lightbox-viewport {
  max-width: 90vw;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tg-lightbox-viewport img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  cursor: zoom-in;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-lightbox-viewport img.is-zoomed {
  transform: scale(2);
  cursor: zoom-out;
}

.tg-lightbox-viewport video {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  outline: none;
}

.tg-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--tg-transition);
  z-index: 10;
}

.tg-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.08);
}

.tg-lightbox-nav.prev {
  left: 20px;
}

.tg-lightbox-nav.next {
  right: 20px;
}

.tg-lightbox-footer {
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tg-lightbox-caption {
  font-size: 14px;
  color: #ffffff;
  line-height: 1.4;
}

.tg-lightbox-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   MOBILE LAYOUT FRIENDLY AUTO RESPONSIVENESS (PHONES & TABLETS)
   ========================================================================== */

/* Mobile back button: hidden on desktop */
.tg-mobile-back-btn {
  display: none;
  font-size: 20px;
  color: var(--tg-text-main);
  padding: 6px 10px;
  margin-right: 4px;
}

@media (max-width: 900px) {
  :root {
    --tg-sidebar-width: 320px;
    --tg-drawer-width: 320px;
  }
  .tg-admin-panel-box {
    width: 96vw !important;
  }
}

@media (max-width: 768px) {
  body {
    height: 100dvh !important;
    height: 100vh;
    width: 100vw !important;
    max-width: 100vw !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .tg-app {
    position: relative !important;
    width: 100vw !important;
    max-width: 100vw !important;
    flex: 1 1 0% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
  }


  /* Slideable Sidebar and Chat */
  .tg-sidebar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    z-index: 50 !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }

  .tg-chat-area {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    z-index: 10 !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%) !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  /* When Chat is Active on Mobile */
  .tg-app.chat-open .tg-sidebar {
    transform: translateX(-100%) !important;
    pointer-events: none !important;
    visibility: hidden !important;
    z-index: 10 !important;
  }

  .tg-app.chat-open .tg-chat-area {
    transform: translateX(0) !important;
    z-index: 50 !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }

  /* Show mobile back button in chat header */
  .tg-mobile-back-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  /* Group Drawer overlay on mobile */
  .tg-group-drawer {
    width: 100% !important;
    max-width: 100% !important;
    z-index: 100 !important;
    position: fixed !important;
  }

  /* Chat Header scaling */
  .tg-chat-header {
    padding: 8px 10px;
    gap: 8px;
  }

  .tg-chat-header-titles {
    max-width: calc(100vw - 190px);
  }

  .tg-chat-header-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tg-chat-header-sub {
    font-size: 11px;
  }

  .tg-chat-header-actions {
    gap: 4px;
  }

  .tg-btn-icon {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  /* Mobile Input Area & Emoji Picker */
  .tg-input-btn-quickcam,
  .tg-input-btn-location {
    display: none !important;
  }

  .tg-messages-canvas {
    padding: 10px 12px !important;
    padding-bottom: 12px !important;
  }

  .tg-chat-input-wrapper {
    padding: 8px 10px !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px)) !important;
    position: relative !important;
    z-index: 50 !important;
    flex-shrink: 0 !important;
    background: var(--tg-surface) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.3) !important;
  }


  .tg-input-row {
    gap: 6px !important;
    align-items: center !important;
    width: 100% !important;
  }

  .tg-input-box-wrapper {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 6px 14px !important;
    border-radius: 24px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
  }

  .tg-input-textarea {
    font-size: 16px !important;
    min-height: 24px !important;
    width: 100% !important;
  }

  .tg-picker-popover {
    position: absolute !important;
    bottom: calc(100% + 6px) !important;
    left: 6px !important;
    right: 6px !important;
    width: auto !important;
    max-width: calc(100vw - 12px) !important;
    height: 270px !important;
    max-height: 48vh !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65) !important;
    z-index: 300 !important;
  }

  .tg-picker-grid {
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 4px !important;
    padding: 10px 6px !important;
    font-size: 26px !important;
    -webkit-overflow-scrolling: touch;
  }

  .tg-picker-emoji-item {
    padding: 8px 2px !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
  }

  .tg-picker-emoji-item:active,
  .tg-picker-emoji-item.tapped {
    background: var(--tg-bg-sidebar-active) !important;
    transform: scale(1.3) !important;
  }

  /* Responsive Modals */
  .tg-modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 92dvh !important;
    border-radius: 16px !important;
    margin: auto !important;
  }

  .tg-admin-panel-box {
    width: 95vw !important;
    max-width: 95vw !important;
    height: 90dvh !important;
  }

  .tg-showcase-modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
    height: 88dvh !important;
  }

  .tg-admin-stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .tg-showcase-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .tg-admin-tabs-nav,
  .tg-showcase-tabs-nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin;
    width: 100% !important;
  }

  .tg-admin-tab-btn,
  .tg-showcase-tab-btn {
    padding: 10px 14px;
    font-size: 12px;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  /* Lightbox on Mobile */
  .tg-lightbox-nav {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .tg-lightbox-nav.prev { left: 8px; }
  .tg-lightbox-nav.next { right: 8px; }
  .tg-lightbox-viewport {
    max-width: 96vw;
    max-height: 70vh;
  }
}

@media (max-width: 480px) {
  .tg-admin-stat-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .tg-stat-card {
    padding: 10px !important;
  }

  .tg-stat-card-value {
    font-size: 18px !important;
  }

  .tg-showcase-grid {
    grid-template-columns: 1fr !important;
  }

  .tg-filter-chips {
    overflow-x: auto;
    width: 100%;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .tg-filter-chip {
    white-space: nowrap;
  }

  .tg-msg-bubble {
    max-width: 88% !important;
  }
}

/* ==========================================================================
   Telegram Authentication Modal (Login / Sign Up / Reset Password / Switch)
   ========================================================================== */
#tg-auth-modal,
.tg-modal-overlay#tg-auth-modal,
#tg-admin-panel-modal.open,
#tg-profile-modal.open,
#tg-db-modal.open,
#tg-media-modal.open,
#tg-media-showcase-modal.open,
#tg-new-chat-modal.open,
.tg-modal-overlay.open {
  z-index: 2147483648 !important;
  pointer-events: auto !important;
}

/* Guarantee all Admin & Client tabs, buttons, and form inputs are 100% clickable */
.tg-admin-tab-btn,
.tg-auth-tab,
.tg-camera-tab,
.tg-showcase-tab-btn,
.tg-picker-tab,
.tg-filter-chip,
.tg-card-btn-auth,
.tg-card-btn-profile,
.tg-card-btn-logout,
.tg-switch-btn,
.tg-btn-icon,
.server-pill,
.tg-chat-item,
.tg-drawer-item,
.tg-media-category-btn,
.tg-lightbox-nav,
.tg-lightbox-close,
.tg-modal-close,
.tg-btn-primary,
.tg-btn-secondary,
.tg-action-btn,
#tg-menu-btn,
#tg-drawer-toggle,
#tg-new-chat-btn,
#tg-camera-btn,
#tg-media-showcase-btn,
#tg-db-pill,
#tg-db-status-badge,
#tg-header-admin-btn,
#tg-drawer-admin-panel-btn,
#tg-btn-sidebar-admin {
  cursor: pointer !important;
  pointer-events: auto !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  position: relative !important;
  z-index: 10 !important;
}

.tg-admin-tab-content,
.tg-admin-stat-grid,
.tg-form-group,
.tg-admin-table,
.tg-table-wrapper {
  pointer-events: auto !important;
}

.tg-admin-tab-content input,
.tg-admin-tab-content textarea,
.tg-admin-tab-content select,
.tg-admin-tab-content button,
.tg-modal-box input,
.tg-modal-box textarea,
.tg-modal-box select,
.tg-modal-box button {
  pointer-events: auto !important;
  position: relative !important;
  z-index: 2 !important;
}

.tg-auth-modal-box {
  width: 480px;
  max-width: 94vw;
  max-height: 90vh;
  max-height: 90dvh;
  background: var(--tg-bg-surface);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--tg-border-light);
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  animation: modalPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative !important;
  z-index: 2147483649 !important;
  pointer-events: auto !important;
}

.tg-auth-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.35);
}

.tg-auth-nav-tabs {
  display: flex;
  background: var(--tg-bg-main);
  border-radius: 10px;
  padding: 4px;
  margin: 4px 16px 12px 16px;
  gap: 4px;
  border: 1px solid var(--tg-border-light);
}

.tg-auth-tab {
  flex: 1;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--tg-text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tg-auth-tab:hover {
  color: var(--tg-text-main);
}

.tg-auth-tab.active {
  background: var(--tg-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 136, 204, 0.35);
}

.tg-auth-alert {
  margin: 0 16px 12px 16px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s ease;
}

.tg-auth-alert.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.tg-auth-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.tg-auth-alert.info {
  background: rgba(42, 171, 238, 0.15);
  border: 1px solid rgba(42, 171, 238, 0.35);
  color: var(--tg-primary);
}

.tg-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  pointer-events: auto !important;
}

.tg-input-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: var(--tg-text-muted);
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  z-index: 3;
}

.tg-input-field {
  width: 100%;
  padding: 10px 12px 10px 38px;
  background: var(--tg-bg-main);
  border: 1px solid var(--tg-border-light);
  border-radius: 10px;
  color: var(--tg-text-main);
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  pointer-events: auto !important;
  cursor: text !important;
  position: relative;
  z-index: 1;
}

.tg-input-field:focus {
  border-color: var(--tg-primary);
  box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.2);
  z-index: 2;
}

.tg-btn-password-toggle {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 4;
  pointer-events: auto !important;
}

.tg-btn-password-toggle:hover {
  opacity: 1;
}

.tg-btn-auth-action {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 136, 204, 0.3);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.tg-btn-auth-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 136, 204, 0.4);
}

.tg-btn-auth-action:active {
  transform: translateY(0);
}

.tg-auth-hint-card {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #f59e0b;
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 6px 0 10px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-reset-code-toast {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideDown 0.25s ease;
}

.tg-avatar-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.tg-avatar-color-row .tg-color-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
}

.tg-avatar-color-row .tg-color-circle:hover {
  transform: scale(1.15);
}

.tg-avatar-color-row .tg-color-circle.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--tg-primary), 0 2px 8px rgba(0,0,0,0.3);
  transform: scale(1.15);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   GPS Turn-On Requirement & Posting Privilege System
   ========================================================================== */

/* 1. Chat Composer GPS Status Bar */
.tg-gps-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.tg-gps-bar:hover {
  background: rgba(239, 68, 68, 0.14);
}

.tg-gps-bar.verified {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
  cursor: default;
}

.tg-gps-bar.verified:hover {
  background: rgba(34, 197, 94, 0.12);
}

.tg-gps-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--tg-text-main);
  font-weight: 500;
}

.tg-gps-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: pulseDot 1.6s infinite;
}

.tg-gps-dot.verified {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: none;
}

.tg-gps-bar-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tg-gps-bar-btn:hover {
  background: #ef4444;
  color: #fff;
}

.tg-gps-bar.verified .tg-gps-bar-btn {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #22c55e;
  cursor: default;
}

/* 2. Sign Up GPS Card */
.tg-signup-gps-card {
  background: var(--tg-bg-main);
  border: 1px solid rgba(0, 136, 204, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.tg-signup-gps-card.verified {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.04);
}

.tg-gps-req-badge {
  font-size: 9px;
  background: #ef4444;
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: bold;
  letter-spacing: 0.3px;
}

.tg-gps-status-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tg-gps-status-pill.unverified {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.tg-gps-status-pill.verified {
  background: rgba(34, 197, 94, 0.18);
  color: #22c55e;
}

.tg-gps-status-pill.requesting {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
}

.tg-btn-gps-action {
  width: 100%;
  padding: 8px 12px;
  background: rgba(0, 136, 204, 0.12);
  border: 1px solid #0088cc;
  color: #2AABEE;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.tg-btn-gps-action:hover {
  background: #0088cc;
  color: #ffffff;
}

.tg-btn-gps-action.verified {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
  color: #22c55e;
  cursor: default;
}

/* 3. GPS Modal Box */
.tg-gps-modal-box {
  width: 440px;
  max-width: 94vw;
  background: var(--tg-bg-surface);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--tg-border-light);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modalPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tg-gps-modal-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 136, 204, 0.4);
  margin-bottom: 6px;
}

.tg-gps-benefits-box {
  width: 100%;
  background: var(--tg-bg-main);
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid var(--tg-border-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tg-gps-benefit-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* 4. Message Verified Location Tooltip */
.tg-msg-gps-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

/* ==========================================================================
   Auto-Scroll Video Stream Player - Responsive 1-Click Size Modes
   ========================================================================== */
.tg-auto-video-stream-card {
  transition: max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s ease, box-shadow 0.25s ease;
}

.tg-auto-video-stream-card.is-full-size {
  max-width: 840px !important;
  width: 96% !important;
}

.tg-auto-video-stream-card.is-compact {
  max-width: 380px !important;
  width: 90% !important;
}

.tg-auto-video-stream-card .tg-stream-frame,
.tg-auto-video-stream-card video {
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-auto-video-stream-card.is-full-size .tg-stream-frame,
.tg-auto-video-stream-card.is-full-size video {
  max-height: 520px !important;
}

.tg-auto-video-stream-card.is-compact .tg-stream-frame,
.tg-auto-video-stream-card.is-compact video {
  max-height: 240px !important;
}

@media (max-width: 768px) {
  .tg-auto-video-stream-card.is-full-size {
    max-width: 100% !important;
    width: 100% !important;
  }
  .tg-auto-video-stream-card.is-full-size .tg-stream-frame,
  .tg-auto-video-stream-card.is-full-size video {
    max-height: 48vh !important;
  }
  .tg-auto-video-stream-card.is-compact {
    max-width: 330px !important;
  }
  .tg-auto-video-stream-card.is-compact .tg-stream-frame,
  .tg-auto-video-stream-card.is-compact video {
    max-height: 210px !important;
  }
}

/* ==========================================================================
   User Profile View Modal & Info Rows
   ========================================================================== */
.tg-profile-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}
.tg-profile-info-label {
  color: var(--tg-text-muted);
  font-weight: 600;
  font-size: 12px;
}
.tg-profile-info-value {
  color: var(--tg-text-main);
}
.tg-profile-gps-card {
  background: rgba(0, 136, 204, 0.08);
  border: 1px solid rgba(42, 171, 238, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
}

/* ==========================================================================
   User Picker List (New Private Chat Modal)
   ========================================================================== */
.tg-user-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.tg-user-picker-item:hover {
  background: rgba(42, 171, 238, 0.1);
  border-color: rgba(42, 171, 238, 0.4);
}
.tg-user-picker-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tg-user-picker-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}
.tg-user-picker-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tg-user-picker-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--tg-text-main);
}
.tg-user-picker-sub {
  font-size: 11px;
  color: var(--tg-text-muted);
}

/* ==========================================================================
   Raw GPS Location Message Cards
   ========================================================================== */
.tg-location-card {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.tg-location-map-preview {
  width: 100%;
  height: 145px;
  background: #0f172a;
  position: relative;
  overflow: hidden;
}
.tg-location-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  pointer-events: auto;
}
.tg-location-info-box {
  padding: 10px 12px;
}
.tg-location-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.tg-location-icon {
  font-size: 20px;
}
.tg-location-heading {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--tg-text-main);
}
.tg-location-coords {
  font-size: 11px;
  font-family: monospace;
  color: #38bdf8;
  word-break: break-all;
}
.tg-location-accuracy-badge {
  font-size: 10.5px;
  color: var(--tg-text-muted);
  margin-bottom: 8px;
}
.tg-location-btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tg-map-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tg-map-btn.google {
  background: #0088cc;
  color: #fff;
  border: none;
}
.tg-map-btn.google:hover {
  background: #0077b5;
}
.tg-map-btn.osm {
  background: rgba(255, 255, 255, 0.08);
  color: var(--tg-text-main);
  border: 1px solid var(--tg-border-light);
}
.tg-map-btn.osm:hover {
  background: rgba(255, 255, 255, 0.14);
}
.tg-map-btn.copy {
  background: rgba(255, 255, 255, 0.05);
  color: var(--tg-text-muted);
  border: 1px solid var(--tg-border-light);
}
.tg-map-btn.copy:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Raw Video Stream Post in Chat Feed (Inline & Mobile-Friendly)
   ========================================================================== */
.tg-stream-post-wrapper {
  margin: 12px 0;
  width: 100%;
}
.tg-stream-post-bubble {
  max-width: 860px !important;
  width: 96% !important;
  padding: 10px 12px !important;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98)) !important;
  border: 1px solid rgba(42, 171, 238, 0.35) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
  border-radius: 14px !important;
}
.tg-stream-auto-tag {
  background: #0088cc;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.tg-stream-post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 6px 2px 6px;
  font-size: 11px;
  color: #94a3b8;
  flex-wrap: wrap;
  gap: 6px;
}
.tg-stream-ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #38bdf8;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.tg-stream-ctrl-btn:hover {
  background: rgba(56, 189, 248, 0.2);
}

@media (max-width: 768px) {
  .tg-stream-post-bubble {
    max-width: 100% !important;
    width: 100% !important;
    padding: 8px !important;
  }
  .tg-auto-video-stream-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 4px 0 !important;
    border-radius: 8px !important;
  }
  .tg-auto-video-stream-card .tg-stream-frame,
  .tg-auto-video-stream-card video {
    width: 100% !important;
    max-height: 48vh !important;
    object-fit: contain !important;
  }
  .tg-location-card {
    max-width: 100% !important;
  }
}

/* ==========================================================================
   Khmer Stream Recommendation & 5-Second Auto-Load Banner
   ========================================================================== */
.tg-khmer-stream-banner {
  margin: 12px auto;
  max-width: 860px;
  width: 96%;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.92));
  border: 1px solid rgba(42, 171, 238, 0.45);
  border-radius: 14px;
  padding: 12px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: tgFadeIn 0.35s ease;
}
.tg-khmer-banner-glow {
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.3), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.tg-khmer-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 6px;
}
.tg-khmer-banner-badge {
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}
.tg-khmer-countdown-pill {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}
.tg-khmer-banner-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.45;
  margin-bottom: 4px;
}
.tg-khmer-banner-subtitle {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 10px;
}
.tg-khmer-banner-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tg-khmer-action-btn {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tg-khmer-action-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
  border-color: #38bdf8;
}

/* ==========================================================================
   MOBILE-FRIENDLY RESPONSIVE LAYOUT & TELEGRAM CONTROLS ENHANCEMENTS
   ========================================================================== */

/* Modern Telegram Input Row & Box */
.tg-input-box-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: var(--tg-bg-surface);
  border-radius: 20px;
  padding: 4px 12px;
  border: 1px solid var(--tg-border-light);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tg-input-box-wrapper:focus-within {
  border-color: var(--tg-primary);
  box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.2);
}

.tg-input-textarea {
  width: 100%;
  border: none !important;
  background: transparent !important;
  outline: none !important;
  font-size: 15px;
  line-height: 1.4;
  color: var(--tg-text-main);
  resize: none !important;
  max-height: 110px;
  overflow-y: auto;
  padding: 4px 0;
  font-family: inherit;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.tg-input-textarea::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Hide spin buttons or resize handles */
.tg-input-textarea::-webkit-inner-spin-button,
.tg-input-textarea::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Voice, Send, Emoji & Attach buttons in input row - High visibility & clear distinction */
.tg-voice-btn-mic,
#tg-voice-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 19px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(2, 132, 199, 0.38)) !important;
  color: #38bdf8 !important;
  border: 1.5px solid #38bdf8 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.tg-voice-btn-mic:hover,
#tg-voice-btn:hover {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.35), rgba(2, 132, 199, 0.55)) !important;
  transform: scale(1.08);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
}

.tg-voice-btn-mic:active,
#tg-voice-btn:active {
  transform: scale(0.92);
}

#tg-emoji-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 20px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.28)) !important;
  border: 1.5px solid rgba(251, 191, 36, 0.75) !important;
  color: #fbbf24 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0 !important;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.25);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

#tg-emoji-btn:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(251, 191, 36, 0.48)) !important;
  transform: scale(1.08);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
}

#tg-emoji-btn:active {
  transform: scale(0.92);
}

#tg-attach-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 50%;
  color: #ffffff !important;
  font-size: 18px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0 !important;
}

#tg-send-btn {
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  background: linear-gradient(135deg, #0088cc, #2AABEE) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 20px;
  color: #ffffff !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 10px rgba(42, 171, 238, 0.5) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  visibility: visible !important;
  opacity: 1 !important;
}

#tg-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(42, 171, 238, 0.65) !important;
}

#tg-send-btn:active {
  transform: scale(0.95);
}

/* On Mobile Screens (Phones <= 640px) */
@media (max-width: 640px) {
  /* Hide redundant quick buttons: accessible in Attachment Popover */
  .tg-input-btn-quickcam,
  .tg-input-btn-location {
    display: none !important;
  }

  .tg-input-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    align-items: center !important;
    width: 100% !important;
  }

  .tg-chat-input-wrapper {
    padding: 10px 12px !important;
    padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px)) !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }

  .tg-btn-icon {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    font-size: 19px !important;
    flex-shrink: 0 !important;
  }

  .tg-send-btn,
  #tg-send-btn {
    width: auto !important;
    min-width: 90px !important;
    max-width: none !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 18px !important;
    border-radius: 24px !important;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    background: linear-gradient(135deg, #0088cc, #2AABEE) !important;
    box-shadow: 0 4px 14px rgba(42, 171, 238, 0.6) !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    z-index: 15 !important;
  }

  .tg-send-btn.has-text,
  #tg-send-btn.has-text {
    min-width: 100px !important;
    background: linear-gradient(135deg, #0088cc, #00b4d8) !important;
    box-shadow: 0 5px 18px rgba(0, 180, 216, 0.7) !important;
  }

  .tg-send-btn-label {
    display: inline-block !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    letter-spacing: 0.3px !important;
  }

  .tg-voice-btn-mic,
  #tg-voice-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    font-size: 17px !important;
    display: flex !important;
    flex-shrink: 0 !important;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(2, 132, 199, 0.45)) !important;
    border: 1.5px solid #38bdf8 !important;
    color: #38bdf8 !important;
  }

  #tg-emoji-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    font-size: 18px !important;
    display: flex !important;
    flex-shrink: 0 !important;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(251, 191, 36, 0.35)) !important;
    border: 1.5px solid rgba(251, 191, 36, 0.8) !important;
    color: #fbbf24 !important;
  }

  #tg-attach-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    font-size: 16px !important;
    display: flex !important;
    flex-shrink: 0 !important;
  }

  /* Compact GPS status pill on mobile */
  .tg-gps-bar {
    padding: 4px 8px !important;
    margin-bottom: 2px !important;
    border-radius: 6px !important;
  }

  .tg-gps-text {
    font-size: 11px !important;
  }

  .tg-gps-bar-btn {
    padding: 2px 8px !important;
    font-size: 10.5px !important;
  }

  /* Message bubbles max width */
  .tg-msg-wrapper {
    max-width: 88% !important;
  }

  /* Video notes in mobile chat (preserve full size for admin and expanded videos) */
  .tg-round-video-wrapper:not(.is-full-size):not(.is-admin-mp4) {
    width: 200px !important;
    height: 200px !important;
  }

  .tg-msg-wrapper.has-admin-video {
    max-width: 100% !important;
    width: 100% !important;
  }
  .tg-msg-bubble.is-admin-video-bubble {
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px !important;
  }
  .tg-round-video-wrapper.is-full-size,
  .tg-round-video-wrapper.is-admin-mp4,
  .tg-msg-video-media.is-admin-video,
  .tg-msg-video-media.is-full-size {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    border-radius: 10px !important;
  }
}

/* ==========================================================================
   STICKY MINI AUDIO / VOICE PLAYER (REAL TELEGRAM STYLE)
   ========================================================================== */
.tg-sticky-voice-player {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  gap: 12px;
  background: rgba(23, 33, 43, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  animation: slideDownPlayer 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownPlayer {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.tg-sticky-voice-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tg-sticky-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tg-primary);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.tg-sticky-play-btn:hover {
  transform: scale(1.08);
  background: var(--tg-primary-hover);
}

.tg-sticky-voice-info {
  display: flex;
  flex-direction: column;
}

.tg-sticky-voice-title {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
}

.tg-sticky-voice-timeline {
  font-size: 10.5px;
  font-family: monospace;
  color: var(--tg-text-muted);
}

.tg-sticky-voice-progress {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  margin: 0 4px;
}

.tg-sticky-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2aabee, #38bdf8);
  border-radius: 3px;
  transition: width 0.1s linear;
}

.tg-sticky-voice-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Playback Speed Pill Button (1X, 1.5X, 2X) */
.tg-voice-speed-pill {
  background: rgba(42, 171, 238, 0.18);
  border: 1px solid rgba(42, 171, 238, 0.35);
  color: #38bdf8;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tg-voice-speed-pill:hover {
  background: rgba(42, 171, 238, 0.3);
  color: #fff;
  border-color: #38bdf8;
}

.tg-voice-speed-pill:active {
  transform: scale(0.92);
}

.tg-sticky-vol-btn,
.tg-sticky-close-btn {
  width: 28px !important;
  height: 28px !important;
  font-size: 12px !important;
  opacity: 0.85;
}

.tg-sticky-close-btn:hover {
  color: #ef4444 !important;
  opacity: 1;
}

/* ==========================================================================
   REAL TELEGRAM VOICE BUBBLE CONTROLS & SPEED PILL
   ========================================================================== */
.tg-voice-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  min-width: 220px;
  border-radius: 16px;
  user-select: none;
  transition: background-color 0.2s ease;
}

.tg-voice-bubble.playing {
  background: rgba(42, 171, 238, 0.08);
}

.tg-voice-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tg-voice-waveform {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 26px;
  cursor: pointer;
  padding: 2px 0;
}

.tg-waveform-bar {
  flex: 1;
  min-width: 2px;
  max-width: 4px;
  background-color: rgba(255, 255, 255, 0.32);
  border-radius: 2px;
  transition: background-color 0.12s ease, transform 0.12s ease;
}

[data-theme="light"] .tg-waveform-bar {
  background-color: rgba(0, 0, 0, 0.22);
}

.tg-waveform-bar.played {
  background-color: var(--tg-primary) !important;
}

.tg-voice-bubble.playing .tg-waveform-bar.played {
  background: linear-gradient(180deg, #38bdf8, #2aabee) !important;
}

.tg-voice-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tg-voice-controls-inline {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tg-voice-btn-mini {
  background: transparent;
  border: none;
  color: var(--tg-text-muted);
  cursor: pointer;
  padding: 1px 4px;
  font-size: 11px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.tg-voice-btn-mini:hover {
  color: var(--tg-primary);
}

/* ==========================================================================
   VOICE RECORDING BAR WITH LIVE WAVE VISUALIZER & CANCEL BUTTON
   ========================================================================== */
.tg-voice-recording {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--tg-bg-surface);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 22px;
  padding: 8px 14px;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.15);
  animation: pulseRecordingBar 2s infinite ease-in-out;
}

.tg-voice-recording.active {
  display: flex !important;
}

@keyframes pulseRecordingBar {
  0%, 100% { border-color: rgba(239, 68, 68, 0.4); }
  50% { border-color: rgba(239, 68, 68, 0.85); box-shadow: 0 4px 18px rgba(239, 68, 68, 0.25); }
}

.tg-voice-recording-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.tg-voice-recording-timer {
  font-family: monospace;
  font-weight: 700;
  font-size: 14px;
  color: #ef4444;
}

/* Live dynamic wave visualizer while speaking */
.tg-recording-wave-visualizer {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  padding: 0 4px;
}

.tg-recording-wave-visualizer .vbar {
  width: 3px;
  background-color: #ef4444;
  border-radius: 2px;
  animation: recordWaveAnim 0.8s infinite ease-in-out alternate;
}

.tg-recording-wave-visualizer .vbar:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.tg-recording-wave-visualizer .vbar:nth-child(2) { height: 14px; animation-delay: 0.25s; }
.tg-recording-wave-visualizer .vbar:nth-child(3) { height: 9px; animation-delay: 0.05s; }
.tg-recording-wave-visualizer .vbar:nth-child(4) { height: 16px; animation-delay: 0.4s; }
.tg-recording-wave-visualizer .vbar:nth-child(5) { height: 11px; animation-delay: 0.2s; }
.tg-recording-wave-visualizer .vbar:nth-child(6) { height: 18px; animation-delay: 0.3s; }
.tg-recording-wave-visualizer .vbar:nth-child(7) { height: 8px; animation-delay: 0.15s; }
.tg-recording-wave-visualizer .vbar:nth-child(8) { height: 13px; animation-delay: 0.35s; }
.tg-recording-wave-visualizer .vbar:nth-child(9) { height: 7px; animation-delay: 0.5s; }
.tg-recording-wave-visualizer .vbar:nth-child(10) { height: 12px; animation-delay: 0.22s; }

@keyframes recordWaveAnim {
  0% { transform: scaleY(0.3); opacity: 0.5; }
  100% { transform: scaleY(1.3); opacity: 1; }
}

.tg-recording-hint {
  font-size: 11.5px;
  color: var(--tg-text-muted);
}

.tg-voice-recording-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-voice-cancel-btn {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tg-voice-cancel-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.tg-voice-finish-btn {
  background: var(--tg-primary);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tg-voice-finish-btn:hover {
  background: var(--tg-primary-hover);
  transform: scale(1.05);
}

/* ==========================================================================
   TELEGRAM ATTACHMENT POPOVER MENU
   ========================================================================== */
.tg-attach-popover {
  position: absolute;
  bottom: 64px;
  left: 14px;
  width: 270px;
  background: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 120;
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tg-attach-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.tg-attach-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tg-attach-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.tg-attach-icon.photo { background: rgba(59, 130, 246, 0.18); color: #3b82f6; }
.tg-attach-icon.video { background: rgba(168, 85, 247, 0.18); color: #a855f7; }
.tg-attach-icon.mobile-cam { background: rgba(16, 185, 129, 0.18); color: #10b981; }
.tg-attach-icon.location { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.tg-attach-icon.voice { background: rgba(236, 72, 153, 0.18); color: #ec4899; }
.tg-attach-icon.gallery { background: rgba(100, 116, 139, 0.18); color: #94a3b8; }

.tg-attach-details {
  display: flex;
  flex-direction: column;
}

.tg-attach-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-text-main);
}

.tg-attach-sub {
  font-size: 10.5px;
  color: var(--tg-text-muted);
}

/* ==========================================================================
   CAMERA STUDIO & 7MB LIMIT CONTROLS
   ========================================================================== */
.tg-media-limit-warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 4px;
}

.tg-capture-size-pill {
  font-size: 11.5px;
  font-family: monospace;
  color: var(--tg-text-muted);
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tg-camera-ctrl-btn {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  font-size: 18px !important;
  border: 1px solid var(--tg-border-light) !important;
}

/* ==========================================================================
   ROBOT VIDEO STREAM: 1-CLICK FULL SIZE, HIDE / PAUSE TAP & COLLAPSIBLE BAR
   ========================================================================== */
.tg-stream-post-wrapper {
  margin-bottom: 14px;
}

.tg-stream-post-bubble {
  max-width: 92% !important;
  width: auto;
}

.tg-auto-video-stream-card {
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(24, 34, 48, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(42, 171, 238, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.tg-auto-video-stream-card.is-full-size {
  max-width: 100% !important;
  width: 100% !important;
}

.tg-auto-video-stream-card.is-compact {
  max-width: 380px !important;
  width: 96% !important;
}

.tg-auto-video-stream-card .tg-stream-frame {
  position: relative;
  background: #000;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.tg-auto-video-stream-card.is-full-size .tg-stream-frame,
.tg-auto-video-stream-card.is-full-size video {
  max-height: 560px !important;
}

.tg-auto-video-stream-card.is-compact .tg-stream-frame,
.tg-auto-video-stream-card.is-compact video {
  max-height: 250px !important;
}

/* ==========================================================================
   Full-Surface Mobile Video Play/Pause & Stream Controls
   ========================================================================== */
.tg-stream-frame,
.tg-msg-video-media,
.tg-round-video-wrapper {
  position: relative;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tg-stream-frame video,
.tg-msg-video-media video,
.tg-round-video-wrapper video {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Full-Surface Mobile Video Touch Hitbox: Covers 100% of video surface so clicks and touches are never intercepted */
.tg-video-touch-hitbox {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  outline: none;
  display: block;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Center 1-Tap Play Button (Large, glowing, easily clickable on mobile) */
.tg-video-center-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(14, 22, 33, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(56, 189, 248, 0.75);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55), 0 0 25px rgba(42, 171, 238, 0.35);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  font-size: 24px;
  z-index: 18;
  pointer-events: none !important;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.tg-round-video-wrapper .tg-video-center-play-btn {
  width: 52px;
  height: 52px;
  font-size: 20px;
}

.tg-video-center-play-btn .tg-center-play-icon {
  margin-left: 3px;
  display: inline-block;
  line-height: 1;
}

.tg-video-center-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.12);
  background: rgba(0, 136, 204, 0.88);
  border-color: #38bdf8;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65), 0 0 35px rgba(56, 189, 248, 0.6);
}

.tg-video-center-play-btn:active {
  transform: translate(-50%, -50%) scale(0.92);
}

/* Video State Sync: Center button fades out when playing, returns on pause */
.tg-stream-frame.is-playing .tg-video-center-play-btn,
.tg-msg-video-media.is-playing .tg-video-center-play-btn,
.tg-round-video-wrapper.is-playing .tg-video-center-play-btn {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.7);
}

.tg-stream-frame.is-paused .tg-video-center-play-btn,
.tg-msg-video-media.is-paused .tg-video-center-play-btn,
.tg-round-video-wrapper.is-paused .tg-video-center-play-btn {
  opacity: 1;
  pointer-events: none !important;
  transform: translate(-50%, -50%) scale(1);
}

.tg-video-center-play-btn * {
  pointer-events: none !important;
}

/* Round Video Sound Pill */
.tg-round-video-sound-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(14, 22, 33, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.6);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease;
}
.tg-round-video-sound-btn:active {
  transform: scale(0.9);
}

/* Instant Visual Tap Pulse (Tactile feedback for mobile tap on video) */
.tg-video-tap-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(14, 22, 33, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 30px rgba(42, 171, 238, 0.5);
  color: #38bdf8;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 22;
  opacity: 0;
}

@keyframes tgVideoTapPulseAnim {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.7);
  }
  50% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.35);
  }
}

.tg-video-tap-pulse.is-pulsing {
  animation: tgVideoTapPulseAnim 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Mobile Video Buffering Indicator (Clean glowing spinner) */
.tg-stream-frame.is-buffering::after,
.tg-msg-video-media.is-buffering::after,
.tg-round-video-wrapper.is-buffering::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: tgVideoBufferingSpin 0.75s linear infinite;
  z-index: 19;
  pointer-events: none;
}

@keyframes tgVideoBufferingSpin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.tg-stream-frame.is-buffering .tg-video-center-play-btn,
.tg-msg-video-media.is-buffering .tg-video-center-play-btn,
.tg-round-video-wrapper.is-buffering .tg-video-center-play-btn {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Top Sound, Overlay & Cinema Controls Bar Outside Above Video Frame */
.tg-stream-video-overlay {
  position: relative;
  top: auto;
  right: auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.94);
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px 10px 0 0;
  z-index: 20;
  pointer-events: auto;
  box-sizing: border-box;
}

.tg-stream-sound-pill,
.tg-stream-fullscreen-pill {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  min-height: 34px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.tg-stream-sound-pill:hover,
.tg-stream-fullscreen-pill:hover {
  background: rgba(42, 171, 238, 0.88);
  border-color: #38bdf8;
  transform: scale(1.05);
}

.tg-stream-sound-pill:active,
.tg-stream-fullscreen-pill:active {
  transform: scale(0.95);
}

.tg-stream-sound-pill.is-muted {
  background: rgba(225, 29, 72, 0.85);
  border-color: rgba(244, 63, 94, 0.9);
  color: #fff;
}

@media (max-width: 768px) {
  .tg-video-center-play-btn {
    width: 54px !important;
    height: 54px !important;
    font-size: 21px !important;
  }
  .tg-stream-sound-pill,
  .tg-stream-fullscreen-pill {
    min-height: 36px !important;
    padding: 6px 13px !important;
    font-size: 12px !important;
  }
}

/* Auto-embedded Iframe URL Card (Admin & Operator Links) */
.tg-msg-embed-iframe-card {
  margin-top: 8px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tg-msg-embed-iframe-header {
  padding: 6px 10px;
  background: rgba(30, 41, 59, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  gap: 8px;
}

.tg-badge-operator-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.tg-msg-embed-domain {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.tg-msg-embed-iframe-wrapper {
  width: 100%;
  height: 240px;
  background: #0f172a;
  position: relative;
  overflow: hidden;
}

.tg-msg-embed-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: block;
}

@media (max-width: 768px) {
  .tg-msg-embed-iframe-wrapper {
    height: 195px;
  }
  .tg-msg-embed-domain {
    max-width: 130px;
  }
}

/* Hidden / Paused stream state */
.tg-auto-video-stream-card.is-stream-hidden {
  background: rgba(15, 23, 42, 0.75) !important;
  border-color: rgba(56, 189, 248, 0.25) !important;
  box-shadow: none !important;
  margin: 6px 0 !important;
}

.tg-auto-video-stream-card.is-stream-hidden .tg-stream-frame,
.tg-auto-video-stream-card.is-stream-hidden .tg-stream-ad-banner,
.tg-auto-video-stream-card.is-stream-hidden .tg-stream-post-footer {
  display: none !important;
}

.tg-stream-hidden-placeholder {
  display: none;
  padding: 10px 14px;
  background: rgba(42, 171, 238, 0.1);
  border: 1px dashed rgba(42, 171, 238, 0.35);
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #38bdf8;
  font-size: 12px;
  margin: 4px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.tg-stream-hidden-placeholder:hover {
  background: rgba(42, 171, 238, 0.18);
  border-color: #38bdf8;
}

.tg-auto-video-stream-card.is-stream-hidden .tg-stream-hidden-placeholder {
  display: flex !important;
}

.tg-stream-ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #38bdf8;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  transition: all 0.2s;
}

.tg-stream-ctrl-btn:hover {
  background: rgba(42, 171, 238, 0.2);
  border-color: #38bdf8;
}

.tg-stream-ctrl-btn.cinema {
  background: linear-gradient(135deg, rgba(0, 136, 204, 0.25), rgba(42, 171, 238, 0.35));
  border-color: #38bdf8;
  color: #fff;
}

.tg-stream-hide-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.tg-stream-hide-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
  color: #ef4444;
}

.tg-stream-unhide-pill {
  background: #0088cc;
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Instant optimistic posting styles */
.tg-msg-wrapper.is-optimistic {
  opacity: 0.95;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.tg-msg-wrapper.is-optimistic .tg-msg-ticks {
  opacity: 0.6;
}

.tg-stream-global-pause-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.tg-stream-global-pause-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
}

/* ==========================================================================
   ADVERTISEMENT SYSTEM (ads.txt Integration, First Visitor & 3-Stream Ads)
   ========================================================================== */

/* First Visitor Advertisement Modal */
.tg-first-ad-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: tgFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-first-ad-content {
  background: linear-gradient(150deg, #182333 0%, #0f172a 100%);
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: 20px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(234, 179, 8, 0.2);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  animation: tgScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-first-ad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(234, 179, 8, 0.12);
  border-bottom: 1px solid rgba(234, 179, 8, 0.25);
}

.tg-first-ad-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fde047;
  letter-spacing: 0.4px;
}

.tg-first-ad-badge .tg-ad-badge-icon {
  font-size: 16px;
  animation: tgPulse 1.8s infinite;
}

.tg-first-ad-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.tg-first-ad-close:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #fff;
  transform: scale(1.08);
}

.tg-first-ad-body {
  padding: 20px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tg-first-ad-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.tg-first-ad-subtitle {
  margin: 0;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.45;
}

.tg-first-ad-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.tg-first-ad-card:hover {
  transform: translateY(-2px);
  border-color: #fde047;
  box-shadow: 0 12px 30px rgba(234, 179, 8, 0.2);
}

.tg-first-ad-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(234, 179, 8, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.tg-first-ad-domain {
  color: #38bdf8;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tg-first-ad-tag {
  background: rgba(234, 179, 8, 0.25);
  color: #fde047;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.tg-first-ad-preview-box {
  position: relative;
  width: 100%;
  height: 220px;
  background: #0b1120;
  overflow: hidden;
}

.tg-first-ad-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  pointer-events: none;
}

.tg-first-ad-overlay-cta {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(11, 17, 32, 0.95) 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 14px;
  transition: background 0.2s;
}

.tg-first-ad-card:hover .tg-first-ad-overlay-cta {
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.08) 30%, rgba(11, 17, 32, 0.9) 100%);
}

.tg-first-ad-cta-btn {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #000;
  font-weight: 800;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(234, 179, 8, 0.4);
}

.tg-first-ad-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.tg-first-ad-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.tg-first-ad-btn.primary {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  border: none;
  color: #000;
  box-shadow: 0 4px 18px rgba(234, 179, 8, 0.35);
}

.tg-first-ad-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(234, 179, 8, 0.5);
  filter: brightness(1.08);
}

.tg-first-ad-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
}

.tg-first-ad-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* 3-Stream Advertisement Post in Chat Stream */
.tg-ad-post-wrapper {
  margin: 14px 0;
  animation: tgFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-ad-post-bubble {
  background: linear-gradient(145deg, rgba(28, 38, 54, 0.95), rgba(15, 23, 42, 0.98)) !important;
  border: 1px solid rgba(234, 179, 8, 0.35) !important;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(234, 179, 8, 0.1) !important;
  max-width: 860px !important;
  width: 96% !important;
}

.tg-auto-ad-stream-card {
  border-radius: 12px;
  overflow: hidden;
  background: rgba(11, 17, 32, 0.7);
  border: 1px solid rgba(234, 179, 8, 0.25);
  margin-top: 6px;
  margin-bottom: 6px;
}

.tg-ad-stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(234, 179, 8, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tg-ad-stream-preview {
  position: relative;
  width: 100%;
  height: 400px;
  background: #0a0f1d;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-ad-stream-preview.is-expanded {
  height: 620px;
}

.tg-ad-stream-iframe {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: none;
  display: block;
  pointer-events: auto !important;
}

.tg-ad-stream-click-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 15, 29, 0.94) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 6px;
  pointer-events: none;
}

.tg-ad-stream-bottom-bar {
  position: absolute;
  bottom: 6px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
}

.tg-ad-overlay-pill {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #000;
  font-weight: 800;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.35);
  transition: transform 0.2s;
  pointer-events: auto;
  cursor: pointer;
}

.tg-ad-overlay-scroll-btn {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fde047;
  font-weight: 700;
  font-size: 10.5px;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
}

.tg-ad-overlay-scroll-btn:hover {
  background: rgba(245, 158, 11, 0.3);
  color: #fff;
  border-color: #fde047;
}

.tg-auto-ad-stream-card:hover .tg-ad-overlay-pill {
  transform: scale(1.05);
}

.tg-ad-stream-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  gap: 8px;
  flex-wrap: wrap;
}

.tg-ad-ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  transition: all 0.2s;
}

.tg-ad-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.tg-ad-ctrl-btn.primary {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  border: none;
  color: #000;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(234, 179, 8, 0.3);
}

.tg-ad-ctrl-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(234, 179, 8, 0.45);
}

.tg-ad-ctrl-btn.dismiss:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
}

@keyframes tgPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

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

/* ==========================================================================
   STREAM VIDEO ADVERTISEMENT OVERLAYS & ADMIN EDIT CONTROLS
   ========================================================================== */

.tg-stream-ad-banner {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: linear-gradient(180deg, rgba(20, 29, 44, 0.98) 0%, rgba(13, 19, 33, 0.99) 100%);
  border-top: 1px solid rgba(245, 158, 11, 0.45);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  position: relative;
  overflow: hidden;
  font-size: 11.5px;
  transition: all 0.25s ease;
  user-select: none;
}

.tg-stream-ad-banner:hover {
  border-top-color: rgba(245, 158, 11, 0.7);
}

.tg-stream-ad-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18) 0%, rgba(217, 119, 6, 0.08) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tg-stream-ad-iframe-box {
  width: 100%;
  height: auto;
  min-height: 90px;
  position: relative;
  background: #080e18;
  overflow: hidden;
  border-top: 1px solid rgba(245, 158, 11, 0.2);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 6px;
  box-sizing: border-box;
}

.tg-stream-ad-iframe-box.is-expanded {
  max-height: 480px;
}

.tg-video-live-ad-slot {
  width: 100%;
  height: 900px;
  min-height: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-radius: 6px;
  overflow: hidden;
  background: #090d16;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: height 0.25s ease, min-height 0.25s ease;
}

.tg-video-live-ad-slot:empty {
  display: none !important;
}

.tg-video-live-ad-slot .tg-ad-preview-iframe {
  max-width: 100%;
  width: 100%;
  height: 900px;
  min-height: 900px;
  border: none;
  background: transparent;
  display: block;
  overflow: hidden;
  border-radius: 6px;
  transition: height 0.25s ease, min-height 0.25s ease;
}

/* Ensure Adsterra Script Banner area shows at height 900px with auto width across devices */
@media (max-width: 768px) {
  .tg-video-live-ad-slot,
  #tg-lightbox-ad-slot {
    height: 900px !important;
    min-height: 900px !important;
    width: 100% !important;
  }
  .tg-video-live-ad-slot .tg-ad-preview-iframe,
  #tg-lightbox-ad-slot .tg-ad-preview-iframe {
    height: 900px !important;
    min-height: 900px !important;
    width: 100% !important;
  }
  .tg-chat-ad-script-slot .tg-ad-preview-iframe {
    height: 900px !important;
    min-height: 900px !important;
    width: 100% !important;
  }
  .container-fdcf2dc65942f4a2e150bb2107fffb79__link,
  #container-fdcf2dc65942f4a2e150bb2107fffb79 {
    height: 900px !important;
    min-height: 900px !important;
    width: 100% !important;
  }
}

.tg-video-url-ad-slot {
  width: 100%;
  height: 90px;
  min-height: 90px;
  max-height: 90px;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  box-sizing: border-box;
  background: #080e18;
  transition: all 0.25s ease;
}

.tg-stream-ad-iframe-box.is-expanded .tg-video-url-ad-slot,
.tg-stream-ad-iframe-box.is-expanded .tg-stream-ad-iframe {
  height: 250px !important;
  max-height: 250px !important;
}

.tg-stream-ad-iframe {
  width: 100% !important;
  height: 90px !important;
  min-height: 90px !important;
  max-height: 90px !important;
  border: none;
  display: block;
  background: #080e18;
  border-radius: 6px;
  pointer-events: auto !important;
  box-sizing: border-box;
}

.tg-stream-ad-ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #94a3b8;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tg-stream-ad-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.tg-stream-ad-banner-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.tg-stream-ad-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4);
}

.tg-stream-ad-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.tg-stream-ad-title {
  font-size: 11px;
  font-weight: 700;
  color: #fef08a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-stream-ad-link {
  font-size: 10.5px;
  color: #38bdf8;
  font-family: Consolas, Monaco, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.tg-stream-ad-banner-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tg-stream-ad-action-btn {
  background: rgba(245, 158, 11, 0.25);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tg-stream-ad-action-btn:hover {
  background: #f59e0b;
  color: #000;
  border-color: #f59e0b;
}

/* Tap for Admin to Edit Ad Button */
.tg-stream-ad-admin-edit-btn {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tg-stream-ad-admin-edit-btn:hover {
  background: #0284c7;
  color: #fff;
  border-color: #0284c7;
  transform: scale(1.03);
}

/* Lightbox Cinema Mode Ad Bar */
.tg-lightbox-ad-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 0 0 14px 14px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .tg-stream-ad-banner {
    padding: 0;
  }
  .tg-stream-ad-banner-top {
    padding: 5px 8px;
  }
  .tg-stream-ad-iframe-box {
    padding: 3px 4px;
    height: auto !important;
    min-height: 90px !important;
  }
  .tg-video-url-ad-slot {
    height: 90px !important;
    min-height: 90px !important;
    max-height: 90px !important;
  }
  .tg-stream-ad-iframe {
    width: 100% !important;
    height: 90px !important;
    min-height: 90px !important;
    max-height: 90px !important;
  }
  .tg-stream-ad-iframe-box.is-expanded .tg-video-url-ad-slot,
  .tg-stream-ad-iframe-box.is-expanded .tg-stream-ad-iframe {
    height: 220px !important;
    max-height: 220px !important;
  }
  .tg-stream-ad-title {
    font-size: 10px;
  }
  .tg-stream-ad-link {
    font-size: 9.5px;
  }
  .tg-stream-ad-action-btn,
  .tg-stream-ad-admin-edit-btn,
  .tg-stream-ad-ctrl-btn {
    font-size: 9.5px;
    padding: 2px 6px;
  }
}

/* ==========================================================================
   SPONSOR POPUP OVERLAY DISABLED SAFEGUARD
   ========================================================================== */
.tg-first-ad-modal-overlay {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ==========================================================================
   REPLY EMBED STYLES & 1-CLICK REACH PULSE HIGHLIGHT
   ========================================================================== */
.tg-reply-embed {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  background: rgba(15, 23, 42, 0.55) !important;
  border-left: 3.5px solid #2AABEE !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
  margin-bottom: 7px !important;
  cursor: pointer !important;
  position: relative !important;
  overflow: hidden !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

.tg-reply-embed:hover {
  background: rgba(42, 171, 238, 0.18) !important;
  border-left-color: #38bdf8 !important;
  box-shadow: 0 4px 14px rgba(42, 171, 238, 0.28) !important;
}

.tg-reply-embed-content {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

.tg-reply-embed-head {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  line-height: 1.2 !important;
}

.tg-reply-embed-badge {
  font-size: 11px !important;
}

.tg-reply-embed .tg-quote-user {
  font-weight: 700 !important;
  color: #38bdf8 !important;
  font-size: 11.5px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex: 1 !important;
}

.tg-reply-embed-reach-tag {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  background: rgba(42, 171, 238, 0.18) !important;
  border: 1px solid rgba(42, 171, 238, 0.4) !important;
  color: #7dd3fc !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
  padding: 1px 6px !important;
  border-radius: 10px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
  transition: all 0.2s ease !important;
}

.tg-reply-embed:hover .tg-reply-embed-reach-tag {
  background: #0088cc !important;
  color: #fff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 2px 8px rgba(0, 136, 204, 0.4) !important;
}

.tg-reach-arrow {
  font-size: 10px !important;
  transition: transform 0.2s ease !important;
}

.tg-reply-embed:hover .tg-reach-arrow {
  transform: translate(2px, -2px) !important;
}

.tg-reply-embed .tg-quote-text {
  color: #cbd5e1 !important;
  font-size: 11.5px !important;
  line-height: 1.35 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Thumbnail embed preview on the right of reply quote */
.tg-reply-embed-thumb {
  width: 42px !important;
  height: 42px !important;
  border-radius: 6px !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  background: #0b1320 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
}

.tg-reply-embed-thumb img,
.tg-reply-embed-thumb video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

.tg-reply-embed-thumb .tg-reply-thumb-icon {
  position: absolute !important;
  color: #fff !important;
  font-size: 10px !important;
  background: rgba(0, 0, 0, 0.65) !important;
  width: 18px !important;
  height: 18px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4) !important;
}

.tg-reply-embed-thumb.is-audio,
.tg-reply-embed-thumb.is-location {
  background: rgba(42, 171, 238, 0.15) !important;
  color: #38bdf8 !important;
  font-size: 18px !important;
}

/* Pulsing highlight effect when 1-click reaching into the replied post */
@keyframes tgReplyTargetPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.95), 0 0 28px rgba(56, 189, 248, 0.85);
    background-color: rgba(42, 171, 238, 0.35) !important;
    transform: scale(1.02);
  }
  30% {
    box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.6), 0 0 38px rgba(56, 189, 248, 0.9);
    background-color: rgba(42, 171, 238, 0.28) !important;
    transform: scale(1.025);
  }
  70% {
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3), 0 0 20px rgba(56, 189, 248, 0.5);
    background-color: rgba(42, 171, 238, 0.15) !important;
    transform: scale(1.01);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0), 0 0 0 rgba(56, 189, 248, 0);
    transform: scale(1);
  }
}

.tg-msg-wrapper.tg-reply-target-highlight .tg-msg-bubble,
.tg-stream-post-wrapper.tg-reply-target-highlight .tg-stream-post-bubble,
.tg-stream-post-wrapper.tg-reply-target-highlight .tg-auto-video-stream-card {
  animation: tgReplyTargetPulse 2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  border-color: #38bdf8 !important;
  border-width: 1.5px !important;
}

/* ==========================================================================
   MOBILE VIDEO STREAM FULL SIZE OF WIDTH LAYOUT (EDGE-TO-EDGE)
   ========================================================================== */
@media (max-width: 768px) {
  .tg-stream-post-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin: 8px 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-self: stretch !important;
    box-sizing: border-box !important;
  }

  .tg-stream-post-wrapper .tg-msg-avatar {
    display: none !important;
  }

  .tg-stream-post-bubble {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    padding: 8px 8px 10px 8px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    background: linear-gradient(145deg, rgba(24, 34, 48, 0.98), rgba(15, 23, 42, 0.99)) !important;
    border: 1px solid rgba(42, 171, 238, 0.4) !important;
  }

  .tg-auto-video-stream-card,
  .tg-auto-video-stream-card.is-full-size,
  .tg-auto-video-stream-card.is-compact {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin: 2px 0 6px 0 !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
  }

  .tg-auto-video-stream-card .tg-stream-frame {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    background: #000 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .tg-auto-video-stream-card video,
  .tg-stream-frame video {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    max-height: 65vh !important;
    display: block !important;
    object-fit: contain !important;
    border-radius: 8px !important;
  }

  .tg-stream-ad-banner {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 8px 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
  }

  .tg-stream-ad-banner-left {
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .tg-stream-ad-title {
    font-size: 11px !important;
  }

  .tg-stream-post-footer {
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 8px 4px 4px 4px !important;
  }

  .tg-stream-post-footer > div {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    gap: 5px !important;
  }

  /* Full size sponsored ad posts on mobile */
  .tg-ad-post-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin: 8px 0 !important;
    box-sizing: border-box !important;
  }

  .tg-ad-post-wrapper .tg-msg-avatar {
    display: none !important;
  }

  .tg-ad-post-bubble {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    padding: 8px 8px 10px 8px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }

  .tg-auto-ad-stream-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin: 4px 0 !important;
    box-sizing: border-box !important;
    border-radius: 10px !important;
  }

  .tg-ad-stream-preview {
    height: 200px !important;
  }

  /* Guaranteed visibility of Chat Action Buttons on mobile (Send, Voice, Emoji) */
  .tg-chat-input-wrapper {
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 50 !important;
    padding: 10px 12px !important;
    padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
  }

  .tg-input-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .tg-input-box-wrapper {
    flex: 1 1 auto !important;
    min-width: 40px !important;
    min-height: 48px !important;
    padding: 6px 14px !important;
    border-radius: 24px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
  }

  .tg-input-textarea {
    font-size: 16px !important;
    min-height: 24px !important;
    line-height: 1.4 !important;
  }

  #tg-send-btn,
  .tg-send-btn {
    width: auto !important;
    min-width: 90px !important;
    max-width: none !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 18px !important;
    border-radius: 24px !important;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    background: linear-gradient(135deg, #0088cc, #2AABEE) !important;
    box-shadow: 0 4px 14px rgba(42, 171, 238, 0.6) !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  #tg-send-btn.has-text,
  .tg-send-btn.has-text {
    min-width: 100px !important;
    background: linear-gradient(135deg, #0088cc, #00b4d8) !important;
    box-shadow: 0 5px 18px rgba(0, 180, 216, 0.7) !important;
  }

  #tg-voice-btn,
  #tg-emoji-btn,
  #tg-attach-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    display: flex !important;
    flex-shrink: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

@media (max-width: 480px) {
  .tg-chat-input-wrapper {
    padding: 6px 8px !important;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 6px)) !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }

  .tg-stream-post-bubble,
  .tg-ad-post-bubble {
    padding: 6px 6px 8px 6px !important;
    border-radius: 10px !important;
  }
  .tg-auto-video-stream-card video,
  .tg-stream-frame video {
    max-height: 58vh !important;
  }
  .tg-ad-stream-preview {
    height: 180px !important;
  }
  .tg-input-row {
    gap: 6px !important;
  }
  .tg-input-box-wrapper {
    min-height: 46px !important;
    border-radius: 23px !important;
    padding: 5px 12px !important;
  }
  #tg-send-btn,
  .tg-send-btn {
    min-width: 86px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 16px !important;
    border-radius: 23px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
  }
  #tg-send-btn.has-text,
  .tg-send-btn.has-text {
    min-width: 96px !important;
  }
  #tg-voice-btn,
  #tg-emoji-btn,
  #tg-attach-btn {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
  }
}

/* ==========================================================================
   POST REPLIES & OWNER PROFILE ALERTS (1-CLICK REACH)
   ========================================================================== */
.tg-profile-reply-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.7);
  animation: tgPulseReplyBadge 2s infinite ease-in-out;
  z-index: 10;
  border: 1.5px solid var(--tg-bg-surface);
}

@keyframes tgPulseReplyBadge {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(239, 68, 68, 0.7); }
  50% { transform: scale(1.15); box-shadow: 0 0 14px rgba(239, 68, 68, 1); }
}

.tg-header-reply-bell {
  position: relative !important;
  background: rgba(42, 171, 238, 0.15) !important;
  border: 1px solid rgba(42, 171, 238, 0.35) !important;
  color: #38bdf8 !important;
  border-radius: 50% !important;
}

.tg-header-reply-bell:hover {
  background: rgba(42, 171, 238, 0.28) !important;
  transform: scale(1.08);
}

.tg-header-reply-bell .tg-reply-badge-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: tgPulseReplyBadge 1.5s infinite;
}

.tg-profile-replies-section {
  background: linear-gradient(145deg, rgba(24, 34, 48, 0.85), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.tg-profile-replies-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tg-profile-replies-bell {
  font-size: 16px;
  display: inline-block;
  animation: tgBellWiggle 2.5s infinite ease-in-out;
}

@keyframes tgBellWiggle {
  0%, 80%, 100% { transform: rotate(0); }
  85% { transform: rotate(12deg); }
  90% { transform: rotate(-12deg); }
  95% { transform: rotate(6deg); }
}

.tg-profile-replies-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}

.tg-replies-counter-pill {
  font-size: 10px;
  font-weight: 800;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.4);
}

.tg-btn-link-action {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: opacity 0.15s ease;
}

.tg-btn-link-action:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.tg-profile-replies-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.tg-profile-replies-empty {
  font-size: 12px;
  color: var(--tg-text-muted);
  text-align: center;
  padding: 12px 6px;
  line-height: 1.5;
}

.tg-profile-reply-card {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.tg-profile-reply-card:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.tg-profile-reply-card.is-unread {
  border-left: 3px solid #38bdf8;
  background: rgba(14, 116, 144, 0.15);
}

.tg-profile-reply-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tg-profile-reply-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-profile-reply-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.tg-profile-reply-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tg-profile-reply-name {
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
}

.tg-profile-reply-badge-action {
  font-size: 10px;
  color: #94a3b8;
}

.tg-profile-reply-time {
  font-size: 10px;
  color: #64748b;
  margin-left: auto;
}

.tg-profile-reply-quote {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.25);
  border-left: 2.5px solid #2AABEE;
  padding: 4px 8px;
  border-radius: 4px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-profile-reply-body {
  font-size: 12px;
  color: #f8fafc;
  line-height: 1.4;
  word-break: break-word;
}

.tg-profile-reply-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.tg-btn-reach-reply {
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(42, 171, 238, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tg-btn-reach-reply:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(42, 171, 238, 0.6);
}

/* Floating Real-time Toast Banner for New Replies */
.tg-reply-toast-banner {
  position: fixed;
  top: 68px;
  right: 18px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(24, 34, 48, 0.98));
  border: 1.5px solid #38bdf8;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.35);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 36px);
  animation: tgSlideInToast 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

@keyframes tgSlideInToast {
  from { transform: translateY(-20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.tg-reply-toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.tg-reply-toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.tg-reply-toast-text {
  min-width: 0;
}

.tg-reply-toast-title {
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
}

.tg-reply-toast-sub {
  font-size: 11px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.tg-reply-toast-btn {
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(42, 171, 238, 0.5);
}

.tg-reply-toast-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}

/* ==========================================================================
   FIRST VISIT ADS POPUP (ads.av91.online)
   ========================================================================== */
.tg-ads-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 999998;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-ads-popup-overlay.open {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.tg-ads-popup-overlay:not(.open) *,
.tg-ads-popup-overlay:not(.open) iframe {
  pointer-events: none !important;
  display: none !important;
}

.tg-ads-popup-box {
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  background: linear-gradient(145deg, #182533, #0e1621);
  border: 1px solid rgba(0, 136, 204, 0.45);
  border-radius: 20px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85), 0 0 35px rgba(0, 136, 204, 0.3);
  overflow: hidden;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.tg-ads-popup-overlay.open .tg-ads-popup-box {
  transform: scale(1) translateY(0);
}

.tg-ads-popup-header {
  padding: 12px 18px;
  background: rgba(0, 136, 204, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.tg-ads-popup-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.tg-ads-popup-addressbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #94a3b8;
}

.tg-ads-popup-action-icon {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.tg-ads-popup-action-icon:hover {
  background: rgba(0, 136, 204, 0.25);
  color: #38bdf8;
}

.tg-ads-popup-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.tg-ads-popup-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.tg-ads-popup-box.is-maximized {
  max-width: 96vw !important;
  max-height: 96vh !important;
  height: 96vh !important;
  border-radius: 14px !important;
}

.tg-ads-popup-box.is-maximized .tg-ads-iframe-wrap {
  height: calc(96vh - 125px) !important;
  max-height: none !important;
}

.tg-ads-popup-body {
  padding: 12px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  max-height: calc(94vh - 60px);
}

.tg-ads-iframe-wrap {
  width: 100%;
  height: clamp(520px, 72vh, 860px);
  background: #0b1320;
  border-radius: 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.tg-ads-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: none;
  display: block;
  background: #0b1320;
  pointer-events: auto !important;
}

.tg-ads-popup-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tg-ads-popup-footer-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.tg-ads-popup-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.tg-ads-btn-foot-scroll {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fde047;
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.tg-ads-btn-foot-scroll:hover {
  background: rgba(245, 158, 11, 0.35);
  color: #ffffff;
  border-color: #fde047;
  transform: translateY(-1px);
}

.tg-ads-btn-visit {
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 136, 204, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.tg-ads-btn-visit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 136, 204, 0.6);
}

.tg-ads-btn-continue {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.tg-ads-btn-continue:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

@media (max-width: 768px) {
  .tg-ads-popup-box {
    max-width: 100%;
    border-radius: 16px;
    max-height: 96vh;
    height: 96vh;
  }
  .tg-ads-popup-header {
    padding: 10px 14px;
  }
  .tg-ads-popup-addressbar {
    display: none;
  }
  .tg-ads-popup-body {
    padding: 10px 12px 14px;
    max-height: calc(96vh - 55px);
  }
  .tg-ads-iframe-wrap {
    height: calc(96vh - 160px);
    min-height: 420px;
  }
  .tg-ads-popup-footer-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .tg-ads-popup-actions-row {
    width: 100%;
    margin-left: 0;
  }
  .tg-ads-btn-foot-scroll,
  .tg-ads-btn-visit,
  .tg-ads-btn-continue {
    flex: 1;
    justify-content: center;
    padding: 10px 12px;
  }
}

.tg-ads-btn-continue:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

/* ==========================================================================
   PWA PUSH NOTIFICATION INSTALLER BANNER
   ========================================================================== */
#tg-pwa-push-notification {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-160%);
  width: calc(100% - 28px);
  max-width: 440px;
  z-index: 999999;
  background: rgba(23, 33, 43, 0.95);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 136, 204, 0.35);
  padding: 12px 14px;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

#tg-pwa-push-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

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

.tg-pwa-push-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tg-pwa-push-meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.tg-pwa-push-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 15px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.2s;
}

.tg-pwa-push-close:hover {
  color: #ffffff;
}

.tg-pwa-push-body {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tg-pwa-push-logo {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  background: #000;
}

.tg-pwa-push-text {
  min-width: 0;
  flex: 1;
}

.tg-pwa-push-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 3px;
  line-height: 1.3;
}

.tg-pwa-push-desc {
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.35;
}

.tg-pwa-push-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-pwa-btn-install {
  flex: 1;
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(0, 136, 204, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.tg-pwa-btn-install:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 136, 204, 0.6);
}

.tg-pwa-btn-later {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.tg-pwa-btn-later:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* ==========================================================================
   IP Owner & Auto-Login Badges
   ========================================================================== */
.tg-badge-ip-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(42, 171, 238, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(42, 171, 238, 0.35);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
}
.tg-badge-ip-tag:hover {
  background: rgba(42, 171, 238, 0.25);
  border-color: rgba(42, 171, 238, 0.5);
}

/* ==========================================================================
   PWA Interactive Fallback Guide Drawer & Modals (iOS & Desktop)
   ========================================================================== */
.tg-pwa-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000000;
  align-items: flex-end;
  justify-content: center;
  box-sizing: border-box;
}

.tg-pwa-modal-overlay.open {
  display: flex;
}

.tg-pwa-drawer {
  background: #182234;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 24px 22px 32px;
  position: relative;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.85);
  animation: tgSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@keyframes tgSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.tg-pwa-modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.tg-pwa-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tg-pwa-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.tg-pwa-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tg-pwa-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 136, 204, 0.4);
}

/* ==============================================================================
   1-CLICK INSTANT TELEGRAM GROUP BANNER (AV91.ONLINE)
   ============================================================================== */
.tg-oneclick-banner {
  background: linear-gradient(135deg, rgba(0, 136, 204, 0.22) 0%, rgba(6, 182, 212, 0.15) 100%);
  border-bottom: 1px solid rgba(0, 136, 204, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.tg-oneclick-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tg-oneclick-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.4);
  animation: oneClickPulse 2s infinite ease-in-out;
}

@keyframes oneClickPulse {
  0% { transform: scale(1); box-shadow: 0 0 8px rgba(0, 136, 204, 0.4); }
  50% { transform: scale(1.06); box-shadow: 0 0 16px rgba(6, 182, 212, 0.7); }
  100% { transform: scale(1); box-shadow: 0 0 8px rgba(0, 136, 204, 0.4); }
}

.tg-oneclick-text {
  min-width: 0;
}

.tg-oneclick-text strong {
  display: block;
  font-size: 0.9rem;
  color: #f1f5f9;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-oneclick-text p {
  font-size: 0.78rem;
  color: #94a3b8;
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-oneclick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tg-oneclick-btn {
  background: linear-gradient(135deg, #0088cc, #00b4d8);
  color: #fff;
  border: none;
  outline: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 15px rgba(0, 136, 204, 0.45);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.tg-oneclick-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
  box-shadow: 0 6px 20px rgba(0, 136, 204, 0.65);
}

.tg-oneclick-btn:active {
  transform: translateY(0);
}

.tg-oneclick-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  flex-shrink: 0;
}

.tg-oneclick-close-btn:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.4);
}

@media (max-width: 768px) {
  .tg-oneclick-banner {
    padding: 6px 10px;
    gap: 6px;
  }
  .tg-oneclick-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
    border-radius: 8px;
  }
  .tg-oneclick-text strong {
    font-size: 0.78rem;
    line-height: 1.2;
  }
  .tg-oneclick-text p {
    display: block;
    font-size: 0.65rem;
    margin: 1px 0 0;
    max-width: 170px;
  }
  .tg-oneclick-btn {
    padding: 5px 10px;
    font-size: 0.72rem;
    border-radius: 14px;
  }
  .tg-oneclick-close-btn {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

/* ==========================================================================
   AUTO IP COUNTRY FLAG BADGE & CLICKABLE BIO LINKS
   ========================================================================== */
.tg-flag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05em;
  line-height: 1;
  vertical-align: middle;
  margin-left: 4px;
  cursor: help;
  user-select: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
  transition: transform 0.15s ease;
}

.tg-flag-badge:hover {
  transform: scale(1.2);
}

.tg-bio-link {
  color: #38bdf8 !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
  font-weight: 500;
  word-break: break-all;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.tg-bio-link:hover {
  color: #7dd3fc !important;
  opacity: 0.9;
  text-decoration: underline !important;
}

/* ==========================================================================
   LANGUAGE SWITCHER STYLES (KH, EN, VN, TH)
   ========================================================================== */
.tg-lang-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tg-lang-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 4px 9px !important;
  border-radius: 20px !important;
  background: var(--tg-bg-surface) !important;
  border: 1px solid var(--tg-border-light) !important;
  font-size: 12px;
  font-weight: 700;
  color: var(--tg-text-main) !important;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 32px;
}

.tg-lang-btn:hover {
  background: var(--tg-bg-hover) !important;
  border-color: var(--tg-primary) !important;
  transform: translateY(-1px);
}

.tg-lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 155px;
  background: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  padding: 6px;
  z-index: 1000;
  backdrop-filter: blur(12px);
  animation: tgFadeInScale 0.18s ease-out forwards;
}

.tg-lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-text-main);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tg-lang-option:hover {
  background: var(--tg-bg-hover);
  color: var(--tg-primary);
}

.tg-lang-option.active {
  background: rgba(0, 136, 204, 0.18);
  color: var(--tg-primary);
  font-weight: 700;
}

.tg-lang-option .tg-lang-flag {
  font-size: 16px;
}

/* Drawer & Modal Language Pill Selector */
.tg-lang-pills-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tg-lang-pill {
  flex: 1;
  min-width: 60px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--tg-bg-surface);
  border: 1px solid var(--tg-border-light);
  color: var(--tg-text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.18s ease;
}

.tg-lang-pill:hover {
  background: var(--tg-bg-hover);
  border-color: var(--tg-primary);
}

.tg-lang-pill.active {
  background: linear-gradient(135deg, #0088cc, #2AABEE);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 136, 204, 0.35);
}

/* ==========================================================================
   PAUSED STREAM 20-SECOND ADVERTISEMENT OVERLAY
   ========================================================================== */
.tg-stream-paused-ad-overlay {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.tg-paused-ad-box {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(145deg, rgba(23, 33, 48, 0.96), rgba(15, 23, 42, 0.98));
  border: 1.5px solid rgba(234, 179, 8, 0.6);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(234, 179, 8, 0.25);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.tg-paused-ad-box:hover {
  transform: scale(1.02);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.7), 0 0 32px rgba(234, 179, 8, 0.4);
}

.tg-paused-ad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(234, 179, 8, 0.15);
  border-bottom: 1px solid rgba(234, 179, 8, 0.3);
}

.tg-paused-ad-badge {
  font-size: 11px;
  font-weight: 800;
  color: #fde047;
  letter-spacing: 0.5px;
}

.tg-paused-ad-sec-pill {
  font-size: 11px;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tg-paused-ad-sec-pill strong {
  color: #38bdf8;
}

.tg-paused-ad-body {
  padding: 14px;
  text-align: center;
}

.tg-paused-ad-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.tg-paused-ad-link {
  font-size: 13px;
  font-weight: 600;
  color: #38bdf8;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tg-paused-ad-footer {
  padding: 10px 14px 14px;
  display: flex;
  justify-content: center;
}

.tg-paused-ad-btn {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #000;
  border: none;
  border-radius: 20px;
  font-weight: 800;
  font-size: 12.5px;
  padding: 7px 20px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
  transition: transform 0.15s, filter 0.15s;
}

.tg-paused-ad-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* ==========================================================================
   ADMIN VIDEO SIZE CONTROL: TAP OPTIONS & DASHBOARD CARDS
   ========================================================================== */
.tg-auto-video-stream-card.is-medium-size {
  max-width: 580px !important;
  width: 96% !important;
}

.tg-auto-video-stream-card.is-medium-size .tg-stream-frame,
.tg-auto-video-stream-card.is-medium-size video {
  max-height: 380px !important;
}

/* Stream Video Author Tap Option Bar for Admin */
.tg-admin-size-tap-bar {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(234, 179, 8, 0.4);
  padding: 2px 6px;
  border-radius: 8px;
}

.tg-admin-size-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
}

.tg-admin-size-pill:hover {
  background: rgba(234, 179, 8, 0.25);
  color: #fde047;
  border-color: #fde047;
}

.tg-admin-size-pill.active {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #000;
  border-color: transparent;
  font-weight: 800;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

/* Admin Dashboard Video Size Grid */
.tg-admin-videosize-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.tg-admin-videosize-card {
  background: var(--tg-bg-surface);
  border: 1.5px solid var(--tg-border-light);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.tg-admin-videosize-card:hover {
  transform: translateY(-2px);
  border-color: var(--tg-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.tg-admin-videosize-card.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.tg-videosize-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tg-videosize-card-icon {
  font-size: 20px;
}

.tg-videosize-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--tg-text-main);
  flex: 1;
  margin-left: 8px;
}

.tg-videosize-card-check {
  display: none;
  font-size: 10px;
  background: #f59e0b;
  color: #000;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.tg-admin-videosize-card.active .tg-videosize-card-check {
  display: inline-block;
}

.tg-videosize-card-body p {
  margin: 4px 0;
  font-size: 12px;
  color: var(--tg-text-muted);
}

.tg-videosize-card-desc {
  font-size: 11px !important;
  line-height: 1.4;
  margin-top: 6px !important;
}

.tg-videosize-tap-btn {
  margin-top: 12px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--tg-border-light);
  color: var(--tg-text-main);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tg-admin-videosize-card.active .tg-videosize-tap-btn,
.tg-videosize-tap-btn:hover {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #000;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

/* ==========================================================================
   Live Ad Script Banner & Admin Preview Engine (Adsterra / HighRevenueFormat)
   ========================================================================== */
.tg-chat-ad-script-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, rgba(14, 22, 33, 0.98) 0%, rgba(10, 16, 25, 0.98) 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  padding: 4px 12px 6px 12px;
  position: relative;
  z-index: 20;
  width: 100%;
  max-height: 110px;
  overflow: hidden;
  box-sizing: border-box;
  animation: tgFadeInBanner 0.3s ease;
}

@keyframes tgFadeInBanner {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tg-chat-ad-script-header {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.tg-chat-ad-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  text-transform: uppercase;
}

.tg-chat-ad-close-btn {
  background: transparent;
  border: none;
  color: var(--tg-text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 1px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.tg-chat-ad-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.tg-chat-ad-script-frame-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 50px;
  max-height: 90px;
  overflow: hidden;
}

.tg-ad-preview-iframe {
  border: none !important;
  outline: none !important;
  background: transparent !important;
  display: block !important;
  margin: 0 auto !important;
  max-width: 100% !important;
}

.tg-ad-script-preview-box {
  background: #070d18;
  border: 1px dashed rgba(245, 158, 11, 0.45);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  position: relative;
  overflow: hidden;
}

.tg-medialimit-preset-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tg-medialimit-preset-btn.active {
  background: #10b981 !important;
  color: #fff !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   OPERATOR AD IFRAME & MONETIZATION CARDS (BELOW VIDEOS)
   ========================================================================== */
.tg-operator-ad-card {
  margin-top: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: all 0.25s ease;
  width: 100%;
}
.tg-operator-ad-card:hover {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.12);
}
.tg-operator-ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.tg-operator-ad-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  text-transform: uppercase;
}
.tg-operator-ad-author {
  font-size: 11px;
  color: #34d399;
  font-weight: 600;
}
.tg-operator-ad-open-btn {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  cursor: pointer;
  transition: all 0.2s;
}
.tg-operator-ad-open-btn:hover {
  background: #10b981;
  color: #fff;
}
.tg-operator-ad-iframe-frame {
  width: 100%;
  min-height: 85px;
  height: 90px;
  background: #fff;
  position: relative;
}
.tg-operator-ad-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Chat Feed Video Attachments & Admin Video Posts */
.tg-msg-wrapper.has-admin-video {
  max-width: 95% !important;
  width: 100% !important;
}

.tg-msg-bubble.is-admin-video-bubble {
  width: 100% !important;
  max-width: 860px !important;
  padding: 10px 14px !important;
  box-sizing: border-box !important;
}

.tg-msg-video-media {
  cursor: pointer !important;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  width: 100%;
  max-width: 640px;
  margin-top: 6px;
  transition: max-width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-msg-video-media.is-full-size,
.tg-msg-video-media.is-admin-video {
  width: 100% !important;
  max-width: 840px !important;
  aspect-ratio: 16 / 9 !important;
  border-radius: 12px !important;
  border: 2px solid rgba(245, 158, 11, 0.65) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.25) !important;
  background-color: #000 !important;
}

.tg-msg-video-media.is-medium-size {
  max-width: 580px !important;
  aspect-ratio: 16 / 9 !important;
}

.tg-msg-video-media.is-compact {
  max-width: 380px !important;
  aspect-ratio: 16 / 9 !important;
}

.tg-msg-video-media video {
  width: 100%;
  height: 100%;
  max-height: 540px;
  object-fit: contain;
  border-radius: 10px;
  display: block;
  background: #000;
}

/* ==========================================================================
   ADMIN BEST / PRIORITY MP4 VIDEOS STYLES
   ========================================================================== */
.tg-priority-video-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  transition: all 0.2s ease;
}

.tg-priority-video-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(245, 158, 11, 0.4);
}

.tg-priority-video-card.is-active {
  border-left: 4px solid #f59e0b;
}

.tg-priority-video-card.is-inactive {
  opacity: 0.6;
  border-left: 4px solid #6b7280;
}

.tg-priority-info {
  flex: 1;
  min-width: 0;
}

.tg-priority-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.tg-priority-title-text {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--tg-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 450px;
}

.tg-priority-percent-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.tg-priority-url-text {
  font-size: 11.5px;
  color: var(--tg-text-muted);
  font-family: Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

.tg-priority-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tg-badge-priority-tag {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #fff !important;
  font-weight: 800 !important;
  font-size: 10.5px !important;
  padding: 2px 8px !important;
  border-radius: 6px !important;
  letter-spacing: 0.4px !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5) !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   OPERATOR AUTO-UPGRADE & STANDING TRACKING SYSTEM
   ========================================================================== */
.tg-operator-watch-pill {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tg-operator-watch-pill:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.tg-operator-watch-pill.is-operator {
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde047;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(15, 23, 42, 0.95));
}

.tg-operator-standing-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.tg-operator-standing-card.is-operator-active {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(145deg, rgba(40, 28, 10, 0.8), rgba(15, 23, 42, 0.95));
}

.tg-operator-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  margin: 8px 0;
}

.tg-operator-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #60a5fa);
  border-radius: 10px;
  transition: width 0.4s ease;
}

.tg-operator-progress-bar-fill.gold {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.tg-operator-modal-box {
  max-width: 520px;
  width: 92%;
  background: linear-gradient(145deg, #182230, #0f172a);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.2);
  text-align: center;
  animation: tgFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tg-operator-modal-box.is-downgrade {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(239, 68, 68, 0.15);
}

.tg-operator-modal-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
}

.tg-operator-rules-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 16px 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
  color: var(--tg-text-main);
}

.tg-operator-rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tg-operator-rule-item.warning {
  color: #fde047;
}

.tg-operator-rule-item.danger {
  color: #fca5a5;
}

/* ==========================================================================
   ACTIVE OPERATOR LOGO & BADGE SYSTEM
   ========================================================================== */
.tg-operator-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(6, 182, 212, 0.22) 100%);
  border: 1px solid rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 12px;
  vertical-align: middle;
  text-transform: uppercase;
  user-select: none;
}

.tg-operator-active-badge .tg-op-logo-svg {
  font-size: 11px;
  line-height: 1;
  filter: drop-shadow(0 0 4px #10b981);
}

.tg-operator-active-badge .tg-op-text {
  font-weight: 800;
}

.tg-operator-active-badge .tg-op-pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: tgOpBadgePulse 1.8s infinite;
}

@keyframes tgOpBadgePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.tg-member-role-badge.tg-role-operator {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(6, 182, 212, 0.22));
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Admin 1-Click Make / Demote Operator Button */
.tg-member-operator-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.tg-member-operator-btn.not-op {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.tg-member-operator-btn.not-op:hover {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  transform: scale(1.03);
}

.tg-member-operator-btn.is-op {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #a7f3d0;
}

.tg-member-operator-btn.is-op:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: #ef4444;
  color: #fca5a5;
}

/* ==========================================================================
   SAFETY OVERRIDE: PWA INSTALL DOCK & FAB PLACEMENT AWAY FROM SEND BAR
   ========================================================================== */
#av91-pwa-fab,
.av91-pwa-fab {
  top: 70px !important;
  bottom: auto !important;
  right: 16px !important;
  left: auto !important;
  z-index: 99990 !important;
}

#av91-pwa-dock,
.av91-pwa-dock {
  bottom: 92px !important;
  z-index: 99990 !important;
}




