/* ═══════════════════════════════════════════════════════════════════════════
   Violet Presence — Design System
   Enterprise video conferencing with Violet AI
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* ── Violet palette ── */
  --v-50:  #f3f0ff;
  --v-100: #e5deff;
  --v-200: #cdbdff;
  --v-300: #a78bfa;
  --v-400: #a855f7;
  --v-500: #8b5cf6;
  --v-600: #7c3aed;
  --v-700: #6d28d9;
  --v-800: #5b21b6;
  --v-900: #4c1d95;

  /* ── Surfaces ── */
  --bg:       #0c0a14;
  --bg-card:  #151124;
  --bg-elev:  #1c1632;
  --bg-hover: #241c3a;
  --bg-glass: rgba(21, 17, 36, 0.85);

  /* ── Text ── */
  --text:       #f0eef5;
  --text-dim:   #a09bb5;
  --text-muted: #6b6580;

  /* ── Borders ── */
  --border:     rgba(124, 58, 237, 0.12);
  --border-lit: rgba(124, 58, 237, 0.25);

  /* ── Semantic ── */
  --green:   #34d399;
  --red:     #ef4444;
  --yellow:  #facc15;
  --pink:    #ec4899;

  /* ── Gradient ── */
  --grad: linear-gradient(135deg, #7c3aed, #a855f7, #ec4899);
  --grad-subtle: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(236,72,153,0.08));

  /* ── Sizing ── */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --header-h:  56px;
  --ctrl-h:    80px;
  --sidebar-w: 360px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ═══ COMMON ═══════════════════════════════════════════════════════════════ */

.logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--grad); color: #fff;
  font-weight: 800; font-size: 16px;
}
.logo-icon.small { width: 26px; height: 26px; border-radius: 7px; font-size: 13px; }

.avatar-circle {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--grad);
  color: #fff; font-weight: 700; text-transform: uppercase;
  flex-shrink: 0;
}
.avatar-circle.xs  { width: 28px; height: 28px; font-size: 11px; }
.avatar-circle.sm  { width: 36px; height: 36px; font-size: 14px; }
.avatar-circle.md  { width: 56px; height: 56px; font-size: 22px; }
.avatar-circle.lg  { width: 72px; height: 72px; font-size: 30px; }
.avatar-circle.xl  { width: 96px; height: 96px; font-size: 40px; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--grad); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 14px 24px; font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: opacity .2s, transform .1s; width: 100%;
}
.btn-primary:hover { opacity: .92; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ═══ LOADING ══════════════════════════════════════════════════════════════ */

#loading {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; z-index: 999; transition: opacity .4s;
}
#loading.hidden { opacity: 0; pointer-events: none; }

.loader-ring { display: inline-block; position: relative; width: 44px; height: 44px; }
.loader-ring div {
  box-sizing: border-box; display: block; position: absolute;
  width: 36px; height: 36px; margin: 4px;
  border: 3px solid transparent; border-top-color: var(--v-500);
  border-radius: 50%; animation: ring .8s cubic-bezier(.5,.1,.5,.9) infinite;
}
.loader-ring div:nth-child(1) { animation-delay: -.3s; }
.loader-ring div:nth-child(2) { animation-delay: -.15s; }
@keyframes ring { to { transform: rotate(360deg); } }

.loading-text { color: var(--text-dim); font-size: 14px; }

/* ═══ STATUS TOAST ═════════════════════════════════════════════════════════ */

#status-bar {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: var(--bg-glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-lit); border-radius: 12px;
  padding: 10px 20px; font-size: 13px; color: var(--text-dim);
  z-index: 200; pointer-events: none; opacity: 0; transition: opacity .3s;
  max-width: 420px; text-align: center;
}
#status-bar.visible { opacity: 1; }

/* ═══ LOBBY ════════════════════════════════════════════════════════════════ */

#lobby {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; padding: 20px;
  background: radial-gradient(ellipse at 50% 0%, rgba(124,58,237,0.08) 0%, transparent 60%);
}

.lobby-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 24px; width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 16px;
  padding: 32px; box-shadow: 0 24px 80px rgba(0,0,0,.5);
}

.lobby-header { text-align: center; margin-bottom: 4px; }

.lobby-logo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 24px; font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.lobby-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.lobby-preview {
  width: 100%; aspect-ratio: 16/10; background: #000;
  border-radius: var(--radius); overflow: hidden; position: relative;
}
.lobby-preview video {
  width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}
.lobby-preview .no-cam {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; color: var(--text-muted); font-size: 13px;
  background: var(--bg-card);
}

.lobby-media-btns {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px;
}

.media-toggle {
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.12); color: #fff;
  border-radius: 50%; width: 42px; height: 42px; cursor: pointer; transition: .2s;
}
.media-toggle:hover { background: rgba(255,255,255,.15); }
.media-toggle.off { background: var(--red); border-color: var(--red); }

.lobby-who {
  text-align: center; font-size: 12px; color: var(--text-muted); min-height: 18px;
}
.lobby-who strong { color: var(--v-400); }

.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.input-group input {
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text);
  font-size: 14px; font-family: inherit; outline: none; transition: border-color .2s;
}
.input-group input:focus { border-color: var(--v-500); }
.input-group input::placeholder { color: var(--text-muted); }

/* ═══ CALL SCREEN ══════════════════════════════════════════════════════════ */

#call { display: none; flex-direction: column; height: 100vh; }
#call.active { display: flex; }

/* ── Header ── */
.call-header {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); padding: 0 16px;
  background: var(--bg-glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 20;
}

.header-left, .header-right { display: flex; align-items: center; gap: 10px; }
.header-center { position: absolute; left: 50%; transform: translateX(-50%); }

.call-header .logo {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 15px;
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.room-badge {
  background: rgba(124,58,237,.15); padding: 3px 10px; border-radius: 20px;
  font-size: 12px; color: var(--v-400); font-weight: 500;
}
.peer-badge {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-dim);
}
.peer-badge svg { opacity: .6; }

.timer { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.header-btn {
  display: flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font-size: 12px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: .15s;
}
.header-btn:hover { border-color: var(--v-500); color: var(--text); background: var(--bg-hover); }
.header-btn.active { border-color: var(--v-500); color: var(--v-400); background: rgba(124,58,237,.1); }

/* ── Call body (grid + sidebar) ── */
.call-body { display: flex; flex: 1; overflow: hidden; }

.video-area { flex: 1; padding: 10px; overflow: hidden; display: flex; flex-direction: column; }

/* ── Layout mode toggle ── */
.layout-toggle {
  display: flex; gap: 4px; position: absolute; top: 10px; right: 10px; z-index: 15;
}
.layout-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--text-muted); cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: .15s;
}
.layout-btn:hover { border-color: var(--v-500); color: var(--text); }
.layout-btn.active { border-color: var(--v-500); color: var(--v-400); background: rgba(124,58,237,.15); }

/* ══ GALLERY MODE (default) ══ */
.video-grid {
  display: grid; gap: 8px; width: 100%; flex: 1;
  transition: all .3s ease;
}
.video-grid[data-count="1"] { grid-template-columns: 1fr; max-width: 720px; margin: 0 auto; }
.video-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
.video-grid[data-count="3"],
.video-grid[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid[data-count="5"],
.video-grid[data-count="6"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid[data-count="many"] {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: minmax(180px, 1fr); overflow-y: auto;
}

/* ══ SPEAKER MODE (Google Meet style — spotlight left, participants right) ══ */
.video-area.speaker-mode {
  flex-direction: row; display: flex;
}

.video-area.speaker-mode .video-grid {
  display: flex; flex: 1; min-width: 0;
}

/* Spotlight — the large tile */
.video-area.speaker-mode .video-tile.spotlight {
  width: 100%; height: 100%; border-radius: var(--radius);
}
.video-area.speaker-mode .video-tile.spotlight video {
  width: 100%; height: 100%; object-fit: contain; background: #000;
}

/* Hide non-spotlight tiles from grid (they're in filmstrip) */
.video-area.speaker-mode .video-grid .video-tile:not(.spotlight) { display: none; }

/* Filmstrip — vertical strip on the right side */
.filmstrip {
  display: none; flex-direction: column; gap: 8px; flex-shrink: 0;
  width: 200px; overflow-y: auto; overflow-x: hidden;
  padding: 0 0 0 8px; scrollbar-width: thin;
}
.video-area.speaker-mode .filmstrip { display: flex; }

.filmstrip .video-tile {
  width: 100%; height: 140px; flex-shrink: 0; border-radius: var(--radius-sm);
  position: relative; background: var(--bg-card); overflow: hidden;
  border: 2px solid transparent; cursor: pointer; transition: border-color .2s;
}
.filmstrip .video-tile:hover { border-color: var(--border-lit); }
.filmstrip .video-tile.speaking { border-color: var(--green); }
.filmstrip .video-tile video {
  width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm);
}
.filmstrip .tile-overlay { padding: 4px 8px; }
.filmstrip .tile-name { font-size: 11px; }
.filmstrip .tile-pin { display: none; }

/* Mobile: filmstrip goes to bottom horizontal */
@media (max-width: 768px) {
  .video-area.speaker-mode { flex-direction: column; }
  .filmstrip {
    width: 100%; height: 110px; flex-direction: row;
    overflow-x: auto; overflow-y: hidden; padding: 8px 0 0 0;
  }
  .filmstrip .video-tile { width: 150px; height: 100px; flex-shrink: 0; }
}

/* ── Video tile ── */
.video-tile {
  position: relative; background: var(--bg-card); border-radius: var(--radius);
  overflow: hidden; border: 2px solid transparent; transition: border-color .3s;
}
.video-tile video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  will-change: transform;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  background: var(--bg-card);       /* Show card color instead of black during drops */
  image-rendering: auto;
}
.video-tile.local video { transform: scaleX(-1); }

/* Speaking glow */
.video-tile.speaking { border-color: var(--green); box-shadow: 0 0 16px rgba(52,211,153,.2); }

@keyframes speak-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(52,211,153,.15); }
  50% { box-shadow: 0 0 20px rgba(52,211,153,.3); }
}
.video-tile.speaking { animation: speak-pulse 2s ease-in-out infinite; }

/* Screen share tile */
.video-tile.screen-share {
  border-color: rgba(99,102,241,.4);
}
.video-tile.screen-share video { object-fit: contain; background: #000; }

/* Pin button on tile hover */
.tile-pin {
  position: absolute; top: 10px; left: 10px; width: 30px; height: 30px;
  border-radius: 8px; background: rgba(0,0,0,.5); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.1); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: .2s; z-index: 5;
}
.video-tile:hover .tile-pin { opacity: 1; }
.tile-pin:hover { background: rgba(124,58,237,.5); border-color: var(--v-500); }
.tile-pin.pinned { opacity: 1; background: var(--v-600); border-color: var(--v-400); }

/* Tile overlay */
.tile-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 12px; display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 100%);
}
.tile-name { font-size: 12px; font-weight: 500; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.tile-icons { display: flex; gap: 6px; align-items: center; }
.tile-icon { font-size: 12px; opacity: .85; }
.tile-icon.muted {
  color: #fff; background: var(--red); border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center;
  justify-content: center; padding: 4px;
}

/* Avatar fallback */
.tile-avatar {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
}
.tile-avatar .avatar-circle { animation: avatar-breathe 4s ease-in-out infinite; }
@keyframes avatar-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* Hand raised — tile golden glow + animated badge */
.video-tile.hand-raised {
  border-color: var(--yellow) !important;
  box-shadow: 0 0 20px rgba(250,204,21,.2), inset 0 0 30px rgba(250,204,21,.03) !important;
  animation: hand-glow 2s ease-in-out infinite !important;
}
@keyframes hand-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(250,204,21,.15); }
  50% { box-shadow: 0 0 24px rgba(250,204,21,.3); }
}

.tile-hand {
  position: absolute; top: 10px; right: 10px;
  display: none; z-index: 5;
}
.tile-hand.active { display: flex; }

.tile-hand-inner {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(250,204,21,.15); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(250,204,21,.3);
  font-size: 22px;
  animation: hand-pop .4s cubic-bezier(.17,.67,.29,1.3), hand-wave 1s ease-in-out .4s infinite alternate;
}

@keyframes hand-pop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes hand-wave {
  0% { transform: rotate(-12deg) scale(1); }
  100% { transform: rotate(15deg) scale(1.05); }
}

/* Connection quality dot */
.tile-quality {
  position: absolute; top: 10px; left: 10px; width: 8px; height: 8px;
  border-radius: 50%; border: 1px solid rgba(0,0,0,.3);
}
.tile-quality.good { background: var(--green); }
.tile-quality.fair { background: var(--yellow); }
.tile-quality.poor { background: var(--red); }

/* ═══ SIDEBAR ══════════════════════════════════════════════════════════════ */

.sidebar {
  width: 0; overflow: hidden; flex-shrink: 0;
  background: var(--bg-card); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; transition: width .3s ease;
}
.sidebar.open { width: var(--sidebar-w); }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-title { font-size: 15px; font-weight: 600; }
.sidebar-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: 6px; display: flex; transition: .15s;
}
.sidebar-close:hover { background: var(--bg-hover); color: var(--text); }

.sidebar-panel { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.sidebar-panel.active { display: flex; }

/* ── Chat ── */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px; display: flex;
  flex-direction: column; gap: 8px;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-lit); border-radius: 3px; }

.chat-msg { max-width: 85%; }
.chat-msg.self { align-self: flex-end; }
.chat-msg.other { align-self: flex-start; }

.chat-sender { font-size: 11px; font-weight: 600; margin-bottom: 2px; }
.chat-msg.self .chat-sender { color: var(--v-400); text-align: right; }
.chat-msg.other .chat-sender { color: var(--text-muted); }

.chat-bubble {
  padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5;
  word-wrap: break-word;
}
.chat-msg.self .chat-bubble {
  background: rgba(124,58,237,.2); border: 1px solid rgba(124,58,237,.15);
  border-bottom-right-radius: 4px;
}
.chat-msg.other .chat-bubble {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.chat-msg.self .chat-time { text-align: right; }

.chat-input-area {
  display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input-area input {
  flex: 1; height: 40px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 20px; padding: 0 16px; color: var(--text); font-size: 13px;
  font-family: inherit; outline: none; transition: border-color .2s;
}
.chat-input-area input:focus { border-color: var(--v-500); }
.chat-input-area input::placeholder { color: var(--text-muted); }

.chat-send {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--v-600); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: .15s; flex-shrink: 0;
}
.chat-send:hover { background: var(--v-500); }

/* ── People list ── */
.people-list { flex: 1; overflow-y: auto; padding: 8px 0; }

.person-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; transition: background .15s;
}
.person-row:hover { background: var(--bg-hover); }
.person-name { flex: 1; font-size: 13px; font-weight: 500; }
.person-name .you-tag { font-size: 11px; color: var(--text-muted); margin-left: 4px; }
.person-icons { display: flex; gap: 6px; }
.person-icon { color: var(--text-muted); }
.person-icon.muted { color: var(--red); }
.person-icon.hand { color: var(--yellow); }

/* ── Transcript ── */
.transcript-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.transcript-list::-webkit-scrollbar { width: 3px; }
.transcript-list::-webkit-scrollbar-thumb { background: var(--border-lit); border-radius: 3px; }

.transcript-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 20px; color: var(--text-muted); font-size: 13px; text-align: center;
  flex: 1;
}

.tx-line { padding: 6px 0; }
.tx-speaker { font-size: 11px; font-weight: 600; color: var(--v-400); }
.tx-time { font-size: 10px; color: var(--text-muted); float: right; }
.tx-text { font-size: 13px; color: var(--text-dim); line-height: 1.5; margin-top: 2px; }

/* ═══ CONTROLS BAR ═════════════════════════════════════════════════════════ */

.controls {
  height: var(--ctrl-h); flex-shrink: 0;
  background: var(--bg-glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  padding: 0 20px; gap: 8px; z-index: 20;
}

.ctrl-group { display: flex; align-items: center; gap: 8px; }

.ctrl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; justify-content: center;
  transition: .15s; position: relative; font-family: inherit;
}
.ctrl-btn:hover { background: var(--bg-hover); border-color: var(--border-lit); }
.ctrl-btn:active { transform: scale(.93); }

.ctrl-btn.off { background: var(--red); border-color: var(--red); color: #fff; }
.ctrl-btn.off:hover { background: #dc2626; }

.ctrl-btn.active { background: rgba(124,58,237,.2); border-color: var(--v-500); color: var(--v-400); }

.ctrl-btn.danger {
  background: var(--red); border-color: var(--red); color: #fff;
  width: 64px; border-radius: 16px; margin-left: 16px;
}
.ctrl-btn.danger:hover { background: #dc2626; }

.ctrl-icon { display: flex; align-items: center; justify-content: center; height: 22px; }
.ctrl-label { font-size: 9px; color: var(--text-muted); }
.ctrl-btn.off .ctrl-label, .ctrl-btn.danger .ctrl-label { color: rgba(255,255,255,.7); }

/* Reaction picker */
.ctrl-reaction-wrap { position: relative; }
.reaction-picker {
  position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--border-lit); border-radius: 16px;
  padding: 8px 12px; display: flex; gap: 8px; z-index: 100;
  opacity: 0; pointer-events: none; transition: .2s; box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.reaction-picker.open { opacity: 1; pointer-events: auto; }
.reaction-item {
  background: none; border: none; font-size: 26px; cursor: pointer;
  padding: 4px; border-radius: 8px; transition: .15s;
}
.reaction-item:hover { background: var(--bg-hover); transform: scale(1.2); }

/* ═══ INVITE MODAL ═════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--bg-card); border: 1px solid var(--border-lit);
  border-radius: 20px; padding: 28px; width: 100%; max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: 6px; display: flex; transition: .15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

.invite-link-row { display: flex; gap: 8px; margin-bottom: 16px; }
.invite-link {
  flex: 1; height: 42px; background: rgba(124,58,237,.06); border: 1px solid rgba(124,58,237,.2);
  border-radius: var(--radius-sm); padding: 0 12px; color: var(--v-400);
  font-size: 12px; font-family: monospace; outline: none;
}
.btn-copy {
  height: 42px; padding: 0 16px; border-radius: var(--radius-sm);
  background: rgba(124,58,237,.15); border: 1px solid rgba(124,58,237,.25);
  color: var(--v-400); font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap; transition: .2s;
}
.btn-copy:hover { background: rgba(124,58,237,.25); }
.btn-copy.copied { background: rgba(52,211,153,.15); border-color: rgba(52,211,153,.25); color: var(--green); }

.invite-room-code {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-elev); border-radius: var(--radius-sm); padding: 12px 16px;
}
.code-label { font-size: 12px; color: var(--text-muted); }
.code-value {
  font-size: 18px; font-weight: 800; letter-spacing: 2px; font-family: monospace; color: var(--text);
}

/* ═══ SETTINGS MODAL ═══════════════════════════════════════════════════════ */

.settings-card { max-width: 520px; }

.settings-tabs {
  display: flex; gap: 4px; padding: 0 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.settings-tab {
  flex: 1; padding: 10px; text-align: center; font-size: 13px; font-weight: 600;
  color: var(--text-muted); background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: .2s; font-family: inherit;
}
.settings-tab:hover { border-color: var(--v-500); color: var(--text); }
.settings-tab.active { background: rgba(124,58,237,.15); border-color: var(--v-500); color: var(--v-400); }

.settings-panel { display: none; flex-direction: column; gap: 16px; }
.settings-panel.active { display: flex; }

.settings-field { display: flex; flex-direction: column; gap: 6px; }
.settings-field label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.settings-field select {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text); font-size: 13px; font-family: inherit;
  outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%238b7fa8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.settings-field select:focus { border-color: var(--v-500); }
.settings-field select option { background: var(--bg-card); }

/* Mic level meter */
.mic-meter {
  height: 8px; background: var(--bg-elev); border-radius: 4px; overflow: hidden;
  border: 1px solid var(--border);
}
.mic-meter-bar {
  height: 100%; width: 0%; background: var(--green); border-radius: 4px;
  transition: width .1s;
}

/* Camera preview */
.settings-preview {
  width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius-sm);
  overflow: hidden;
}
.settings-preview video {
  width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}

/* Test speaker button */
.btn-test-speaker {
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text); font-size: 13px; font-family: inherit;
  cursor: pointer; transition: .2s; width: fit-content;
}
.btn-test-speaker:hover { border-color: var(--v-500); background: var(--bg-hover); }

/* Toggle switch */
.settings-toggle {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; font-size: 13px; color: var(--text);
}
.settings-toggle input { display: none; }
.toggle-slider {
  width: 40px; height: 22px; border-radius: 11px; background: var(--border);
  position: relative; transition: .2s; flex-shrink: 0;
}
.toggle-slider::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: .2s;
}
.settings-toggle input:checked + .toggle-slider { background: var(--v-600); }
.settings-toggle input:checked + .toggle-slider::after { left: 21px; }

/* ═══ FLOATING REACTIONS ═══════════════════════════════════════════════════ */

#reaction-container { position: fixed; inset: 0; pointer-events: none; z-index: 150; overflow: hidden; }

.reaction-float {
  position: absolute; font-size: 36px; pointer-events: none;
  animation: float-up 2.5s ease-out forwards;
}
@keyframes float-up {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-200px) scale(1.3); }
}

/* ═══ END SCREEN ═══════════════════════════════════════════════════════════ */

#end-screen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 400;
}
.end-card {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.end-icon { color: var(--text-muted); margin-bottom: 8px; }
.end-card h2 { font-size: 22px; font-weight: 700; }
.end-card p { color: var(--text-muted); font-size: 14px; }
.end-card .btn-primary { width: auto; padding: 12px 32px; }

/* ═══ RESPONSIVE ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  :root { --sidebar-w: 100%; --ctrl-h: 70px; }

  .sidebar.open {
    position: fixed; inset: 0; z-index: 100; width: 100%;
    border-left: none; border-radius: 0;
  }

  .call-header { padding: 0 10px; }
  .header-right { display: none; }
  .header-left .logo { display: none; }

  .video-area { padding: 6px; }
  .video-grid { gap: 4px; }

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

  .controls { gap: 4px; padding: 0 8px; }
  .ctrl-btn { width: 46px; height: 46px; border-radius: 12px; }
  .ctrl-btn.danger { width: 56px; margin-left: 8px; }
  .ctrl-label { font-size: 8px; }

  .lobby-card { padding: 24px; max-width: 100%; border-radius: 20px; }
}

@media (max-width: 480px) {
  .video-grid[data-count="2"] { grid-template-columns: 1fr; }
  .ctrl-label { display: none; }
  .ctrl-btn { width: 44px; height: 44px; }
}

/* ═══ SCROLLBAR ════════════════════════════════════════════════════════════ */

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

/* ═══ PEER COUNT BADGE ═════════════════════════════════════════════════════ */

.peer-badge span {
  background: rgba(124,58,237,.2); color: var(--v-400);
  border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 600;
}
