/* ============================================
   M e e t s   —   Design System
   Clean, modern, accessible.
   ============================================ */

:root {
  --bg: #07080a;
  --surface: #11131a;
  --surface-hover: #181b25;
  --surface-active: #1e2230;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.04);
  --text: #f0f2f5;
  --text-secondary: #7a8494;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glass: rgba(99, 102, 241, 0.12);
  --danger: #ef4444;
  --danger-hover: #f87171;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== NAVIGATION ===== */
.nav {
  background: rgba(15, 18, 24, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo-small {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.nav-badge {
  font-size: 0.8rem;
  background: var(--accent-glass);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
}

/* ===== HERO ===== */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 40px 24px;
  text-align: center;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(99,102,241,0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(34,197,94,0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(168,85,247,0.04) 0%, transparent 60%),
    var(--bg);
}

.hero-content {
  max-width: 560px;
  animation: fadeUp 0.6s ease-out;
}

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

.hero-icon {
  width: 80px;
  height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 28px;
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.35);
  animation: float 3s ease-in-out infinite;
}

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

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 1.15rem;
  line-height: 1.6;
  margin-bottom: 40px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.hero-hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  text-decoration: none;
  color: #fff;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { box-shadow: 0 8px 32px rgba(99, 102, 241, 0.5); transform: translateY(-1px); }

.btn-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.12); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }

.btn-danger { background: linear-gradient(135deg, var(--danger), #b91c1c); }
.btn-danger:hover { background: linear-gradient(135deg, var(--danger-hover), #dc2626); }

.btn-lg { padding: 16px 36px; font-size: 1.1rem; border-radius: var(--radius); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; }
.btn-block { width: 100%; }

.btn.inactive { opacity: 0.5; }

/* ===== INPUTS ===== */
.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}
.input:focus { border-color: var(--accent); }

.input-lg {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 16px 24px;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-family: var(--font);
  outline: none;
  min-width: 260px;
  transition: border-color var(--transition);
}
.input-lg:focus { border-color: var(--accent); }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 20px; font-size: 1.3rem; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }

.auth-modal { max-width: 420px; }

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.auth-tab.active { background: var(--surface); color: var(--text); }

.auth-form { display: none; }
.auth-form.active { display: block; }

.link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.link-box input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
}
.hint { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 16px; }

/* ===== MEET ROOM ===== */
.meet-room {
  display: none;
  flex-direction: column;
  height: 100vh;
}
.meet-room.active { display: flex; }

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(11, 14, 18, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
}
.badge-live { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-accent { background: var(--accent-glass); color: var(--accent); }
.badge-ghost { background: var(--surface); color: var(--text-secondary); }

.e2ee-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.actions { display: flex; gap: 8px; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.1rem;
  position: relative;
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn.has-new { background: var(--accent); border-color: var(--accent); color: #fff; }
.icon-btn.has-new::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.icon-btn.inactive {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== VIDEO ===== */
.video-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 16px;
  gap: 12px;
  overflow-y: auto;
  background: var(--bg);
}

.video-grid {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}
.video-grid.count-1 { grid-template-columns: 1fr; max-width: 1100px; }
.video-grid.count-2 { grid-template-columns: repeat(2, 1fr); }
.video-grid.count-3 { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.video-grid.count-3 .video-tile:first-child { grid-column: span 2; }
.video-grid.count-4 { grid-template-columns: repeat(2, 1fr); }
.video-grid.count-5,
.video-grid.count-6 { grid-template-columns: repeat(3, 1fr); }
.video-grid.count-7,
.video-grid.count-8,
.video-grid.count-9 { grid-template-columns: repeat(3, 1fr); }

.video-tile {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(145deg, #0c0e14, #08090c);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.video-tile:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(255,255,255,0.10);
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}

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

.video-tile .tile-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 14px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

.host-badge {
  font-size: 0.6rem;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 6px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.tile-quality {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(4px);
}

.ping-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(90deg, 
    #22c55e 0%, 
    #f59e0b 70%, 
    #ef4444 100%);
  background-size: 200% 100%;
  background-position: calc(100% - var(--ping-pos, 0%)) 0;
  transition: background-position 0.3s ease;
}

.video-tile .avatar {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3.5rem;
  background: linear-gradient(135deg, #1a1f2e, #0f1219);
}

.reconnecting-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  gap: 10px;
  z-index: 5;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== BOTTOM BAR ===== */
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(7, 8, 10, 0.92);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-top: 1px solid var(--border);
  z-index: 10;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  position: relative;
  overflow: hidden;
}
.ctrl-btn:hover { background: var(--surface-hover); transform: translateY(-1px); }
.ctrl-btn.danger { background: linear-gradient(135deg, var(--danger), #b91c1c); border-color: transparent; color: #fff; }
.ctrl-btn.danger:hover { background: linear-gradient(135deg, var(--danger-hover), #dc2626); }
.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.ctrl-btn.inactive { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.25); color: var(--danger-hover); }

/* ===== CHAT SIDEBAR ===== */
.chat-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 340px;
  background: rgba(15, 18, 24, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 50;
}
.chat-sidebar.open { transform: translateX(0); }

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

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

.chat-msg { max-width: 85%; }
.chat-msg .msg-author { font-size: 0.72rem; color: var(--accent); font-weight: 700; margin-bottom: 2px; }
.chat-msg .msg-text {
  background: var(--surface);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
}
.chat-msg.self { align-self: flex-end; }
.chat-msg.self .msg-author { color: var(--success); }
.chat-msg.self .msg-text { background: var(--accent-glass); }

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.chat-input-area input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 0.88rem;
  font-family: var(--font);
}
.chat-input-area input:focus { border-color: var(--accent); }

/* ===== PARTICIPANT PANEL ===== */
.participant-panel {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  background: rgba(15, 18, 24, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 50;
}
.participant-panel.open { transform: translateX(0); }

.participant-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.participant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

/* ===== ADMIN ===== */
.admin-body {
  min-height: 100vh;
  background: var(--bg);
}

.admin-body .nav { background: rgba(15, 18, 24, 0.95); }

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.admin-nav .nav-inner { justify-content: space-between; }

.login-card {
  max-width: 420px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.login-card h2 { margin-bottom: 24px; text-align: center; }

/* Not Authorized (Not Admin) Meme Card */
.not-authorized-card {
  max-width: 500px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  animation: fadeIn 0.4s ease-out;
}

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

.meme-emoji {
  font-size: 80px;
  margin-bottom: 16px;
  animation: shake 2s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

.meme-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--danger);
  margin-bottom: 12px;
}

.meme-text {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 8px;
}

.meme-text code {
  background: var(--accent-glass);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.95rem;
}

.meme-illustration {
  margin: 24px 0;
  padding: 24px;
  background: var(--bg);
  border-radius: var(--radius);
  position: relative;
}

.guard-cat {
  font-size: 60px;
  display: block;
  margin-bottom: 8px;
}

.guard-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
}

.meme-subtext {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Sections */
.admin-section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 { font-size: 1.3rem; }

.table-wrap { overflow-x: auto; }

.rooms-table {
  width: 100%;
  border-collapse: collapse;
}
.rooms-table th, .rooms-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}
.rooms-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 700;
}
.rooms-table tr:hover td { background: rgba(255,255,255,0.02); }
.rooms-table .empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px;
}

/* ===== PROFILE MODAL ===== */
.profile-modal {
  max-width: 420px;
  padding: 32px;
}
.profile-header {
  text-align: center;
  margin-bottom: 32px;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.profile-section {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.profile-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--surface);
  color: var(--text);
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 500;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== OFFLINE BANNER ===== */
body.offline::before {
  content: '⚠️ Нет соединения с сервером...';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
  text-align: center;
  padding: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 1000;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero-sub { font-size: 1rem; }

  .top-bar { padding: 8px 12px; gap: 6px; }
  .room-info { font-size: 0.75rem; gap: 6px; }

  .video-stage { padding: 8px; gap: 8px; }
  .video-grid { gap: 8px; }
  .video-grid.count-3 { grid-template-columns: 1fr; }
  .video-grid.count-3 .video-tile:first-child { grid-column: span 1; }
  .video-grid.count-4 { grid-template-columns: repeat(2, 1fr); }
  .video-grid.count-5,
  .video-grid.count-6 { grid-template-columns: repeat(2, 1fr); }
  .video-grid.count-7,
  .video-grid.count-8,
  .video-grid.count-9 { grid-template-columns: repeat(2, 1fr); }
  .video-tile .tile-info { padding: 14px 10px 6px; font-size: 0.72rem; }
  .video-tile .avatar { font-size: 2rem; }

  .bottom-bar { padding: 10px 8px; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .bottom-bar::-webkit-scrollbar { display: none; }
  .bottom-bar .ctrl-btn { flex-shrink: 0; padding: 8px 12px; font-size: 0.8rem; gap: 4px; }

  .chat-sidebar { width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; top: auto; height: 70vh; }
  .participant-panel { width: 280px; }

  .modal { padding: 20px; border-radius: var(--radius-lg); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .video-grid.count-2, .video-grid.count-3, .video-grid.count-4,
  .video-grid.count-5, .video-grid.count-6 { grid-template-columns: 1fr !important; }

  .bottom-bar .ctrl-btn span:not(:first-child) { display: none; }
  .bottom-bar .ctrl-btn {
    padding: 10px;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    justify-content: center;
  }

  .hero-actions { flex-direction: column; align-items: stretch; }
  .input-lg { min-width: unset; width: 100%; }
  .hero-icon { width: 64px; height: 64px; font-size: 28px; }
  .hero h1 { font-size: 1.7rem; }
}

/* ===== PRE-JOIN ===== */
.prejoin-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.prejoin-overlay.hidden { display: none; }

.prejoin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}

.prejoin-preview {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(145deg, #0c0e14, #08090c);
  border-radius: var(--radius);
  overflow: hidden;
}
.prejoin-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.prejoin-preview video.mirror { transform: scaleX(-1); }
.prejoin-avatar {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 4rem;
  background: linear-gradient(135deg, #1a1f2e, #0f1219);
}

.prejoin-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
}

@media (max-width: 480px) {
  .prejoin-card { padding: 20px; }
  .prejoin-avatar { font-size: 3rem; }
}

/* ===== MEDIA STATE OVERLAYS ===== */
.media-state {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  z-index: 3;
}
.media-state .mic-off,
.media-state .cam-off {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: all 0.2s ease;
}
.media-state .mic-off svg,
.media-state .cam-off svg {
  width: 16px;
  height: 16px;
  display: block;
  stroke: #ef4444;
}
.media-state .mic-off {
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.media-state .cam-off {
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===== CAMERA PIP (during screen share) ===== */
.camera-pip {
  position: absolute;
  bottom: 50px;
  right: 10px;
  width: 120px;
  height: 68px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255,255,255,0.2);
  object-fit: cover;
  z-index: 4;
  background: #000;
  box-shadow: var(--shadow);
}
.camera-pip.mirror { transform: scaleX(-1); }
.camera-pip { pointer-events: none; }

/* ===== SCREEN PREVIEW ===== */
.screen-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  background: #000;
  pointer-events: none;
}

@media (max-width: 768px) {
  .camera-pip {
    width: 80px;
    height: 45px;
    bottom: 44px;
    right: 6px;
  }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
