:root {
  --bg: #0b0f17;
  --bg-elevated: #121826;
  --bg-surface: #171f31;
  --bg-hover: #1e2940;
  --glass: rgba(18, 24, 38, 0.84);
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.25);
  --text: #eef2ff;
  --text-muted: #94a3b8;
  --accent: #7c3aed;
  --accent-2: #10b981;
  --accent-soft: rgba(124, 58, 237, 0.16);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --warn: #f59e0b;
  --ok: #10b981;
  --tile-bg: #0f1523;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  --radius: 16px;
}

[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-elevated: #ffffff;
  --bg-surface: #eef2f7;
  --bg-hover: #e2e8f0;
  --glass: rgba(255, 255, 255, 0.88);
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #6366f1;
  --accent-2: #059669;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --tile-bg: #1e293b;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button, input, select {
  font-family: inherit;
}

/* ===== TOASTS ===== */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(92vw, 440px);
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: toastIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.toast-ok { border-color: rgba(16, 185, 129, 0.45); }
.toast.toast-warn { border-color: rgba(245, 158, 11, 0.45); }
.toast.toast-error { border-color: rgba(239, 68, 68, 0.5); }

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

/* ===== COMMON BUTTONS & INPUTS ===== */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}

.brand-name {
  font-size: 1.12rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

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

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(16, 185, 129, 0.14));
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}

.pill-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ghost-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.ghost-btn.full-width { width: 100%; }

.primary-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  color: #ffffff;
  font-size: 0.96rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.34);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.primary-btn.small {
  width: auto;
  padding: 9px 18px;
  font-size: 0.88rem;
}

.text-btn {
  background: none;
  border: none;
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.text-btn:hover { text-decoration: underline; }

/* ===== STATUS PILL ===== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--text-muted);
}

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

.status-pill.status-ok .status-dot {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.status-pill.status-err .status-dot {
  background: var(--danger);
}

/* ===== LOBBY VIEW ===== */
.lobby-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 450px at 10% -10%, rgba(124, 58, 237, 0.16), transparent 60%),
    radial-gradient(800px 450px at 95% 105%, rgba(16, 185, 129, 0.12), transparent 60%),
    var(--bg);
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(12px);
}

.lobby-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lobby-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px 40px;
}

.lobby-grid {
  width: 100%;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 24px;
  align-items: start;
}

.preview-card, .join-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  background: #0c1220;
  border: 1px solid var(--border);
}

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

.preview-avatar {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(145deg, #101727, #0b0f17);
  color: #e2e8f0;
}

.avatar-circle {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  font-weight: 750;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  text-transform: uppercase;
}

.preview-status-msg {
  font-size: 0.85rem;
  color: #94a3b8;
  text-align: center;
  padding: 0 16px;
}

.preview-top-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
}

.mini-badge {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 550;
  backdrop-filter: blur(8px);
}

.preview-bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mic-meter {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.mic-bar {
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent-2);
  transition: height 0.08s ease;
}

.preview-controls {
  display: flex;
  gap: 10px;
}

.round-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.15s, transform 0.1s;
}

.round-btn:hover { transform: scale(1.06); }
.round-btn .icon-off { display: none; }
.round-btn.off {
  background: var(--danger);
  border-color: var(--danger);
}
.round-btn.off .icon-on { display: none; }
.round-btn.off .icon-off { display: block; }

.device-selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.device-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.device-field select, .field-group select, .field-group input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.device-field select:focus, .field-group select:focus, .field-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Join card */
.join-hero h1 {
  margin: 0 0 8px;
  font-size: 1.65rem;
  letter-spacing: -0.025em;
}

.join-hero p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label, .field-group > span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

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

.room-input-wrap {
  display: flex;
  align-items: center;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.room-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.room-prefix {
  padding: 10px 0 10px 12px;
  color: var(--text-muted);
  font-size: 0.86rem;
  user-select: none;
}

.room-input-wrap input {
  border: none;
  background: transparent;
  padding-left: 4px;
  box-shadow: none !important;
}

.room-info-banner {
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 550;
  background: var(--accent-soft);
  border: 1px solid rgba(124, 58, 237, 0.3);
  color: var(--text);
}

.room-info-banner.locked {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.35);
}

.form-error {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.85rem;
  font-weight: 550;
}

[data-theme="light"] .form-error { color: #b91c1c; }

.recent-rooms {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.recent-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.recent-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.recent-chip:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.lobby-features {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ===== CALL VIEW ===== */
.call-view {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.call-topbar {
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  z-index: 20;
}

.call-topbar-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.mini-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
}

.room-meta {
  min-width: 0;
}

.room-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.call-room-name {
  font-weight: 700;
  font-size: 0.96rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.call-timer {
  font-variant-numeric: tabular-nums;
}

.call-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.call-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Stage & Video Grid */
.stage-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.stage-area.spotlight-mode {
  flex-direction: column;
}

.video-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 10px;
  align-content: center;
  justify-content: center;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}

.video-grid[data-count="1"] {
  grid-template-columns: minmax(0, 960px);
}

.video-grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.video-grid[data-count="3"],
.video-grid[data-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.video-grid[data-count="5"],
.video-grid[data-count="6"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.video-grid.spotlight-main {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

.filmstrip {
  height: 132px;
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filmstrip .video-tile {
  width: 205px;
  min-width: 170px;
  height: 100%;
  flex-shrink: 0;
}

/* Video tile */
.video-tile {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 120px;
  background: var(--tile-bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-tile.speaking {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25), 0 0 24px rgba(16, 185, 129, 0.22);
}

.video-tile.pinned {
  border-color: var(--accent);
}

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

.video-tile.mirrored video {
  transform: scaleX(-1);
}

.video-tile.screen-share video {
  object-fit: contain;
  background: #05080f;
  transform: none !important;
}

.tile-avatar {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(circle at 30% 20%, rgba(124, 58, 237, 0.18), transparent 60%), #101726;
}

.tile-avatar .avatar-circle {
  width: 72px;
  height: 72px;
  font-size: 1.65rem;
}

.filmstrip .tile-avatar .avatar-circle {
  width: 44px;
  height: 44px;
  font-size: 1.05rem;
}

.tile-top-left {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  z-index: 4;
}

.tile-top-right {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 4;
}

.video-tile:hover .tile-top-right,
.video-tile.pinned .tile-top-right {
  opacity: 1;
}

.tile-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.tile-action-btn:hover { background: var(--accent); border-color: var(--accent); }

.tile-hand-badge {
  background: rgba(245, 158, 11, 0.92);
  color: #111827;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  animation: handPulse 1.6s infinite;
}

@keyframes handPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.tile-screen-badge {
  background: rgba(124, 58, 237, 0.9);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 650;
}

.tile-bottom {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 4;
}

.tile-name-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 78%;
  padding: 5px 10px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.tile-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-muted-icon {
  color: #f87171;
  display: inline-flex;
  flex-shrink: 0;
}

.tile-conn-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  background: rgba(15, 23, 42, 0.7);
  color: #cbd5e1;
  backdrop-filter: blur(6px);
}

.tile-conn-badge.ok { color: #6ee7b7; }
.tile-conn-badge.warn { color: #fcd34d; }

/* Reactions floating overlay */
.reactions-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 15;
}

.floating-reaction {
  position: absolute;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  animation: floatUp 2.6s ease-out forwards;
}

.floating-reaction .emoji {
  font-size: 2.3rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

.floating-reaction .who {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(15px) scale(0.7); }
  15% { opacity: 1; transform: translateY(-20px) scale(1.1); }
  80% { opacity: 1; transform: translateY(-190px) scale(1); }
  100% { opacity: 0; transform: translateY(-240px) scale(0.92); }
}

/* Side Panel (Chat + Participants) */
.side-panel {
  width: 340px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  z-index: 25;
}

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

.side-tabs {
  display: flex;
  gap: 6px;
}

.side-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.side-tab.active {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-count {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.side-tab-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-empty {
  color: var(--text-muted);
  font-size: 0.84rem;
  text-align: center;
  margin-top: 24px;
  line-height: 1.5;
}

.chat-msg {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 12px;
  max-width: 92%;
  align-self: flex-start;
}

.chat-msg.mine {
  align-self: flex-end;
  background: var(--accent-soft);
  border-color: rgba(124, 58, 237, 0.3);
}

.chat-msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 0.74rem;
}

.chat-msg-author { font-weight: 700; }
.chat-msg-time { color: var(--text-muted); }

.chat-msg-text {
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-text a {
  color: var(--accent-2);
  text-decoration: underline;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
}

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

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.send-btn:hover { filter: brightness(1.1); }

/* Participants list */
.host-tools-bar {
  padding: 12px 14px 4px;
}

.participants-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.participant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.participant-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.participant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.86rem;
  flex-shrink: 0;
}

.participant-name-wrap {
  min-width: 0;
}

.participant-name {
  font-size: 0.87rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.participant-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

.mini-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.78rem;
}

.mini-icon-btn:hover { border-color: var(--accent); }
.mini-icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* Bottom Floating Dock */
.call-dock-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 25;
}

.reactions-popover {
  position: absolute;
  bottom: calc(100% + 4px);
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: toastIn 0.15s ease;
}

.react-emoji-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}

.react-emoji-btn:hover {
  transform: scale(1.22);
  background: var(--bg-hover);
}

.call-dock {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  max-width: 100%;
  overflow-x: auto;
}

.dock-sep {
  width: 1px;
  height: 30px;
  background: var(--border-strong);
  margin: 0 3px;
  flex-shrink: 0;
}

.dock-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 58px;
  height: 52px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.dock-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.dock-btn .icon-off { display: none; }

.dock-btn.off {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
}

[data-theme="light"] .dock-btn.off { color: #dc2626; }
.dock-btn.off .icon-on { display: none; }
.dock-btn.off .icon-off { display: block; }

.dock-btn.toggled {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.dock-btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  min-width: 72px;
}

.dock-btn.danger:hover {
  filter: brightness(1.1);
}

.dock-label {
  font-size: 0.67rem;
  font-weight: 600;
}

.dock-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.67rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

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

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(92vw, 350px);
    box-shadow: var(--shadow);
  }

  .video-grid[data-count="2"] {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .hide-xs { display: none !important; }
  .device-selectors { grid-template-columns: 1fr; }
  .lobby-header { padding: 12px 14px; }
  .lobby-main { padding: 16px 12px 28px; }
  .dock-btn { min-width: 48px; height: 48px; padding: 0 7px; }
  .dock-label { font-size: 0.62rem; }
  .filmstrip { height: 100px; }
  .filmstrip .video-tile { width: 145px; min-width: 135px; }
}