/* AVMeets - LiveKit Vanilla CSS Stylesheet */
:root {
  --bg-dark: #0c0e14;
  --bg-card: #151821;
  --bg-card-hover: #1e222f;
  --bg-dock: rgba(21, 24, 33, 0.9);
  --border-color: #272c3d;
  --border-focus: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #ff5533;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Global Hidden Utility */
.hidden {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
}

/* Navigation Header */
.app-header {
  height: 56px;
  background-color: rgba(12, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 50;
  flex-shrink: 0;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-main);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff5533, #3b82f6);
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: bold;
}

.header-center-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
}

.header-center-tools.hidden,
.header-center-tools[style*="display: none"],
.header-center-tools[style*="display:none"] {
  display: none !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.warning {
  background: var(--warning);
}

/* Views */
.view {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.view.hidden {
  display: none !important;
}

/* ----------------------------------------------------
   LOBBY VIEW (PRE-JOIN)
---------------------------------------------------- */
#lobby-view {
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.lobby-container {
  display: flex;
  gap: 2rem;
  max-width: 1020px;
  width: 100%;
  align-items: stretch;
  margin: auto;
}

@media (max-width: 860px) {
  .lobby-container {
    flex-direction: column-reverse;
  }
}

.lobby-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--bg-card-hover);
  color: var(--text-main);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Forms */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

.input-with-button .btn {
  white-space: nowrap;
}

.form-control {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: rgba(12, 14, 20, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* Checkbox group */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-group input {
  cursor: pointer;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.btn:hover {
  background: #282f42;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
}

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

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
}

.btn-icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

.btn.disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Preview Box (Lobby) */
.preview-box {
  flex: 1.1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.preview-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-screen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror preview */
}

.avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: white;
  font-size: 2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.preview-screen-overlay {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.preview-screen-overlay > * {
  pointer-events: auto;
}

.preview-controls {
  display: flex;
  gap: 0.5rem;
}

.preview-controls .btn.muted {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

.audio-meter-wrap {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.audio-meter-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #10b981, #f59e0b, #ef4444);
  transition: width 0.05s ease-out;
}

/* Background Effects Selector (Lobby & Dropup & Modal) */
.bg-effects-panel {
  margin-top: 1rem;
}

.bg-effects-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bg-grid {
  display: grid;
  /* grid-template-columns: repeat(6, 1fr); */
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  max-height: 200px;
  /* height: 350px; */
  overflow-y: auto;
}

@media (max-width: 600px) {
  .bg-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.bg-card {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: #111;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  transition: var(--transition);
  color: #fff;
  padding: 2px;
}

.bg-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.bg-card .bg-label {
  position: absolute;
  bottom: 2px;
  left: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.7);
  padding: 1px 4px;
  border-radius: 3px;
  text-align: center;
  z-index: 2;
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bg-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

.bg-card:hover {
  border-color: #4b5563;
}

.bg-blur-preview {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #374151, #1f2937);
  filter: blur(4px);
  position: absolute;
  inset: 0;
}

/* Banner / Info Alert */
.info-banner {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: #93c5fd;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.info-banner.warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

.info-banner.success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

/* ----------------------------------------------------
   MEETING VIEW (ACTIVE CONFERENCE)
---------------------------------------------------- */
#meeting-view {
  flex-direction: column;
}

.meeting-header {
  height: 52px;
  background: rgba(12, 14, 20, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 30;
  flex-shrink: 0;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.room-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
}

.meeting-timer {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.meeting-stage-container {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  position: relative;
  width: 100%;
  height: 100%;
}

/* Video Grid Stage */
#video-stage {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
  box-sizing: border-box;
  place-content: center;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Empty Stage (Only local participant in room) */
#video-stage.grid-layout-empty {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.stage-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 2rem;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  max-width: 440px;
  margin: auto;
  gap: 0.85rem;
  animation: fadeIn 0.3s ease;
}

.empty-state-avatar {
  font-size: 2.75rem;
  line-height: 1;
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.empty-state-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

/* Overflow Badge when > 25 participants */
.stage-overflow-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* 1 tile: 1x1 */
#video-stage.grid-layout-1x1 {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

#video-stage.grid-layout-1x1 .participant-tile {
  width: 100%;
  height: auto;
  max-width: min(1100px, calc((100vh - 160px) * 16 / 9));
  max-height: calc(100vh - 160px);
  aspect-ratio: 16 / 9;
}

/* 2 tiles: 2x1 (side by side) */
#video-stage.grid-layout-2x1 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}

#video-stage.grid-layout-2x1 .participant-tile {
  width: 100%;
  height: auto;
  max-width: min(100%, calc((100vh - 160px) * 16 / 9));
  max-height: calc(100vh - 160px);
  aspect-ratio: 16 / 9;
}

/* 3 tiles: 3x1 (3 videos side by side) */
#video-stage.grid-layout-3x1 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}

#video-stage.grid-layout-3x1 .participant-tile {
  width: 100%;
  height: auto;
  max-width: min(100%, calc((100vh - 160px) * 16 / 9));
  max-height: calc(100vh - 160px);
  aspect-ratio: 16 / 9;
}

/* 4 tiles: 2x2 */
#video-stage.grid-layout-2x2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

#video-stage.grid-layout-2x2 .participant-tile {
  width: 100%;
  height: auto;
  max-width: min(100%, calc(((100vh - 170px) / 2) * 16 / 9));
  max-height: calc((100vh - 170px) / 2);
  aspect-ratio: 16 / 9;
}

/* 5-6 tiles: 3x2 */
#video-stage.grid-layout-3x2 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

#video-stage.grid-layout-3x2 .participant-tile {
  width: 100%;
  height: auto;
  max-width: min(100%, calc(((100vh - 170px) / 2) * 16 / 9));
  max-height: calc((100vh - 170px) / 2);
  aspect-ratio: 16 / 9;
}

/* 7-9 tiles: 3x3 */
#video-stage.grid-layout-3x3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
}

#video-stage.grid-layout-3x3 .participant-tile {
  width: 100%;
  height: auto;
  max-width: min(100%, calc(((100vh - 180px) / 3) * 16 / 9));
  max-height: calc((100vh - 180px) / 3);
  aspect-ratio: 16 / 9;
}

/* 10-16 tiles: 4x4 */
#video-stage.grid-layout-4x4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

#video-stage.grid-layout-4x4 .participant-tile {
  width: 100%;
  height: auto;
  max-width: min(100%, calc(((100vh - 190px) / 4) * 16 / 9));
  max-height: calc((100vh - 190px) / 4);
  aspect-ratio: 16 / 9;
}

/* 17-25 tiles: 5x5 (Max 25 participants: 5 cols x 5 rows) */
#video-stage.grid-layout-5x5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
}

#video-stage.grid-layout-5x5 .participant-tile {
  width: 100%;
  height: auto;
  max-width: min(100%, calc(((100vh - 200px) / 5) * 16 / 9));
  max-height: calc((100vh - 200px) / 5);
  aspect-ratio: 16 / 9;
}

/* Mobile Responsive Grid Breakpoints */
@media (max-width: 768px) {
  #video-stage.grid-layout-2x1 {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  #video-stage.grid-layout-3x1 {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }
  #video-stage.grid-layout-3x2,
  #video-stage.grid-layout-3x3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Participant Tile */
.participant-tile {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: auto;
  margin: auto;
  box-sizing: border-box;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.25s ease, box-shadow 0.25s ease;
  will-change: transform;
}

.participant-tile.pinned {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.6), 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

.tile-pin-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(30, 58, 138, 0.85);
  color: #93c5fd;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  backdrop-filter: blur(8px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.participant-tile.speaking {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.5), 0 8px 24px rgba(16, 185, 129, 0.2) !important;
}

.tile-hand-badge {
  position: absolute;
  top: 10px;
  left:150px;
  /* left: 10px; */
  background: #f59e0b;
  color: #1e1b4b;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.45);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: tileHandBounce 1.5s infinite ease-in-out;
}

@keyframes tileHandBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.btn-tile-lower-hand {
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: none;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-tile-lower-hand:hover {
  background: rgba(0, 0, 0, 0.75);
}

.tile-video-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 1;
}

.tile-video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.participant-tile.screen-share-tile {
  border: 2px solid #3b82f6;
  background: #090b10;
}

.participant-tile.screen-share-tile .tile-video-container video {
  object-fit: contain !important;
  background: #000;
  transform: none !important;
}

/* YouTube Theater / Expand Single Video Mode */
#video-stage.stage-single-focus {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  width: 100%;
  height: 100%;
}

#video-stage.stage-single-focus .participant-tile:not(.focused-single-tile) {
  display: none !important;
}

#video-stage.stage-single-focus .participant-tile.focused-single-tile {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: calc(100vh - 145px) !important;
  aspect-ratio: 16 / 9;
  margin: auto;
  border-color: var(--primary);
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.45);
}

@media (max-width: 600px) {
  #video-stage.stage-single-focus .participant-tile.focused-single-tile {
    aspect-ratio: 9 / 16;
    height: 100% !important;
    width: auto !important;
    max-width: 100% !important;
  }
}

/* Tile Action Overlay Buttons (YouTube Expand, PiP, Fullscreen) */
.tile-actions {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  gap: 0.35rem;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.participant-tile:hover .tile-actions,
.participant-tile.focused-single-tile .tile-actions {
  opacity: 1;
}

.tile-action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(12, 14, 20, 0.75);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.tile-action-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.08);
}

/* Exit focus button */
.btn-exit-focus {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(6px);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 25;
  display: none;
  transition: var(--transition);
}

.btn-exit-focus:hover {
  background: var(--primary);
}

.participant-tile.focused-single-tile .btn-exit-focus {
  display: block;
}

/* Speaker Focus Layout */
#video-stage.layout-speaker-focus {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
  padding: 0.75rem;
  overflow: hidden;
}

#video-stage.layout-speaker-focus .speaker-stage-main {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#video-stage.layout-speaker-focus .speaker-stage-main .participant-tile {
  width: 100%;
  height: 100%;
  max-width: 1280px;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  margin: auto;
}

#video-stage.layout-speaker-focus .speaker-thumbnails-rail {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0;
  height: 110px;
  flex-shrink: 0;
}

#video-stage.layout-speaker-focus .speaker-thumbnails-rail .participant-tile {
  width: 180px;
  height: 101px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
}

#video-stage.layout-speaker-focus .speaker-thumbnails-rail .participant-tile:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

/* Floating Self-View Preview (Bottom-Left Detached: Smaller, Min/Max only) */
.floating-self-preview {
  position: absolute;
  bottom: 80px;
  left: 1rem;
  width: 175px;
  aspect-ratio: 16 / 9;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
  z-index: 35;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), height 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.2s ease;
}

.floating-self-preview.minimized {
  width: 145px;
  height: 32px;
  aspect-ratio: auto;
  border-radius: 9999px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.18);
}

.floating-self-preview.minimized .floating-preview-body {
  display: none !important;
}

.floating-self-preview.minimized .floating-preview-header {
  height: 100%;
  border-bottom: none;
  background: transparent;
  padding: 0 0.65rem;
}

.floating-preview-header {
  height: 26px;
  background: rgba(12, 14, 20, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  z-index: 2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

.floating-preview-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.self-preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.floating-btn-minmax {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 3px;
  transition: color 0.15s ease;
}

.floating-btn-minmax:hover {
  color: #fff;
}

.floating-preview-body {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.floating-preview-body video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.floating-preview-body .avatar-placeholder {
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
}

/* Fabric.js Whiteboard Overlay */
.whiteboard-modal {
  position: absolute;
  inset: 0;
  background: #11141f;
  z-index: 45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.whiteboard-modal.hidden {
  display: none !important;
}

.whiteboard-header {
  height: 48px;
  background: #181c2b;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  flex-shrink: 0;
}

.wb-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.whiteboard-toolbar {
  background: #1e2235;
  border-bottom: 1px solid var(--border-color);
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.wb-tool-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.wb-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.32rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition);
  white-space: nowrap;
}

.wb-btn:hover {
  background: var(--bg-card-hover);
  border-color: #3b445c;
}

.wb-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.wb-divider {
  width: 1px;
  height: 22px;
  background: var(--border-color);
  margin: 0 0.2rem;
}

.wb-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.whiteboard-canvas-container {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.whiteboard-canvas-container .canvas-container {
  margin: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ----------------------------------------------------
   CONTROL DOCK & DROP-UP MENUS
---------------------------------------------------- */
.control-dock {
  height: 80px;
  background: var(--bg-dock);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0 1rem;
  z-index: 30;
  flex-shrink: 0;
  position: relative;
}

/* 768px to 1023px and below */
@media (max-width: 1023px) {
  .control-dock {
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  .control-dock .control-group,
  .control-dock .control-btn.standalone,
  .control-dock .control-btn.main-btn,
  .control-dock .control-btn.caret-btn,
  .control-dock .control-btn.danger-action {
    flex-shrink: 0 !important;
  }
  .control-btn.standalone {
    padding: 0 12px;
  }
  .control-btn.standalone svg,
  .control-btn.standalone span {
    width: 22px;
    height: 22px;
  }
  #toast-container {
    bottom: 5rem !important;
  }
  #btn-dock-fullscreen span {
    font-size: 1.5rem;
    line-height: 0.8;
  }
}


/* Control Group (Split Button) */
.control-group {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.control-group:hover {
  border-color: #3b445c;
}

.control-group.muted {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: #ef4444 !important;
}

.control-group.muted .control-btn.main-btn {
  color: #ef4444 !important;
}

.control-group.muted .control-btn.caret-btn {
  color: #f87171 !important;
  border-left-color: rgba(239, 68, 68, 0.35) !important;
}

.control-group.muted:hover {
  background: rgba(239, 68, 68, 0.32) !important;
  border-color: #dc2626 !important;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: none;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.control-btn.main-btn {
  padding: 0 14px;
  gap: 0.4rem;
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.control-btn.caret-btn {
  padding: 0 8px;
  border-left: 1px solid var(--border-color);
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  color: var(--text-muted);
}

.control-btn.caret-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.control-btn.standalone {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  position: relative;
}

.control-btn.standalone:hover {
  background: var(--bg-card-hover);
  border-color: #3b445c;
}

.control-btn.standalone.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.control-btn.danger-action {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  width: 54px;
}

.control-btn.danger-action:hover {
  background: var(--danger-hover);
}

/* Drop-Up Menu */
.dropup-menu {
  position: fixed;
  z-index: 1000;
  min-width: 280px;
  background: #151824 !important;
  border: 1px solid #2d3348;
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: min(76vh, 520px);
  overflow-y: auto;
  overflow-x: hidden;
  animation: dropupFade 0.14s cubic-bezier(0.1, 0.9, 0.2, 1);
  will-change: transform, opacity;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.dropup-menu::-webkit-scrollbar {
  width: 5px;
}
.dropup-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

#dropup-more-controls-menu {
  width: 230px !important;
}

.dropup-menu.hidden,
.dropup-menu[style*="display: none"],
.dropup-menu[style*="display:none"] {
  display: none !important;
}

.control-btn svg.hidden,
.control-btn svg[style*="display: none"],
.control-btn svg[style*="display:none"] {
  display: none !important;
}

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

.dropup-section-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
}

/* Collapsible Dropup Sections */
.dropup-collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.dropup-collapse-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dropup-section-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.dropup-badge-count {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.collapse-arrow {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  display: inline-block;
}

.collapse-arrow.collapsed {
  transform: rotate(-90deg);
}

.dropup-section-content {
  display: flex;
  flex-direction: column;
}

.dropup-section-content.hidden {
  display: none !important;
}

.dropup-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 160px;
  overflow-y: auto;
}

.dropup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-main);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: var(--transition);
}

.dropup-item:hover {
  background: var(--bg-card-hover);
}

.dropup-item.selected {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-weight: 500;
}

.dropup-item .item-check {
  color: var(--primary);
  font-size: 0.9rem;
}

.dropup-divider {
  height: 1px;
  background: #272c3d;
  margin: 0.25rem 0;
}

.dropup-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.dropup-toggle-row:hover {
  background: var(--bg-card-hover);
}

/* Background Effects mini-grid inside dropup */
.dropup-bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  padding: 0.2rem 0.2rem;
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.dropup-bg-grid::-webkit-scrollbar {
  width: 4px;
}
.dropup-bg-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* ----------------------------------------------------
   SIDE DRAWER (CHAT & PARTICIPANTS)
---------------------------------------------------- */
.side-drawer {
  width: 0;
  min-width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  background: var(--bg-card);
  border-left: 0px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  flex-shrink: 0;
  visibility: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease,
              border-left-width 0.25s ease;
  z-index: 25;
}

.side-drawer.open {
  width: 360px;
  min-width: 340px;
  max-width: 380px;
  opacity: 1;
  visibility: visible;
  border-left: 1px solid var(--border-color);
  overflow: hidden;
}

.side-drawer .drawer-header,
.side-drawer .drawer-body {
  min-width: 340px;
}

@media (max-width: 768px) {
  .side-drawer.open {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    z-index: 50;
  }
}

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

.drawer-tabs {
  display: flex;
  gap: 0.5rem;
}

.drawer-tab {
  background: transparent;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.drawer-tab.active {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

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

.drawer-close:hover {
  color: var(--text-main);
}

.drawer-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat view */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  word-break: break-word;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chat-bubble.theirs {
  align-self: flex-start;
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
}

.chat-bubble.system {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
  padding: 0.2rem;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.7rem;
  opacity: 0.75;
  margin-bottom: 0.25rem;
}

.chat-input-bar {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
}

.chat-input-bar input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: rgba(12, 14, 20, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}

.chat-input-bar input:focus {
  border-color: var(--border-focus);
}

/* Participants List */
.participants-list {
  padding: 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.participant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.participant-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.participant-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: #fff;
}

.participant-user-name {
  font-weight: 500;
}

.participant-icons {
  display: flex;
  gap: 0.4rem;
  color: var(--text-muted);
}

/* ----------------------------------------------------
   MODALS
---------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: 1rem;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.code-box {
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: #38bdf8;
  word-break: break-all;
  max-height: 120px;
  overflow-y: auto;
}

/* Settings modal preview screen */
.settings-preview-screen {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 240px;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.settings-preview-screen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

/* ----------------------------------------------------
   TOAST NOTIFICATIONS
---------------------------------------------------- */
#toast-container {
  position: fixed;
  /* bottom: 1.5rem; */
  bottom: 5rem;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 80;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  animation: toastIn 0.25s ease-out;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.4);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.4);
}

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

/* SVG Helpers */
svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ----------------------------------------------------
   REACTIONS & FLOATING EMOJIS
---------------------------------------------------- */
.reaction-item {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: transform 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reaction-item:hover {
  transform: scale(1.3);
  background: rgba(255, 255, 255, 0.1);
}

.reaction-effects-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  overflow: hidden;
}

.floating-reaction-emoji {
  position: absolute;
  bottom: 85px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: floatEmojiUp 2.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
  pointer-events: none;
  z-index: 100;
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
}

.floating-reaction-emoji .emoji-char,
.floating-reaction-emoji .emoji-glyph {
  font-size: 3.6rem;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.65));
  line-height: 1;
  user-select: none;
  display: inline-block;
  will-change: transform;
}

.floating-reaction-emoji .emoji-sender {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

@keyframes floatEmojiUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 25px, 0) scale(0.4) rotate(0deg);
  }
  8% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1.15) rotate(-3deg);
  }
  16% {
    opacity: 1;
    transform: translate3d(-6px, -45px, 0) scale(1.02) rotate(2deg);
  }
  38% {
    opacity: 1;
    transform: translate3d(8px, -145px, 0) scale(1) rotate(-2deg);
  }
  64% {
    opacity: 0.95;
    transform: translate3d(-7px, -260px, 0) scale(0.97) rotate(1deg);
  }
  84% {
    opacity: 0.7;
    transform: translate3d(4px, -360px, 0) scale(0.93) rotate(-1deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -440px, 0) scale(0.88) rotate(0deg);
  }
}

/* ----------------------------------------------------
   LEXICAL COLLABORATIVE DOCUMENT EDITOR
   (faithful to playground.lexical.dev layout & design)
---------------------------------------------------- */
.lexical-modal {
  position: fixed;
  inset: 1.5rem;
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.2s ease-out;
}

.lexical-header {
  height: 52px;
  background: #1f2937;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  flex-shrink: 0;
}

.lexical-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
}

.lexical-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.lexical-ext-tag {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.lexical-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lexical-collab-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Playground Toolbar */
.lexical-toolbar {
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  user-select: none;
}

.lexical-toolbar.disabled {
  pointer-events: none;
  opacity: 0.4;
}

.lexical-tool-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.lexical-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 0.3rem;
}

.lexical-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  transition: all 0.15s ease;
}

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

.lexical-btn.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: #3b82f6;
  color: #60a5fa;
}

.lexical-select {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  font-size: 0.8rem;
  border-radius: 4px;
  padding: 4px 6px;
  height: 28px;
  cursor: pointer;
  outline: none;
}

.lexical-select:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.lexical-color-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  color: #cbd5e1;
  height: 28px;
  border: 1px solid transparent;
}

.lexical-color-label:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lexical-color-label input[type="color"] {
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.lexical-readonly-banner {
  background: rgba(245, 158, 11, 0.15);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d;
  font-size: 0.82rem;
  padding: 0.4rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Document Canvas & Paper Sheet */
.lexical-scroll-container {
  flex: 1;
  background: #0b0f19;
  overflow-y: auto;
  padding: 2rem 1rem;
  display: flex;
  justify-content: center;
}

.lexical-page-sheet {
  width: 100%;
  max-width: 820px;
  min-height: 650px;
  background: #ffffff;
  color: #111827;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  padding: 3rem 3.5rem;
  position: relative;
  box-sizing: border-box;
}

.lexical-content {
  outline: none;
  min-height: 550px;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: #1f2937;
  word-break: break-word;
}

.lexical-content[contenteditable="false"] {
  cursor: default;
}

.lexical-content:empty:before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
  display: block;
}

/* Lexical Content Typography */
.lexical-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 1.2rem 0 0.6rem;
  color: #111827;
}

.lexical-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: #1f2937;
}

.lexical-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0.8rem 0 0.4rem;
  color: #374151;
}

.lexical-content p {
  margin: 0.4rem 0;
}

.lexical-content blockquote {
  border-left: 4px solid #3b82f6;
  margin: 0.75rem 0;
  padding: 0.5rem 0 0.5rem 1rem;
  color: #4b5563;
  font-style: italic;
  background: #f8fafc;
  border-radius: 0 4px 4px 0;
}

.lexical-content pre,
.lexical-content code.code-block {
  background: #1f2937;
  color: #e5e7eb;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  display: block;
}

.lexical-content code:not(.code-block) {
  background: #f1f5f9;
  color: #dc2626;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

.lexical-content hr {
  border: none;
  border-top: 2px solid #e2e8f0;
  margin: 1.5rem 0;
}

.lexical-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.lexical-content table,
.lexical-content th,
.lexical-content td {
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
}

.lexical-content th {
  background: #f8fafc;
  font-weight: 600;
}

.lexical-content img {
  max-width: 100%;
  border-radius: 6px;
  margin: 0.75rem 0;
}

.lexical-content a {
  color: #2563eb;
  text-decoration: underline;
}

/* Playground Footer */
.lexical-footer {
  height: 34px;
  background: #1f2937;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  font-size: 0.75rem;
  color: #94a3b8;
  flex-shrink: 0;
}

.lexical-footer-left,
.lexical-footer-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot-separator {
  color: #475569;
}

.lexical-sync-status {
  font-weight: 500;
}

.lexical-sync-status.synced {
  color: #22c55e;
}

.lexical-sync-status.syncing {
  color: #f59e0b;
}

/* ----------------------------------------------------
   BREAKOUT ROOMS MODAL & LIST
---------------------------------------------------- */
.breakout-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.breakout-room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.breakout-room-item:hover {
  border-color: #4b5563;
}

.breakout-room-name-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.breakout-room-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: #fff;
}

.breakout-room-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ----------------------------------------------------
   POLLS & SURVEYS MODAL
---------------------------------------------------- */
.poll-option-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.poll-option-row:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
}

.poll-option-row input[type="radio"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.poll-result-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.poll-result-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #fff;
}

.poll-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
}

.poll-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* Whiteboard permission controls */
.whiteboard-toolbar.disabled {
  pointer-events: none;
  opacity: 0.4;
}

.wb-permission-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ----------------------------------------------------
   BREAKOUT ACTIVE BANNER
---------------------------------------------------- */
.breakout-active-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(30, 58, 138, 0.85), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  margin-bottom: 0.75rem;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.breakout-active-banner.hidden {
  display: none !important;
}

.breakout-banner-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.breakout-badge {
  background: #3b82f6;
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.4px;
}

.breakout-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ----------------------------------------------------
   RECORDING INDICATORS
---------------------------------------------------- */
@keyframes recBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(0.85); }
}

#rec-dot.recording {
  animation: recBlink 1s infinite ease-in-out;
  box-shadow: 0 0 8px #ef4444;
}

.btn-recording-active {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

/* ----------------------------------------------------
   RECORDINGS LIST
---------------------------------------------------- */
.recording-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #1e2438;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.recording-file-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.recording-file-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recording-file-name {
  font-weight: 500;
  font-size: 0.85rem;
  color: #f1f5f9;
}

.recording-file-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.recording-file-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ----------------------------------------------------
   LIVE STREAMING RTMP & LIVE BADGE
---------------------------------------------------- */
.watch-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #dc2626;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 999px;
  animation: livePulse 2s infinite ease-in-out;
}

.watch-badge-live.hidden {
  display: none !important;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.82; transform: scale(1.04); }
}

.btn-rtmp-preset {
  font-size: 0.72rem;
  padding: 3px 8px;
}

/* User Role & Host Claim Badges */
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.badge-role.badge-host {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.badge-role.badge-host:hover {
  background: rgba(245, 158, 11, 0.28);
}

.badge-role.badge-participant {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.25);
  color: #94a3b8;
}

.badge-role.badge-participant:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

/* ----------------------------------------------------
   SELF PREVIEW CONTROLS & STAGE FOCUS
---------------------------------------------------- */
.floating-preview-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

.floating-btn-tool {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.floating-btn-tool:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.floating-self-preview {
  cursor: grab;
}

.floating-self-preview:active {
  cursor: grabbing;
}

.floating-self-preview.docked-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

.floating-self-preview.stage-focused {
  outline: 3px solid #3b82f6;
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.6);
}

/* ----------------------------------------------------
   REACTIONS POPOVER (UPWARDS ORIENTED)
---------------------------------------------------- */
.reaction-popover-header {
  user-select: none;
}

.btn-more-emojis:hover {
  color: #93c5fd !important;
  text-decoration: underline;
}

.reaction-grid-palette::-webkit-scrollbar {
  width: 5px;
}
.reaction-grid-palette::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* ----------------------------------------------------
   LEXICAL PLAYGROUND ENHANCEMENTS
---------------------------------------------------- */
/* Page Sizes */
.lexical-page-sheet.size-a4 {
  width: 794px;
  min-height: 1123px;
}

.lexical-page-sheet.size-letter {
  width: 816px;
  min-height: 1056px;
}

.lexical-page-sheet.size-legal {
  width: 816px;
  min-height: 1344px;
}

.lexical-page-sheet.size-a4.orientation-landscape {
  width: 1123px !important;
  min-height: 794px !important;
}

.lexical-page-sheet.size-letter.orientation-landscape {
  width: 1056px !important;
  min-height: 816px !important;
}

.lexical-page-sheet.size-legal.orientation-landscape {
  width: 1344px !important;
  min-height: 816px !important;
}

/* Margins */
.lexical-page-sheet.margins-normal {
  padding: 48px 56px !important;
}

.lexical-page-sheet.margins-narrow {
  padding: 24px 28px !important;
}

.lexical-page-sheet.margins-wide {
  padding: 72px 84px !important;
}

/* Realistic On-Screen Page Break */
.lexical-page-break {
  display: block !important;
  position: relative !important;
  margin: 2.8rem -56px !important;
  height: 28px !important;
  background: #0b0f19 !important;
  border-top: 1px solid #1e293b !important;
  border-bottom: 1px solid #1e293b !important;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6), inset 0 -3px 6px rgba(0, 0, 0, 0.6) !important;
  user-select: none !important;
  cursor: default !important;
  page-break-before: always !important;
  break-before: page !important;
}

.lexical-page-sheet.margins-narrow .lexical-page-break {
  margin: 2.2rem -28px !important;
}

.lexical-page-sheet.margins-wide .lexical-page-break {
  margin: 3.2rem -84px !important;
}

.lexical-page-break-tag {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1e293b;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 14px;
  border-radius: 999px;
  border: 1px solid #334155;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* In-Editor Lexical Emoji Popover */
.lexical-emoji-popover {
  position: absolute;
  top: 96px;
  left: 320px;
  z-index: 100;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn 0.15s ease-out;
}

.lexical-emoji-quick-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  overflow-x: auto;
}

.lex-emoji-quick {
  background: transparent;
  border: 1px solid transparent;
  font-size: 1.25rem;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
}

.lex-emoji-quick:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.15);
}

#lexical-emoji-picker {
  --num-columns: 8;
  --category-emoji-size: 1.15rem;
  height: 300px;
  width: 320px;
}

/* Raise Hand Controls & Whiteboard Grid */
#btn-dock-raise-hand.active {
  background: #f59e0b !important;
  color: #1e1b4b !important;
  border-color: #fbbf24 !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45) !important;
}

#btn-dock-raise-hand.active #dock-raise-hand-badge {
  display: inline-block !important;
}

#btn-header-raise-hand.active {
  background: #f59e0b !important;
  color: #1e1b4b !important;
  border-color: #fbbf24 !important;
}

#btn-wb-grid.active {
  background: rgba(59, 130, 246, 0.25) !important;
  border-color: #3b82f6 !important;
  color: #60a5fa !important;
}

/* Speech-to-text recording state */
.lexical-btn.recording-speech {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #f87171 !important;
  animation: speechPulse 1.2s infinite ease-in-out;
}

@keyframes speechPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* Drag Handles on Lexical Blocks */
.lexical-block-row {
  position: relative;
  transition: background 0.15s ease;
}

.lexical-block-row:hover {
  background: rgba(59, 130, 246, 0.04);
}

/* Print Stylesheet for Clean PDF Export */
@media print {
  body * {
    visibility: hidden;
  }
  .lexical-modal,
  .lexical-modal * {
    visibility: visible;
  }
  .lexical-modal {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    background: #fff !important;
    color: #000 !important;
  }
  .lexical-header,
  .lexical-toolbar,
  .lexical-footer,
  .lexical-readonly-banner,
  .lexical-emoji-popover {
    display: none !important;
  }
  .lexical-scroll-container {
    overflow: visible !important;
    padding: 0 !important;
    background: transparent !important;
  }
  .lexical-page-sheet {
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
  }
  .lexical-page-break {
    page-break-before: always !important;
    break-before: page !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    visibility: hidden !important;
    display: block !important;
  }
  .lexical-page-break-tag,
  .lexical-page-break * {
    display: none !important;
  }
}

/* ----------------------------------------------------
   AI COPILOT DRAWER STYLING
---------------------------------------------------- */
.btn-ai-prompt-pill {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-ai-prompt-pill:hover {
  background: rgba(59, 130, 246, 0.3);
  color: #fff;
  border-color: #60a5fa;
}

.chat-bubble.ai-assistant {
  background: #192036;
  border: 1px solid #2d3b66;
  border-left: 3px solid #60a5fa;
}

.ai-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-ai-share {
  background: transparent;
  border: none;
  color: #60a5fa;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.btn-ai-share:hover {
  background: rgba(96, 165, 250, 0.2);
  color: #fff;
}

/* ----------------------------------------------------
   GOOGLE TRANSLATE SUPPRESSION OF ALL INTRUSIVE POPUPS & DIALOGUES
   ---------------------------------------------------- */
.skiptranslate,
.goog-te-banner-frame,
iframe.goog-te-banner-frame,
#goog-gt-tt,
.goog-gt-tt,
[id*="goog-gt-tt"],
[class*="goog-gt-tt"],
#goog-gt-tt + *,
.goog-gt-tt + *,
#goog-gt-tt ~ *,
.goog-gt-tt ~ *,
.goog-te-balloon-frame,
.goog-te-spinner-pos,
.goog-tooltip,
.goog-tooltip:hover,
[class*="VIpgJd-"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  width: 0 !important;
  max-height: 0 !important;
  max-width: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  z-index: -9999 !important;
}

body {
  top: 0px !important;
  position: static !important;
}

.goog-text-highlight {
  background: none !important;
  box-shadow: none !important;
}

/* ----------------------------------------------------
   BOTTOM DOCK CONTROLS & "OTHER CONTROLS" DROPUP
   ---------------------------------------------------- */
.control-btn.live-pulsing {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.6) !important;
  animation: pulse-live 1.8s infinite ease-in-out;
}

@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.dock-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.dropup-action-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: transparent;
  border: none;
  color: var(--text-color, #f1f5f9);
  font-size: 0.82rem;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.dropup-action-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #60a5fa;
}

.dropup-action-item.active {
  background: rgba(59, 130, 246, 0.18);
  color: #3b82f6;
  font-weight: 600;
}

/* ----------------------------------------------------
   EMOJI PICKER ELEMENT INTEGRATION
   ---------------------------------------------------- */
.reaction-popover {
  position: fixed !important;
  z-index: 1000 !important;
  background: #111524 !important;
  border: 1px solid #242c48 !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85) !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: dropupFade 0.14s cubic-bezier(0.1, 0.9, 0.2, 1);
  will-change: transform, opacity;
}

.reaction-popover.hidden,
.reaction-popover[style*="display: none"],
.reaction-popover[style*="display:none"] {
  display: none !important;
}

emoji-picker.dark {
  --background: #111524;
  --border-color: #242c48;
  --category-emoji-size: 1.15rem;
  --emoji-size: 1.25rem;
  --indicator-color: #3b82f6;
  --input-border-color: #2e3856;
  --input-font-color: #f1f5f9;
  --input-placeholder-color: #64748b;
  --outline-color: #3b82f6;
  width: 330px;
  height: 380px;
  max-width: 90vw;
  max-height: 52vh;
}

/* ----------------------------------------------------
   MOBILE RESPONSIVENESS: TOP HEADER & BOTTOM DOCK
   ---------------------------------------------------- */
@media (max-width: 768px) {
  .app-header {
    height: 52px;
    padding: 0 0.5rem;
    gap: 0.35rem;
    overflow: hidden;
  }

  .brand {
    font-size: 0.95rem;
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .brand small {
    display: none !important;
  }

  .brand-icon {
    width: 26px;
    height: 26px;
  }

  .header-center-tools {
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 0.35rem !important;
    padding: 0 0.25rem !important;
    flex: 1 1 auto !important;
  }

  .header-center-tools::-webkit-scrollbar {
    display: none !important;
  }

  .header-center-tools > * {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .header-actions {
    flex-shrink: 0 !important;
  }

  .status-badge {
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
  }

  .control-dock {
    height: 72px;
    padding: 0 0.55rem !important;
    gap: 0.45rem !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  }

  .control-dock::-webkit-scrollbar {
    height: 3px;
  }

  .control-dock::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
  }

  .control-dock .control-group,
  .control-dock .control-btn.standalone,
  .control-dock .control-btn.main-btn,
  .control-dock .control-btn.caret-btn,
  .control-dock .control-btn.danger-action {
    flex-shrink: 0 !important;
  }

  .control-btn.standalone {
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .control-btn.standalone svg,
  .control-btn.standalone span {
    width: 20px;
    height: 20px;
  }

  .control-btn.main-btn {
    height: 44px;
    padding: 0 10px;
  }

  .control-btn.caret-btn {
    height: 44px;
    padding: 0 6px;
  }

  .control-btn.danger-action {
    width: 48px;
    height: 44px;
  }

  /* Dropups & Popovers Mobile Bottom Panel */
  .dropup-menu,
  .reaction-popover {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: 78px !important;
    top: auto !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    max-height: 68vh !important;
    z-index: 1000 !important;
    transform: none !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.92) !important;
  }

  .reaction-popover emoji-picker.dark {
    width: 100% !important;
    max-width: 100% !important;
    height: 300px !important;
    max-height: 44vh !important;
  }
}

/* ====================================================
   LIVE SPEECH TICKER & REAL-TIME MOVIE CAPTION SUBTITLES
   ==================================================== */
.live-speech-ticker {
  position: absolute;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(880px, 94vw);
  min-width: 340px;
  background: rgba(10, 14, 26, 0.90);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.72), 0 2px 8px rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  padding: 10px 16px;
  color: #f1f5f9;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  user-select: text;
}

.live-speech-ticker.hidden {
  opacity: 0;
  transform: translate(-50%, 15px) scale(0.96);
  pointer-events: none;
}

.ticker-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ticker-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ticker-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: liveDotPulse 1.2s infinite ease-in-out;
}

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

.ticker-live-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #94a3b8;
  text-transform: uppercase;
}

.ticker-captions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

/* Movie Subtitle Line */
.caption-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.45;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  animation: captionLineFadeIn 0.2s ease-out;
}

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

.caption-speaker-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(37, 99, 235, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.caption-speaker-tag.is-local {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.caption-speaker-tag.alt-speaker-1 {
  background: rgba(168, 85, 247, 0.25);
  color: #d8b4fe;
  border-color: rgba(168, 85, 247, 0.4);
}

.caption-speaker-tag.alt-speaker-2 {
  background: rgba(245, 158, 11, 0.25);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}

.caption-speaker-tag.alt-speaker-3 {
  background: rgba(236, 72, 153, 0.25);
  color: #fbcfe8;
  border-color: rgba(236, 72, 153, 0.4);
}

.caption-text-wrap {
  flex: 1;
  word-break: break-word;
}

.caption-text {
  color: #f8fafc;
}

.caption-text.interim {
  color: #cbd5e1;
}

.caption-typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  vertical-align: middle;
  background-color: #60a5fa;
  margin-left: 4px;
  animation: captionCursorBlink 0.8s infinite;
}

@keyframes captionCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.ticker-speaker-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.ticker-speaker-badge .ticker-mic-pulse {
  display: inline-block;
  font-size: 0.82rem;
  animation: micPulseAnim 1.4s infinite ease-in-out;
}

@keyframes micPulseAnim {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.22); opacity: 1; filter: drop-shadow(0 0 4px #60a5fa); }
}

.ticker-text {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  color: #f8fafc;
}

.ticker-text.interim {
  color: #cbd5e1;
}

.ticker-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ticker-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ticker-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.ticker-btn-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 3px 6px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.ticker-btn-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Live Streaming Interim Spoken Note */
.note-item.interim-note {
  border-left: 3px solid #60a5fa;
  background: rgba(59, 130, 246, 0.08);
  animation: notePulse 1.8s infinite ease-in-out;
}

@keyframes notePulse {
  0%, 100% { background: rgba(59, 130, 246, 0.06); }
  50% { background: rgba(59, 130, 246, 0.15); }
}

/* Meeting Notes & Transcript Items */
.notes-container {
  overflow: hidden;
}

.note-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.note-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.note-item.mine {
  border-left: 3px solid #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.note-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.note-item-speaker {
  font-weight: 700;
  color: #60a5fa;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.note-item-speaker.local {
  color: #34d399;
}

.note-item-time {
  font-size: 0.72rem;
  color: #64748b;
}

.note-item-text {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #f1f5f9;
  word-break: break-word;
}

/* CC Dock button active state */
#btn-dock-ticker.active {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.12);
}

#btn-dock-ticker.listening::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: pulseDot 1.4s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.3); opacity: 1; }
}
