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

:root {
  --bg: #0a0a12;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-hover: rgba(255, 255, 255, 0.15);
  --blur: 20px;
  --primary: #7c3aed;
  --primary-glow: rgba(124, 58, 237, 0.35);
  --primary-hover: #9333ea;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --text: #f1f5f9;
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.35);
  --success: #34d399;
  --success-glow: rgba(52, 211, 153, 0.3);
  --warning: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

/* Ambient background glow */
body::before {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(52, 211, 153, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.page { display: none; }
.page.active { display: block; }

/* ===================== GLASS MIXIN ===================== */
.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
}

/* ===================== AUTH ===================== */
.join-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh; padding: 20px;
  position: relative; z-index: 1;
}
.join-screen h1 {
  font-size: 2.8rem; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a78bfa, #60a5fa, #34d399);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 8px;
}
.subtitle { color: var(--text-secondary); margin-bottom: 24px; font-size: 1.05rem; }

.auth-card {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%; max-width: 380px;
  text-align: left;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 0.78rem; color: var(--text-secondary);
  margin-bottom: 5px; font-weight: 500;
}
input[type="password"], input[type="text"] {
  width: 100%; padding: 11px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  color: var(--text); font-size: 0.95rem;
  outline: none; transition: all 0.2s;
  box-sizing: border-box;
}
input[type="password"]:focus, input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(255, 255, 255, 0.08);
}
select {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  color: var(--text); font-size: 0.95rem;
  outline: none; transition: border-color 0.2s;
}
.btn-full { width: 100%; justify-content: center; }
.error-msg { color: var(--danger); font-size: 0.82rem; margin-bottom: 10px; min-height: 1em; }
.success-msg { color: var(--success); font-size: 0.82rem; margin-bottom: 10px; min-height: 1em; }
.auth-switch {
  text-align: center; font-size: 0.82rem; color: var(--text-secondary); margin-top: 14px;
}
.auth-switch a { color: #a78bfa; text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* ===================== BUTTONS ===================== */
.btn {
  padding: 10px 20px; border: none; border-radius: var(--radius-xs);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s ease; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  letter-spacing: 0.2px;
}
.btn-sm { padding: 7px 14px; font-size: 0.78rem; }
.btn-xs { padding: 5px 10px; font-size: 0.7rem; }
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
  box-shadow: 0 2px 12px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #9333ea, #7c3aed);
  box-shadow: 0 4px 20px var(--primary-glow);
  transform: translateY(-1px);
}
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 2px 12px var(--danger-glow);
}
.btn-danger:hover {
  box-shadow: 0 4px 20px var(--danger-glow);
  transform: translateY(-1px);
}
.btn-ghost {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-secondary);
  padding: 7px 10px;
  border: 1px solid var(--glass-border);
  position: relative;
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--glass-hover);
  border-color: rgba(255, 255, 255, 0.2);
}
.badge {
  position: absolute; top: -4px; right: -4px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white; font-size: 0.65rem; width: 18px; height: 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; box-shadow: 0 2px 8px var(--primary-glow);
}

/* ===================== MAIN LAYOUT ===================== */
.main-layout { height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }

.header-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--glass-border);
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.logo {
  font-weight: 800; font-size: 0.95rem; letter-spacing: -0.3px;
  background: linear-gradient(135deg, #a78bfa, #60a5fa, #34d399);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.header-right { display: flex; align-items: center; gap: 8px; }

/* Connection status */
.conn-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 600;
}
.conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
}
.conn-status.connected .conn-dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success-glow);
}
.conn-status.connected { color: var(--success); }
.conn-status.disconnected .conn-dot {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger-glow);
}
.conn-status.disconnected { color: var(--danger); }

/* Stream banner */
.stream-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 7px 16px; font-size: 0.78rem; font-weight: 600;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
}
.stream-banner.is-sharing {
  background: rgba(52, 211, 153, 0.1);
  border-bottom-color: rgba(52, 211, 153, 0.2);
  color: var(--success);
}
.stream-banner.is-watching {
  background: rgba(96, 165, 250, 0.1);
  border-bottom-color: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
}

.quality-select {
  padding: 6px 10px; font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs); color: var(--text); cursor: pointer;
}

/* ===================== CONTENT ===================== */
.content-area { flex: 1; display: flex; min-height: 0; }
.video-wrapper { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.video-area {
  flex: 1; position: relative; background: #050508;
  overflow: hidden; min-height: 0;
  border-radius: 0;
}
.video-area video { width: 100%; height: 100%; object-fit: contain; cursor: pointer; }

.video-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 20px;
}
.ph-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.ph-sub { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }

/* ===================== WEBCAM GRID ===================== */
.webcam-grid {
  display: none;
  gap: 8px;
  padding: 8px;
  z-index: 2;
}

/* Grid mode: no screen share, webcams fill the video area */
.webcam-grid.grid-mode {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  position: absolute;
  inset: 0;
  align-content: center;
  justify-items: center;
  overflow-y: auto;
}

/* Strip mode: screen share active, webcams become bottom strip */
.webcam-grid.strip-mode {
  display: flex;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 110px;
  padding: 6px 10px;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--glass-border);
  align-items: center;
  z-index: 6;
}

.webcam-tile {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  transition: all 0.25s ease;
}

.webcam-grid.grid-mode .webcam-tile {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 4/3;
}

.webcam-grid.strip-mode .webcam-tile {
  width: 130px;
  height: 96px;
  flex-shrink: 0;
}

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

.webcam-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.webcam-tile.local-cam {
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 0 8px var(--primary-glow);
}

/* Webcam button active state */
#btn-webcam.active {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.1);
  color: var(--success);
}

/* ===================== VIDEO CONTROLS ===================== */
.video-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--glass-border); gap: 8px;
}
.controls-left, .controls-right { display: flex; align-items: center; gap: 8px; }
.ctrl-btn {
  background: var(--glass); border: 1px solid var(--glass-border);
  color: var(--text-secondary); border-radius: var(--radius-xs); padding: 6px 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.ctrl-btn:hover { color: var(--text); background: var(--glass-hover); }
.ctrl-btn.active {
  color: var(--success); border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.1);
}

/* ===================== REACTIONS ===================== */
.reaction-btn {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs); padding: 4px 10px;
  font-size: 1.2rem; cursor: pointer; transition: all 0.2s; line-height: 1;
}
.reaction-btn:hover {
  transform: scale(1.15);
  background: var(--primary-glow);
  border-color: var(--primary);
  box-shadow: 0 4px 15px var(--primary-glow);
}
.reaction-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; height: 100%;
  pointer-events: none; overflow: hidden; z-index: 5;
}
.floating-reaction {
  position: absolute; font-size: 2rem;
  animation: float-up 2s ease-out forwards; pointer-events: none;
}
@keyframes float-up {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: 1; transform: translateY(-40vh) scale(1.2); }
  100% { opacity: 0; transform: translateY(-80vh) scale(0.8); }
}

/* ===================== SIDE PANEL ===================== */
.side-panel {
  width: 280px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-left: 1px solid var(--glass-border);
  display: flex; flex-direction: column;
  transition: width 0.25s ease, opacity 0.25s ease; overflow: hidden;
}
.side-panel.hidden { width: 0; opacity: 0; border-left: none; }

.panel-section {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.panel-section h3 {
  font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 8px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}

/* Collapsible section toggle */
.section-toggle {
  cursor: pointer; user-select: none;
  padding: 2px 0; margin-bottom: 0 !important;
  transition: color 0.2s;
}
.section-toggle:hover { color: var(--text-secondary); }
.section-toggle .chevron {
  margin-left: auto; flex-shrink: 0;
  transition: transform 0.25s ease;
}
.section-toggle.collapsed .chevron { transform: rotate(-90deg); }

/* Section body collapse */
.section-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.25s ease;
  max-height: 500px;
  opacity: 1;
  margin-top: 8px;
}
.section-body.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}
.section-body-chat {
  display: flex; flex-direction: column;
  max-height: none; /* chat grows to fill */
}
.section-body-chat.collapsed {
  max-height: 0;
}
.count-tag {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white; font-size: 0.58rem; padding: 1px 7px;
  border-radius: 10px; font-weight: 700;
}

/* Your status card */
.status-section { padding: 12px; }
.your-status {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}
.your-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.your-name { font-weight: 600; font-size: 0.85rem; }
.your-role-line { display: flex; gap: 5px; margin-top: 3px; flex-wrap: wrap; }
.voice-tag {
  font-size: 0.58rem; padding: 2px 7px; border-radius: 6px; font-weight: 600;
  letter-spacing: 0.3px;
}
.voice-tag.on {
  background: rgba(52, 211, 153, 0.15); color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}
.voice-tag.off {
  background: rgba(255, 255, 255, 0.05); color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.mic-tag {
  font-size: 0.58rem; padding: 2px 7px; border-radius: 6px; font-weight: 600;
  background: rgba(52, 211, 153, 0.15); color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}
.mic-tag.muted {
  background: rgba(239, 68, 68, 0.15); color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Audio controls */
.audio-section { padding: 10px 12px; }
.audio-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.audio-row:last-child { margin-bottom: 0; }
.audio-label {
  font-size: 0.66rem; color: var(--text-muted); min-width: 40px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
}
.audio-btn {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs); padding: 5px 10px; font-size: 0.76rem;
  cursor: pointer; color: var(--text-secondary); transition: all 0.2s;
  white-space: nowrap; display: flex; align-items: center; gap: 4px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.audio-btn:hover { background: var(--glass-hover); color: var(--text); }
.audio-btn.active {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.1);
  color: var(--success);
}
.audio-btn.muted {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger); opacity: 0.8;
}
.audio-btn-mini {
  background: none; border: none; font-size: 0.85rem;
  cursor: pointer; padding: 0 2px; line-height: 1;
  transition: opacity 0.2s;
}
.audio-btn-mini.muted { opacity: 0.35; }

/* Sliders */
.vol-slider {
  flex: 1; height: 4px; -webkit-appearance: none; appearance: none;
  background: rgba(255, 255, 255, 0.1); border-radius: 2px;
  outline: none; cursor: pointer; min-width: 40px;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-radius: 50%; cursor: pointer;
  box-shadow: 0 0 6px var(--primary-glow);
}
.vol-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-radius: 50%; cursor: pointer; border: none;
}
.vol-label { font-size: 0.63rem; color: var(--text-muted); min-width: 28px; text-align: right; }
.device-select {
  width: 100%; padding: 4px 6px; font-size: 0.66rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis;
}

/* Users */
.users-section .section-body { max-height: 160px; overflow-y: auto; }
.users-section .section-body.collapsed { max-height: 0; overflow: hidden; }
.user-list { display: flex; flex-direction: column; gap: 2px; }
.user-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: var(--radius-xs); font-size: 0.8rem;
  transition: background 0.15s;
}
.user-item:hover { background: rgba(255, 255, 255, 0.05); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 700; flex-shrink: 0;
}
.user-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-host-tag {
  font-size: 0.58rem;
  background: rgba(52, 211, 153, 0.15); color: var(--success);
  padding: 2px 6px; border-radius: 5px; font-weight: 600;
  border: 1px solid rgba(52, 211, 153, 0.2);
}
.user-you-tag { font-size: 0.6rem; color: var(--text-muted); font-style: italic; }
.user-voice-tag { font-size: 0.7rem; }
.user-voice-tag.muted { opacity: 0.4; }
.role-badge {
  display: inline-block; padding: 2px 6px; border-radius: 5px;
  font-size: 0.58rem; font-weight: 600;
}
.role-badge.admin {
  background: rgba(124, 58, 237, 0.15); color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.2);
}

/* Speaking indicator */
.user-item.speaking .user-avatar {
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.5);
  animation: pulse-speak 1.2s ease infinite;
}
@keyframes pulse-speak {
  0%, 100% { box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.15); }
}

/* Chat */
.chat-section {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.chat-section.is-collapsed {
  flex: 0;
}
.chat-messages {
  flex: 1; overflow-y: auto; margin-bottom: 4px;
  font-size: 0.75rem; min-height: 0;
}
.chat-msg { padding: 3px 0; line-height: 1.35; word-break: break-word; }
.chat-msg .sender { font-weight: 600; color: #a78bfa; }
.chat-msg .sender.is-host { color: var(--success); }
.chat-input { display: flex; gap: 4px; }
.chat-input input {
  flex: 1; padding: 6px 10px; font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xs);
  color: var(--text);
}
.chat-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* ===================== TOAST ===================== */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  color: var(--text); padding: 10px 24px;
  border-radius: var(--radius); font-size: 0.85rem;
  transition: transform 0.3s ease; z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ===================== STATS OVERLAY ===================== */
.stats-overlay {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 14px 18px;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.72rem; color: #a0f0a0;
  z-index: 10; min-width: 300px; max-width: 420px;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.stats-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; font-weight: 700; color: var(--text);
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.stats-close {
  background: none; border: none; color: var(--text-secondary);
  font-size: 1.1rem; cursor: pointer; padding: 0 4px; line-height: 1;
  transition: color 0.15s;
}
.stats-close:hover { color: var(--danger); }
.stats-content { line-height: 1.6; }
.stats-row { display: flex; justify-content: space-between; gap: 12px; }
.stats-label { color: var(--text-secondary); }
.stats-val { color: #a0f0a0; text-align: right; }
.stats-section {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.stats-section-title { color: #a78bfa; font-weight: 700; font-size: 0.7rem; margin-bottom: 2px; }

/* ===================== ADMIN ===================== */
.admin-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.admin-panel {
  background: rgba(20, 20, 35, 0.9);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  width: 100%; max-width: 600px; max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.admin-header h2 { font-size: 1.1rem; font-weight: 700; }
.admin-users { overflow-y: auto; padding: 12px; }
.admin-user {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 6px;
  background: var(--glass); border: 1px solid rgba(255, 255, 255, 0.05);
  gap: 10px;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-weight: 600; font-size: 0.9rem; }
.admin-user-meta { font-size: 0.72rem; color: var(--text-muted); }
.admin-user-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.admin-btn {
  padding: 4px 10px; border: none; border-radius: 6px;
  font-size: 0.72rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: all 0.15s;
}
.admin-btn.approve { background: rgba(52, 211, 153, 0.2); color: var(--success); }
.admin-btn.approve:hover { background: rgba(52, 211, 153, 0.3); }
.admin-btn.reject { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.admin-btn.promote { background: rgba(124, 58, 237, 0.2); color: #a78bfa; }
.admin-btn.demote { background: rgba(251, 191, 36, 0.2); color: var(--warning); }
.admin-btn.delete { background: rgba(127, 29, 29, 0.4); color: #fca5a5; }
.admin-btn.reset { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
.status-badge {
  display: inline-block; padding: 2px 6px; border-radius: 5px;
  font-size: 0.6rem; font-weight: 600;
}
.status-badge.approved { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.status-badge.pending { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.status-badge.rejected { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ===================== CONTEXT MENU ===================== */
.context-menu {
  position: fixed;
  z-index: 200;
  min-width: 160px;
  background: rgba(20, 20, 35, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: ctx-fade-in 0.12s ease;
}
@keyframes ctx-fade-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.context-menu-header {
  padding: 6px 10px 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.context-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.context-menu-item.danger {
  color: var(--danger);
}
.context-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}
.context-menu-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}
.context-menu-volume {
  padding: 6px 10px 8px;
}
.ctx-vol-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 5px;
}
.ctx-vol-pct {
  margin-left: auto;
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
}
.ctx-vol-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.ctx-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px var(--primary-glow);
}
.ctx-vol-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ===================== KICKED OVERLAY ===================== */
.kicked-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.kicked-card {
  text-align: center;
  padding: 40px 50px;
  background: rgba(20, 20, 35, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  max-width: 380px;
}
.kicked-icon { font-size: 3rem; margin-bottom: 12px; }
.kicked-card h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.kicked-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* System chat messages */
.chat-msg.system-msg { opacity: 0.7; font-style: italic; }
.chat-msg .sender.system { color: var(--danger); }

/* ===================== FULLSCREEN ===================== */
video:fullscreen, video:-webkit-full-screen {
  width: 100%; height: 100%; object-fit: contain; background: #000;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1); border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .side-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 260px; z-index: 50; }
  .side-panel.hidden { width: 0; }
  .reaction-btn { padding: 3px 7px; font-size: 1rem; }
  .webcam-grid.grid-mode { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .webcam-grid.strip-mode { height: 85px; }
  .webcam-grid.strip-mode .webcam-tile { width: 100px; height: 74px; }
}
