/* ═══════════════════════════ Design tokens ══════════════════════════════ */
:root {
  --chat-font-size:   0.84rem;
  --chat-font-family: 'Manrope', sans-serif;
  --chat-scroll:      smooth;
  --bg:             #0f1012;
  --surface:        #17181c;
  --surface-hover:  #1e2025;
  --border:         #272a30;
  --accent:         #50c878;
  --accent-hover:   #3db362;
  --danger:         #f04040;
  --danger-hover:   #c83232;
  --success:        #50c878;
  --success-hover:  #3db362;
  --warning:        #f0b132;
  --text:           #ecedef;
  --text-secondary: #8b9198;
  --text-muted:     #484c55;
  --radius:         10px;
}

/* ═══════════════════════════ Light mode ═════════════════════════════════ */
body.light {
  --bg:             #f0f2f5;
  --surface:        #ffffff;
  --surface-hover:  #e8eaed;
  --border:         #d1d5db;
  --text:           #111318;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  background-image: radial-gradient(circle, rgba(0,0,0,0.06) 1px, transparent 1px) !important;
}
body.light .header-wrap         { box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,0.06); }
body.light .chat-sidebar        { box-shadow: -2px 0 12px rgba(0,0,0,0.08); }
body.light .overlay-box         { box-shadow: 0 8px 40px rgba(0,0,0,0.15); }
body.light .toast               { box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
body.light .whisper-autocomplete { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
body.light .poll-card           { background: #f8f9fb; }
body.light .poll-option         { background: var(--surface); }

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

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  background-image: radial-gradient(circle, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.4;
}

/* ════════════════════════════ Screens ═══════════════════════════════════ */
.screen { display: none; height: 100vh; flex-direction: column; position: relative; }
.screen.active { display: flex; }

/* ════════════════════════════════ Inputs ════════════════════════════════ */
input[type="text"] {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(80,200,120,0.15);
}
input[type="text"].shake { animation: shake 0.35s ease; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-7px); }
  75%      { transform: translateX(7px); }
}

/* ════════════════════════════ Buttons ═══════════════════════════════════ */
.btn {
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.14s, opacity 0.14s, box-shadow 0.14s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #0f1012; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 0 0 3px rgba(80,200,120,0.22); }

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

.btn-active  { background: var(--accent); color: #0f1012; }
.btn-active:hover:not(:disabled)  { background: var(--accent-hover); }

.btn-success { background: var(--success); color: #0f1012; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }

.btn-control {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-control:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-control.muted { background: var(--warning); color: #0f1012; border-color: var(--warning); }

.btn-outline-light {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-outline-light:hover:not(:disabled) { background: rgba(255,255,255,0.08); }

.btn-sm { padding: 5px 13px; font-size: 0.8rem; }

/* Equal-sized icon control buttons in the call header */
.btn-icon-ctrl {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.btn-icon-ctrl svg { width: 18px; height: 18px; }
.btn-icon-ctrl:hover { background: var(--surface-hover); color: var(--text); }
.btn-icon-ctrl.active {
  background: rgba(80,200,120,0.15);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-icon-ctrl.muted,
.btn-icon-ctrl.danger {
  background: rgba(240,64,64,0.15);
  border-color: var(--danger);
  color: var(--danger);
}

/* ════════════════════════════ Login screen ═══════════════════════════════ */
#screen-login {
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(80,200,120,0.07), 0 24px 48px rgba(0,0,0,0.5);
}

.logo {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent);
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.logo-sub {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  margin-bottom: 24px;
}

.input-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Avatar picker on login */
.avatar-pick-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}
.avatar-pick-preview {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; color: #fff;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.avatar-pick-preview:hover { border-color: var(--accent); }
.avatar-pick-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-pick-label {
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: background 0.12s;
}
.avatar-pick-label:hover { background: var(--surface-hover); }

/* ════════════════════════════ App header ════════════════════════════════ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03);
}
.header-logo { font-weight: 800; color: var(--accent); font-size: 1.08rem; letter-spacing: 0.02em; display: flex; align-items: baseline; gap: 5px; }
.header-logo-sub { font-size: 0.55rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header-user { font-size: 0.8rem; color: var(--text-muted); }
.header-user strong { color: var(--text-secondary); font-weight: 600; }

/* ════════════════════════════ Lobby layout ═══════════════════════════════ */
.lobby-layout {
  display: flex;
  flex: 1;
  overflow: visible;
  min-height: 0;
}

.panel {
  flex: 0 0 auto;
  padding: 20px 18px;
  overflow-y: auto;
  min-width: 160px;
}

.col-resizer {
  flex: 0 0 4px;
  background: var(--border);
  cursor: col-resize;
  position: relative;
  transition: background 0.15s;
  z-index: 5;
}
/* Widen the grab target without affecting layout */
.col-resizer::after {
  content: '';
  position: absolute;
  inset: 0 -4px;
}
.col-resizer:hover,
.col-resizer.resizing { background: var(--accent); }

.panel-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 0 4px;
}

/* ══════════════════════════════ Lists ═══════════════════════════════════ */
.list { list-style: none; }

.empty-state {
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 10px 4px;
}

/* User items */
.user-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: background 0.1s;
}
.user-item:hover { background: var(--surface-hover); }
.user-item.in-call { opacity: 0.55; }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2a3540;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--accent);
  user-select: none;
}

.user-name { flex: 1; font-size: 0.875rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  flex-shrink: 0;
}
.badge-call { background: var(--danger); color: #fff; opacity: 0.85; }

/* Room items */
.room-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: background 0.1s;
}
.room-item:hover { background: var(--surface-hover); }

.room-info { flex: 1; min-width: 0; }
.room-participants {
  display: block;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-count { font-size: 0.72rem; color: var(--text-muted); }

/* ════════════════ Pending outgoing call banner ═══════════════════════════ */
.pending-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--accent);
  font-size: 0.875rem;
  flex-shrink: 0;
}
.pending-banner strong { font-weight: 600; }

/* ════════════════════════ Screen share panel ════════════════════════════ */
.screen-share-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #000;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 120px;
  max-height: 62vh;
  overflow: hidden;
}

/* Hover overlay — fades in when the panel is hovered */
.share-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
}
.screen-share-panel:hover .share-overlay,
.screen-share-panel.watch-mode .share-overlay { opacity: 1; pointer-events: auto; }

/* In Watch Together mode the video element is hidden, so give the panel its own height */
.screen-share-panel.watch-mode {
  aspect-ratio: 16 / 9;
}

.share-overlay-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
  gap: 10px;
}
.share-overlay-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
}

.share-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.share-controls { display: flex; align-items: center; gap: 8px; }

/* Icon buttons in the overlay */
.share-ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.share-ctrl-btn svg { width: 18px; height: 18px; }
.share-ctrl-btn:hover { background: rgba(255,255,255,0.3); }
.share-ctrl-btn.muted  { background: var(--danger); }
.share-ctrl-btn.muted:hover { background: var(--danger-hover); }

.share-vol-wrap { display: flex; align-items: center; flex: 1; max-width: 110px; }
.share-vol-slider { width: 100%; accent-color: #fff; cursor: pointer; }

.screen-share-video {
  width: 100%;
  flex: 1;
  object-fit: contain;
  display: block;
  min-height: 0;
  cursor: pointer;
  /* Prevent any inherited or compositor-applied color transforms */
  filter: none !important;
  -webkit-filter: none !important;
  color-scheme: normal;
  mix-blend-mode: normal;
  /* Force GPU layer that bypasses HDR/wide-gamut tone mapping */
  transform: translateZ(0);
  will-change: contents;
  image-rendering: high-quality;
}

/* Drag-to-resize handle at the bottom of the panel */
.share-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  z-index: 20;
  background: transparent;
  transition: background 0.15s;
}
.share-resize-handle:hover,
.share-resize-handle.dragging { background: var(--accent); }

/* ════════════════════════════ Call screen ═══════════════════════════════ */
.call-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03);
}
.call-type-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}
.call-controls { display: flex; gap: 8px; align-items: center; }

/* Mic device picker */
.mic-picker { position: relative; }

.mic-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 240px;
  z-index: 50;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.mic-dropdown-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 14px 6px;
  white-space: nowrap;
}

.mic-dropdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
}
.mic-dropdown-row .mic-dropdown-label {
  padding: 0;
  min-width: 72px;
  flex-shrink: 0;
}

.mic-dev-select {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
}
.mic-dev-select:focus { border-color: var(--accent); }

.mic-device-item {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mic-device-item:hover  { background: var(--surface-hover); color: var(--text); }
.mic-device-item.active { color: var(--accent); font-weight: 500; }

.mic-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

.mic-unsupported {
  padding: 8px 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.mic-processing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 4px;
  padding: 4px 14px 10px;
}
.mic-proc-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s;
}
.mic-proc-toggle:hover { background: var(--hover); }
.mic-proc-toggle input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

.noise-gate-row { padding: 10px 14px 14px; }

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

.noise-gate-val { font-size: 0.75rem; color: var(--accent); font-weight: 600; }

.noise-gate-slider {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  display: block;
}

.noise-gate-meter-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 7px;
  overflow: hidden;
}
.noise-gate-meter {
  height: 100%;
  width: 0;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.05s linear;
}
.noise-gate-meter.gated { background: var(--danger); }

/* ════════════════════════════ Fun panel ════════════════════════════════ */

.btn-fun-circle {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 30;
}
.btn-fun-circle:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 18px rgba(0,0,0,0.45);
}

.fun-panel {
  position: absolute;
  bottom: 86px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
  z-index: 30;
}

.fun-panel-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.fun-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.fun-filter-btn {
  padding: 6px 4px;
  font-size: 0.78rem;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  text-align: center;
}
.fun-filter-btn:hover { background: var(--surface-hover); color: var(--text); }
.fun-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.fun-panel-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

.fun-action-btn {
  width: 100%;
  padding: 8px;
  font-size: 0.82rem;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s;
}
.fun-action-btn:hover { background: var(--surface-hover); }

/* ════════════════════════════ Chat sidebar ══════════════════════════════ */
.chat-sidebar {
  position: fixed;
  right: 0;
  top: 52px;
  bottom: 0;
  width: 300px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow: visible;
  z-index: 40;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  transform: translateX(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Override global .hidden so animation works (display:none breaks transitions) */
.chat-sidebar.hidden {
  display: flex !important;
  transform: translateX(110%);
  pointer-events: none;
  visibility: hidden;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  font-size: var(--chat-font-size);
  font-family: var(--chat-font-family);
  scroll-behavior: var(--chat-scroll);
}

.chat-msg {
  font-size: 0.8rem;
  line-height: 1.4;
  word-break: break-word;
}
.chat-msg-name {
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 5px;
}
.chat-msg-name.is-self { color: var(--accent); }
.chat-msg-text { color: var(--text); }
.chat-msg-time { font-size: 0.68rem; color: var(--text-muted); margin-left: 5px; }

.chat-msg.whisper { background: rgba(88,101,242,0.1); border-left: 2px solid var(--accent); padding: 4px 8px; border-radius: 0 4px 4px 0; }
.chat-msg.whisper .chat-msg-tag { font-size: 0.68rem; color: var(--accent); font-weight: 600; margin-right: 4px; }
.chat-msg.bot-msg { background: rgba(124,58,237,0.08); border-left: 2px solid #7c3aed; padding: 4px 8px; border-radius: 0 4px 4px 0; }
.chat-msg.mention-highlight { background: rgba(255,214,10,0.1); border-left: 2px solid #ffd60a; padding: 4px 8px; border-radius: 0 4px 4px 0; }
.system-error-msg { font-size: 0.78rem; color: var(--text-muted); font-style: italic; padding: 2px 4px; }
.reminder-fire-msg { font-size: 0.85rem; color: #f59e0b; font-weight: 600; padding: 5px 8px; background: rgba(245,158,11,0.1); border-left: 2px solid #f59e0b; border-radius: 0 4px 4px 0; }

/* ── Poll card ── */
.poll-msg { padding: 0 !important; background: none !important; border: none !important; }
.poll-card { background: var(--surface-2, #1e1e2e); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 2px 0; }
.poll-header { font-size: 0.88rem; margin-bottom: 10px; }
.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-option {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; cursor: pointer;
  text-align: left; font-size: 0.82rem; color: var(--text-primary);
  transition: border-color 0.15s, background 0.15s;
}
.poll-option:hover { border-color: var(--accent); background: rgba(88,101,242,0.06); }
.poll-option.poll-opt-active { border-color: var(--accent); background: rgba(88,101,242,0.12); }
.poll-opt-label { flex: 0 0 auto; min-width: 60px; }
.poll-opt-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.poll-opt-bar { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
.poll-opt-count { flex: 0 0 auto; font-size: 0.75rem; color: var(--text-muted); min-width: 56px; text-align: right; }
.poll-footer { font-size: 0.72rem; color: var(--text-muted); margin-top: 8px; }

.chat-input-wrap {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  line-height: 1;
}

/* Whisper autocomplete */
.whisper-autocomplete {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 10px;
  right: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 20;
  max-height: 180px;
  overflow-y: auto;
}
.whisper-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.whisper-option:hover,
.whisper-option.active { background: var(--surface-hover); color: var(--text); }
.whisper-option .wo-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); display: flex; align-items: center;
  justify-content: center; font-size: 0.62rem; font-weight: 700;
  color: #fff; flex-shrink: 0; overflow: hidden;
}
.whisper-option .wo-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cmd-slash { font-family: monospace; font-weight: 700; color: var(--accent); margin-right: 2px; }
.cmd-hint  { font-size: 0.72rem; color: var(--text-muted); }

/* btn-icon (× close buttons) */
.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  transition: background 0.1s, color 0.1s;
}
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }

/* ═══════════════════════════ Settings modal ═════════════════════════════ */
.profile-card { max-width: 360px; }

.settings-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 18px;
}
.settings-tab {
  flex: 1;
  padding: 7px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.settings-tab:hover { color: var(--text-secondary); }
.settings-tab.active { background: var(--surface-hover); color: var(--text); }

.settings-panel { overflow-y: auto; max-height: 62vh; padding-right: 12px; }

.chat-size-options {
  display: flex;
  gap: 6px;
}
.chat-size-btn {
  flex: 1;
  padding: 7px 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: 'Manrope', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.chat-size-btn:hover { background: var(--surface-hover); color: var(--text); }
.chat-size-btn.active { background: rgba(80,200,120,0.12); border-color: var(--accent); color: var(--accent); }

.settings-toggles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.settings-toggle-row:last-child { border-bottom: none; }
.settings-toggle-row:hover { background: var(--surface-hover); }
.settings-toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.profile-avatar-wrap {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; color: #fff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.profile-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 600; color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
}
.profile-avatar-wrap:hover .profile-avatar-overlay { opacity: 1; }

.profile-fields { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; text-align: left; }
.profile-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* ═══════════════════════════ User avatars in lists ══════════════════════ */
.user-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.user-pronouns {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.1;
}
.participant-pronouns {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ═══════════════════════════ DM panel (lobby) ═══════════════════════════ */
.dm-panel {
  position: fixed;
  right: 0; top: 52px; bottom: 0;
  width: 300px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  transform: translateX(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.dm-panel.hidden {
  display: flex !important;
  transform: translateX(110%);
  pointer-events: none;
  visibility: hidden;
}
.dm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 600;
  flex-shrink: 0;
}
.dm-thread-list { flex: 1; overflow-y: auto; }
.dm-thread-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.dm-thread-item:hover { background: var(--surface-hover); }
.dm-thread-item .dm-thread-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden;
}
.dm-thread-item .dm-thread-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dm-thread-info { flex: 1; min-width: 0; }
.dm-thread-name { font-size: 0.85rem; font-weight: 600; }
.dm-thread-preview { font-size: 0.75rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-thread-unread { background: var(--danger); color: #fff; border-radius: 8px; font-size: 0.65rem; font-weight: 700; padding: 1px 5px; }

.dm-compose { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.dm-compose-header { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 0.82rem; font-weight: 600; border-bottom: 1px solid var(--border); color: var(--text-secondary); flex-shrink: 0; }
.dm-messages { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-height: 0; font-size: var(--chat-font-size); font-family: var(--chat-font-family); scroll-behavior: var(--chat-scroll); }
.dm-empty { padding: 20px 14px; color: var(--text-muted); font-size: 0.8rem; text-align: center; line-height: 1.6; }

/* ═══════════════════════════ Global chat panel ══════════════════════════ */
.global-chat-panel {
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding: 0 !important;
  /* override .panel overflow so dropdown can escape upward */
  overflow-y: visible;
}
.global-chat-panel .panel-title {
  padding: 20px 18px 10px;
  flex-shrink: 0;
}
.global-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  font-size: var(--chat-font-size);
  font-family: var(--chat-font-family);
  scroll-behavior: var(--chat-scroll);
}
.global-chat-panel .typing-indicator {
  padding: 0 14px 2px;
  flex-shrink: 0;
}
.global-chat-panel .chat-input-wrap {
  padding: 10px 14px 14px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════ btn-control.active (muted) ════════════════════ */
.btn-control.muted { background: var(--warning); color: #000; border-color: var(--warning); }

.call-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  min-width: 0;
}

.participants-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  max-width: 900px;
}

.participant-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 160px;
  text-align: center;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.participant-card.is-self {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.participant-card.speaking {
  border-color: var(--success);
  box-shadow: 0 0 0 2px var(--success), 0 0 16px rgba(35, 165, 90, 0.35);
  transition: border-color 0.1s, box-shadow 0.1s;
}

.participant-card.muted {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px var(--danger), 0 0 16px rgba(237, 66, 69, 0.3) !important;
}

.participant-avatar {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0;
  background: #141720;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-blur-bg { display: none; }
.is-self .participant-avatar { background: #131d18; }

.participant-avatar-img {
  position: relative;
  z-index: 1;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.participant-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  background: #000;
  z-index: 2;
}
/* Mirror own camera so it looks natural */
.participant-card.is-self .participant-video { transform: scaleX(-1); }

.participant-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 12px 0;
}

.participant-name {
  font-size: 0.82rem;
  color: var(--text-secondary);
  word-break: break-word;
  line-height: 1.3;
}

.participant-status-bar {
  width: 56px;
  height: 4px;
  border-radius: 3px 3px 0 0;
  background: var(--text-muted);
  transition: background 0.3s;
  margin-top: 6px;
}
.participant-status-bar.connected    { background: var(--success); }
.participant-status-bar.connecting   { background: var(--warning); }
.participant-status-bar.disconnected { background: var(--danger); }
.participant-status-bar.failed       { background: var(--danger); }

/* ════════════════════════════ Overlays ══════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}

@keyframes ring-glow {
  0%   { box-shadow: 0 0 0 0 rgba(88,101,242,0.6), 0 8px 32px rgba(0,0,0,0.4); }
  60%  { box-shadow: 0 0 0 14px rgba(88,101,242,0), 0 8px 32px rgba(0,0,0,0.4); }
  100% { box-shadow: 0 0 0 0 rgba(88,101,242,0), 0 8px 32px rgba(0,0,0,0.4); }
}
@keyframes ring-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-5px) rotate(-1deg); }
  40%     { transform: translateX(5px) rotate(1deg); }
  60%     { transform: translateX(-3px); }
  80%     { transform: translateX(3px); }
}
.overlay-card.ringing {
  animation: ring-glow 1.4s ease-out infinite, ring-shake 0.5s ease 0.1s 2;
}

.overlay-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.overlay-caller {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.overlay-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.overlay-actions { display: flex; gap: 12px; justify-content: center; }

/* Call type picker */
.call-type-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 0;
}

.call-type-option {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s;
  color: var(--text);
  width: 100%;
}
.call-type-option:hover { background: var(--surface-hover); border-color: var(--accent); }

.option-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 3px; }
.option-desc  { font-size: 0.75rem;  color: var(--text-muted); }

/* ════════════════════════════ Toast ═════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 0.85rem;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 200;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show            { transform: translateX(-50%) translateY(0); }
.toast.error           { border-color: var(--danger);  color: #fca5a5; }
.toast.warning         { border-color: var(--warning); color: var(--warning); }

#app-version {
  position: fixed;
  bottom: 8px;
  left: 10px;
  font-size: 0.65rem;
  color: var(--text-muted, #6b7280);
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
  z-index: 10;
  letter-spacing: 0.03em;
}

/* ═══════════════════════════ Phone number (profile) ════════════════════ */
.profile-phone-number {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.3rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  padding: 9px 14px;
  background: #0f1012;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
  user-select: all;
  cursor: text;
}
.profile-phone-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin: 4px 0 6px;
}

/* ═══════════════════════════ Phone dialer overlay ══════════════════════ */
.phone-dialer-card {
  width: 310px;
  padding: 20px 22px 22px;
}
.phone-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f1012;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.phone-display-text {
  flex: 1;
  font-size: 1.35rem;
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.18em;
  color: var(--text);
  text-align: center;
}
.btn-dial-bs {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.btn-dial-bs:hover { color: var(--text); }
.phone-dial-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.phone-dial-svg {
  width: 220px;
  height: 220px;
  user-select: none;
  -webkit-user-select: none;
}
.dial-hole {
  cursor: grab;
  transition: fill 0.12s;
}
.dial-hole:hover { fill: #1e2535 !important; stroke: var(--accent) !important; }
.dial-hole:active { cursor: grabbing; }
.dial-num {
  font-size: 11px;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  fill: #bfc3d0;
  pointer-events: none;
  user-select: none;
}
#phone-dial-ring {
  transform-origin: 110px 110px;
  transform-box: view-box;
}
.phone-dialer-status {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  min-height: 1.2em;
}
.phone-dialer-status.error { color: var(--danger); }

/* ═══════════════════════════ Phone incoming call (corner) ══════════════ */
.phone-incoming-corner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 70;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px 12px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.45);
  min-width: 220px;
}
.phone-corner-icon {
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  animation: phone-corner-shake 0.22s ease-in-out infinite;
}
.phone-corner-icon:hover { filter: brightness(1.2); }
@keyframes phone-corner-shake {
  0%   { transform: rotate(0deg) translateY(0); }
  20%  { transform: rotate(-14deg) translateY(-2px); }
  40%  { transform: rotate(14deg) translateY(-2px); }
  60%  { transform: rotate(-10deg) translateY(-1px); }
  80%  { transform: rotate(10deg) translateY(-1px); }
  100% { transform: rotate(0deg) translateY(0); }
}
.phone-corner-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.phone-corner-caller {
  font-size: 0.88rem;
  font-weight: 700;
}
.phone-corner-number {
  font-size: 0.76rem;
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.phone-corner-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.phone-corner-decline {
  flex-shrink: 0;
  align-self: center;
}

/* ═══════════════════════════ Active phone call widget ══════════════════ */
.phone-call-widget {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  z-index: 60;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}
.phone-handset-lifted {
  font-size: 1.5rem;
  display: inline-block;
  transform: rotate(135deg);
  filter: drop-shadow(0 0 6px rgba(80,200,120,0.5));
}
.phone-call-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.phone-call-with {
  font-size: 0.88rem;
  font-weight: 600;
}
.phone-call-timer {
  font-size: 0.75rem;
  color: var(--accent);
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════ Watch Together (in-panel) ═════════════════ */
.watch-url-input {
  flex: 1;
  min-width: 0;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 0.78rem;
  padding: 5px 9px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.watch-url-input:focus { border-color: var(--accent); }
.watch-time {
  font-size: 0.7rem;
  font-family: 'Courier New', Courier, monospace;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  flex-shrink: 0;
}
.watch-sync-label {
  font-size: 0.7rem;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}
#yt-player {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#yt-player iframe {
  /* Maintain 16:9, letterboxed inside whatever space the panel gives */
  aspect-ratio: 16 / 9;
  width: 100%;
  height: auto;
  max-height: 100%;
  border: none;
}

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

/* Scrollbar */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ══════════════════════════ Toggle switch ═══════════════════════════════ */
.toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.82rem; color: var(--text-secondary); user-select: none; }
.toggle-label input[type="checkbox"] { display: none; }
.toggle-track { width: 36px; height: 20px; background: var(--border); border-radius: 10px; position: relative; transition: background 0.2s; flex-shrink: 0; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.toggle-label input:checked ~ .toggle-track { background: var(--accent); }
.toggle-label input:checked ~ .toggle-track .toggle-thumb { transform: translateX(16px); }

/* ════════════════════════ Profile PTT row ═══════════════════════════════ */
.profile-ptt-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ptt-key-btn { min-width: 72px; font-family: monospace; letter-spacing: 0.04em; }
.ptt-key-btn.listening { border-color: var(--accent); color: var(--accent); animation: pulse-border 0.8s ease infinite; }
@keyframes pulse-border { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ════════════════════ PTT indicator in call header ══════════════════════ */
.ptt-indicator {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 4px;
  background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border);
  transition: background 0.1s, color 0.1s, box-shadow 0.1s;
}
.ptt-indicator.active {
  background: var(--success); color: #fff; border-color: var(--success);
  box-shadow: 0 0 8px rgba(35,165,90,0.5);
}

/* ════════════════════════ Typing indicator ══════════════════════════════ */
.typing-indicator {
  min-height: 18px;
  padding: 0 12px 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  flex-shrink: 0;
}

/* ═══════════════════ Profile color and gain fields ══════════════════════ */
.profile-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
input[type="color"] {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
  background: var(--bg);
}
.profile-color-preview {
  font-size: 0.875rem;
  font-weight: 600;
}
.profile-select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.82rem;
  cursor: pointer;
  appearance: auto;
}
.profile-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.profile-select:disabled { opacity: 0.45; cursor: default; }

.profile-gain-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-gain-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.profile-gain-val {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  min-width: 36px;
  text-align: right;
}
.profile-mic-test-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
  margin-bottom: 2px;
}
.profile-mic-bar {
  height: 100%;
  width: 0;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.05s linear;
}

/* ═══════════════════════════ Link Previews ══════════════════════════════ */
.chat-link { color: var(--accent); text-decoration: underline; word-break: break-all; }
.chat-link:hover { opacity: 0.8; }

.link-preview {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 6px; padding: 8px 10px; border-radius: 8px;
  background: var(--surface2, #2a2d36); border: 1px solid var(--border);
  text-decoration: none; color: inherit; cursor: pointer;
  max-width: 380px; overflow: hidden; transition: background 0.15s;
}
.link-preview:hover { background: var(--surface3, #33374a); }
.link-preview-img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.link-preview-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.link-preview-domain { font-size: 0.68rem; color: var(--text-muted, #6b7280); text-transform: uppercase; letter-spacing: 0.04em; }
.link-preview-title { font-size: 0.8rem; font-weight: 600; color: var(--text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-preview-desc { font-size: 0.73rem; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ═══════════════════════════ File Sharing ═══════════════════════════════ */
.btn-chat-attach {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0;
  color: var(--text-muted, #6b7280); cursor: pointer; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.btn-chat-attach:hover { color: var(--text); background: var(--surface2, #2a2d36); }

.file-share-card {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 4px; padding: 7px 10px; border-radius: 8px;
  background: var(--surface2, #2a2d36); border: 1px solid var(--border);
  text-decoration: none; color: inherit; cursor: pointer;
  max-width: 280px; transition: background 0.15s;
}
.file-share-card:hover { background: var(--surface3, #33374a); }
.file-share-icon { font-size: 1.4rem; flex-shrink: 0; }
.file-share-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.file-share-name { font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.file-share-size { font-size: 0.7rem; color: var(--text-muted, #6b7280); }
.file-share-dl { margin-left: auto; font-size: 1rem; color: var(--accent); flex-shrink: 0; }

/* File message header row — name then time inline, image below */
.chat-msg-meta { display: block; margin-bottom: 5px; }
.chat-msg-media-body { display: block; }

/* ═══════════════════════ Media Content Cards ════════════════════════════ */
.media-card {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 6px;
  max-width: 340px;
  width: 340px;
  display: block;
}
/* Image card */
.mcard-img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.mcard-img:hover { opacity: 0.88; }
/* Video card */
.mcard-video-el {
  display: block;
  width: 100%;
  max-height: 220px;
  background: #000;
}
/* Card footer */
.mcard-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.mcard-footer-icon { color: var(--text-muted); flex-shrink: 0; display: flex; align-items: center; }
.mcard-footer-info { flex: 1; min-width: 0; }
.mcard-footer-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.mcard-footer-size { font-size: 0.69rem; color: var(--text-muted); }
.mcard-dl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.mcard-dl-btn:hover { background: var(--accent); color: #0f1012; }

/* Audio player card */
.media-card.media-card-audio { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.mcard-audio-header { display: flex; align-items: center; gap: 10px; }
.mcard-audio-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(80,200,120,0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.mcard-audio-info { flex: 1; min-width: 0; }
.mcard-audio-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.mcard-audio-size { font-size: 0.69rem; color: var(--text-muted); }
.mcard-controls { display: flex; align-items: center; gap: 10px; }
.mcard-play {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #0f1012;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: filter 0.15s, transform 0.1s;
}
.mcard-play:hover { filter: brightness(1.15); transform: scale(1.06); }
.mcard-play:active { transform: scale(0.94); }
.mcard-prog-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.mcard-prog-track {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}
.mcard-prog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  position: relative;
  transition: width 0.08s linear;
}
.mcard-prog-fill::after {
  content: '';
  position: absolute;
  right: -5px; top: 50%;
  transform: translateY(-50%);
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  transition: opacity 0.12s;
  pointer-events: none;
}
.mcard-prog-wrap:hover .mcard-prog-fill::after { opacity: 1; }
.mcard-time {
  font-size: 0.67rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.mcard-vol {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.mcard-vol:hover { color: var(--text); }

/* Drag-and-drop highlight */
.file-drop-active {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: rgba(80, 200, 120, 0.05) !important;
}

/* ═══════════════════════════ Screen Annotation ══════════════════════════ */
/* Annotation canvas */
.annotation-canvas {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  cursor: crosshair;
}
.screen-share-panel.annotating .annotation-canvas { pointer-events: auto; }
/* Keep toolbar clickable above canvas */
#share-self-controls { position: relative; z-index: 22; }

/* Annotation toolbar */
.annotate-toolbar {
  display: flex; align-items: center; gap: 5px;
}
.annotate-color-btn {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  flex-shrink: 0; padding: 0;
  background: var(--c, #ff453a);
  transition: border-color 0.15s, transform 0.1s;
}
.annotate-color-btn:hover  { transform: scale(1.2); }
.annotate-color-btn.active { border-color: #fff; transform: scale(1.15); }

/* ═══════════════════════ Image lightbox / annotation ═══════════════════ */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(0,0,0,0.93);
  display: flex;
  flex-direction: column;
}
.img-lightbox.hidden { display: none; }

.ilb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.ilb-tools-left, .ilb-tools-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ilb-color-btn {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--c, #ff453a);
  flex-shrink: 0;
  padding: 0;
  transition: border-color 0.12s, transform 0.1s;
}
.ilb-color-btn:hover  { transform: scale(1.2); }
.ilb-color-btn.active { border-color: #fff; transform: scale(1.15); }
.ilb-color-picker-wrap {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.12s, transform 0.1s;
}
.ilb-color-picker-wrap:hover { transform: scale(1.2); }
.ilb-color-picker-wrap.active { border-color: #fff; transform: scale(1.15); }
.ilb-color-picker-wrap input[type="color"] {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 1;
}
.ilb-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}
#ilb-stroke {
  width: 80px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ilb-stage {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ilb-content {
  position: relative;
  flex-shrink: 0;
}
.ilb-content img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}
.ilb-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
  touch-action: none;
}

/* ═══════════════════════════ Update banner ═════════════════════════════ */
.update-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.82rem;
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 99999;
  white-space: nowrap;
}
.update-banner.hidden { display: none; }
.update-banner-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.update-banner-btn:hover { background: var(--accent-hover); }
.update-banner-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  line-height: 1;
}
.update-banner-dismiss:hover { color: var(--text); }

/* ═══════════════════════════ Music card ════════════════════════════════ */
/* ── Music bot card ── */
.music-card {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 6px;
  max-width: 340px;
  width: 340px;
}
.music-card-top {
  background: linear-gradient(135deg, rgba(80,200,120,0.13) 0%, rgba(80,200,120,0.03) 100%);
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.music-card-art {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: rgba(80,200,120,0.18);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.music-card-meta { flex: 1; min-width: 0; }
.music-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}
.music-card-caption {
  font-size: 0.82rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.35;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ══════════════════════ Participant context menu ════════════════════════ */
.peer-ctx-menu {
  position: fixed;
  z-index: 9999;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  padding: 6px 0;
  user-select: none;
}
.peer-ctx-menu.hidden { display: none; }

.peer-ctx-header {
  padding: 8px 14px 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peer-ctx-section {
  padding: 6px 14px;
}
.peer-ctx-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.peer-ctx-volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.peer-ctx-volume-row input[type=range] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}
#peer-ctx-volume-val {
  font-size: 0.78rem;
  color: var(--text-secondary);
  min-width: 38px;
  text-align: right;
}

.peer-ctx-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.peer-ctx-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 8px 14px;
  font-size: 0.84rem;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.peer-ctx-btn:hover { background: var(--surface-hover); }
.peer-ctx-kick { color: var(--danger); }
.peer-ctx-kick:hover { background: rgba(240,64,64,0.12); color: var(--danger); }

body.light .peer-ctx-menu { box-shadow: 0 8px 32px rgba(0,0,0,0.18); }
body.light .mcard-prog-track { background: rgba(0,0,0,0.1); }
body.light .mcard-dl-btn { background: rgba(0,0,0,0.06); }
body.light .mcard-play { color: #fff; }
body.light .music-card-top { background: linear-gradient(135deg, rgba(80,200,120,0.18) 0%, rgba(80,200,120,0.05) 100%); }
