:root{
  --bg:#07070a;
  --glass:rgba(0,0,0,.55);
  --glass2:rgba(255,255,255,.06);
  --border:rgba(255,255,255,.14);
  --text:#f2f4f8;
  --muted:rgba(242,244,248,.75);
  --shadow:0 18px 55px rgba(0,0,0,.55);
  --radius:18px;
}

html,body{height:100%;margin:0;background:transparent;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;}
body{background:var(--bg);}

.mc-iconbtn{
  width:34px;height:34px;border-radius:12px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.05);
  color:var(--text);
  cursor:pointer;
}
.mc-iconbtn:hover{background:rgba(255,255,255,.08);}

.mc-hidden{display:none !important;}

.mc-joinpanel{
  position:absolute;
  inset:0;
  padding:16px 16px 14px;
  background:
    radial-gradient(700px 420px at 25% 0%, rgba(255,255,255,.08), transparent 55%),
    radial-gradient(600px 420px at 90% 10%, rgba(120,180,255,.10), transparent 60%),
    #050507;
  display:flex;
  flex-direction:column;
  gap:12px;
  animation: mcFadeUp 180ms ease-out both;
}
.mc-joinrow{display:flex;flex-direction:column;gap:6px;}
.mc-label{font-size:11px;color:var(--muted); letter-spacing:.6px; text-transform:uppercase;}
.mc-joinactions{display:flex;gap:10px;margin-top:6px;}
.mc-primary{
  flex:1;height:42px;border-radius:14px;
  border:1px solid rgba(255,255,255,.20);
  background:rgba(255,255,255,.10);
  color:var(--text);
  cursor:pointer;
  font-weight:600;
}
.mc-primary:hover{background:rgba(255,255,255,.14);}
.mc-ghost{
  width:92px;height:42px;border-radius:14px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.20);
  color:var(--text);
  cursor:pointer;
}
.mc-ghost:hover{background:rgba(255,255,255,.06);}
.mc-joinstatus{font-size:12px;color:var(--muted); margin-top:2px;}

.mc-stage{
  position:relative;
  flex:0 0 340px;      /* fixed video area so chat can sit under (more space for messages) */
  min-height:340px;
  background:#050507;
  overflow:hidden;
}

.mc-ctl{
  flex:1;
  height:40px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
  font-weight:600;
  font-size:13px;
}
.mc-ctl:hover{background:rgba(255,255,255,.10);}
.mc-danger{background:rgba(255,0,0,.12);border-color:rgba(255,0,0,.22);}
.mc-danger:hover{background:rgba(255,0,0,.18);}

.mc-resizegrip{
  position:absolute;
  right:0; bottom:0;
  width:18px;height:18px;
  cursor:nwse-resize;
  background:linear-gradient(135deg, transparent 45%, rgba(255,255,255,.18) 45%, rgba(255,255,255,.18) 55%, transparent 55%);
  opacity:.65;
}


.mc-hudmsg{
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  color: rgba(255,255,255,.96);
  font-size: 14px;
  line-height: 1.25;
  opacity: 0;
  transform: translateY(6px);
  animation: mcHudIn 140ms ease-out forwards, mcHudOut 500ms ease-in forwards;
  animation-delay: 0ms, 3500ms; /* total 4s visible-ish */
}

@keyframes mcHudIn{ to{ opacity: 1; transform: translateY(0);} 
@keyframes mcHudOut{ to{ opacity: 0; transform: translateY(6px);} .mc-headbtn{
  width:34px;height:34px;border-radius:12px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.05);
  color:var(--text);
  cursor:pointer;
  font-size:18px;
  line-height:1;
}
.mc-headbtn:hover{background:rgba(255,255,255,.08);}


/* --- Join button (premium) --- */
.mc-joinbtn{
  height:44px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.06));
  color: rgba(255,255,255,.96);
  cursor:pointer;
  font-weight:800;
  letter-spacing:.2px;
}
.mc-joinbtn:hover{
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.08));
}
.mc-joinbtn:active{ transform: translateY(1px) scale(.995); }
.mc-joinbtn:disabled{
  opacity:.55;
  cursor:not-allowed;
  filter:saturate(.8);
}



@keyframes mcTrayIn{
  from{ opacity:0; transform: translateY(6px) scale(.99); }
  to{ opacity:1; transform: translateY(0) scale(1); }
/* --- Theme system --- */
:root{
  color-scheme: dark;
}
/* Light theme overrides */
html[data-theme="light"]{
  color-scheme: light;
}
html[data-theme="light"] body{
  background: #f6f7fb;
}
/* Swap core tokens in light mode */
html[data-theme="light"]{
  --text: rgba(18,18,22,.96);
  --muted: rgba(18,18,22,.60);
  --border: rgba(18,18,22,.16);
  --shadow: 0 18px 55px rgba(0,0,0,.18);
}
html[data-theme="light"] .mc-joinpanel{
  background:
    radial-gradient(700px 420px at 25% 0%, rgba(0,0,0,.05), transparent 55%),
    radial-gradient(600px 420px at 90% 10%, rgba(80,120,255,.12), transparent 60%),
    #f6f7fb;
}
html[data-theme="light"] .mc-joinbtn{
  border: 1px solid rgba(18,18,22,.18);
  background: linear-gradient(180deg, rgba(18,18,22,.06), rgba(18,18,22,.03));
  color: rgba(18,18,22,.92);
}
html[data-theme="light"] .mc-hudmsg{
  background: rgba(18,18,22,.10);
  color: rgba(18,18,22,.96);
}

.mc-globalTheme:active{ transform: translateY(1px) scale(.99); filter: brightness(1.05); }
.mc-globalTheme:hover{ background: rgba(255,255,255,.09); }

html[data-theme="light"] .mc-globalTheme{
  background: rgba(0,0,0,.04);
}



/* --- Light mode premium upgrades (contrast + clarity) --- */
html[data-theme="light"] body{
  background:
    radial-gradient(900px 600px at 15% 0%, rgba(80,120,255,.16), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(255,120,180,.10), transparent 60%),
    linear-gradient(180deg, #ffffff, #f2f4fb);
}

html[data-theme="light"] .mc-headbtn,
html[data-theme="light"] .mc-iconbtn{
  background: rgba(18,18,22,.04);
  border-color: rgba(18,18,22,.14);
  color: rgba(18,18,22,.86);
}
html[data-theme="light"] .mc-headbtn:hover,
html[data-theme="light"] .mc-iconbtn:hover{
  background: rgba(18,18,22,.06);
}

html[data-theme="light"] .mc-stage{
  background: #0b0b10;
}

html[data-theme="light"] .mc-ctl{
  background: rgba(18,18,22,.04);
  border-color: rgba(18,18,22,.14);
  color: rgba(18,18,22,.86);
}
html[data-theme="light"] .mc-ctl:hover{
  background: rgba(18,18,22,.06);
}
html[data-theme="light"] .mc-danger{
  background: rgba(255,0,0,.10);
  border-color: rgba(255,0,0,.18);
  color: rgba(120,0,0,.92);
}

html[data-theme="light"] .mc-hudmsg{
  background: rgba(255,255,255,.70);
  color: rgba(18,18,22,.92);
  border: 1px solid rgba(18,18,22,.10);
}



.mc-sideactions{
  position:absolute;
  left:12px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index:20;
}

.mc-sidebtn{
  width:44px;
  height:44px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(0,0,0,.28);
  color:#fff;
  font-size:18px;
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 110ms ease, background 140ms ease, border-color 140ms ease, opacity 200ms ease;
}
.mc-sidebtn:hover{ background:rgba(0,0,0,.34); }
.mc-sidebtn:active{ transform: translateY(1px) scale(.99); }

/* Make buttons compact */
.mc-ctl{
  min-width:0;
  padding:10px 12px;
  border-radius:14px;
}

/* Keep hang-up a little more visible even in idle */
.mc-stage.mc-idle-ui #btnHang{
  opacity: .22;
}

/* Light theme variants */
html[data-theme="light"] .mc-sidebtn{
  background: rgba(255,255,255,.72);
  border-color: rgba(18,18,22,.14);
  color: rgba(18,18,22,.86);
}
html[data-theme="light"] .mc-sidebtn:hover{ background: rgba(255,255,255,.86); }



/* Make hang button stand out but still compact */
#btnHang{
  width: 60px;
}

/* Side rail: slightly smaller */
.mc-sidebtn{
  width: 42px;
  height: 42px;
  border-radius: 16px;
}

.mc-stage.mc-idle-ui{
  /* tiny "sink" illusion */
}
/* Keep hang a bit more visible even in idle */
.mc-stage.mc-idle-ui #btnHang{ opacity: .18; }

.mc-stage{ position:relative; overflow:hidden; }

/* Hang slightly wider */
#btnHang{ width:60px !important; }

.mc-sidebtn{
  width:42px !important;
  height:42px !important;
  border-radius:16px !important;
}

/* Side actions -> right middle */
.mc-sideactions{
  left:auto !important;
  right:12px !important;
  top:50% !important;
  transform: translateY(-50%) !important;
  z-index:55 !important;
}

/* Hang stands out */
#btnHang{
  min-width:92px !important;
}

html[data-theme="light"] .mc-sidebtn{
  background: rgba(255,255,255,.78) !important;
  border-color: rgba(18,18,22,.14) !important;
  color: rgba(18,18,22,.86) !important;
}


/* Side actions -> top-left corner */
.mc-sideactions{
  position:absolute !important;
  left:12px !important;
  top:12px !important;
  right:auto !important;
  bottom:auto !important;
  transform:none !important;

  display:flex !important;
  flex-direction:column !important;
  gap:10px !important;

  z-index:70 !important;
}

/* Side buttons polish */
.mc-sidebtn{
  width:44px !important;
  height:44px !important;
  border-radius:16px !important;
  border:1px solid rgba(255,255,255,.18) !important;
  background: rgba(0,0,0,.26) !important;
  box-shadow: 0 10px 26px rgba(0,0,0,.30) !important;
  font-size:18px !important;
}
.mc-sidebtn:hover{ background: rgba(0,0,0,.32) !important; }
.mc-sidebtn:active{ transform: translateY(1px) scale(.99) !important; }

#btnHang{ min-width:92px !important; }

html[data-theme="light"] .mc-sidebtn{
  background: rgba(255,255,255,.78) !important;
  border-color: rgba(18,18,22,.14) !important;
  color: rgba(18,18,22,.86) !important;
  box-shadow: 0 10px 26px rgba(0,0,0,.10) !important;
}


/* Side actions: top-left */
.mc-sideactions{
  position:absolute !important;
  left:12px !important;
  top:12px !important;
  right:auto !important;
  bottom:auto !important;
  transform:none !important;
  display:flex !important;
  flex-direction:column !important;
  gap:10px !important;
  z-index:80 !important;
}

.mc-sidebtn{
  width:44px !important;
  height:44px !important;
  border-radius:16px !important;
  border:1px solid rgba(255,255,255,.18) !important;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.22)) !important;
  box-shadow: 0 10px 26px rgba(0,0,0,.30) !important;
  color: rgba(255,255,255,.95) !important;
  font-size:18px !important;
  display:grid !important;
  place-items:center !important;
  cursor:pointer !important;
}
.mc-sidebtn:hover{ background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.26)) !important; }
.mc-sidebtn:active{ transform: translateY(1px) scale(.99) !important; }

#btnHang{
  width:60px !important;
  min-width:60px !important;
  background: rgba(255,0,0,.14) !important;
  border-color: rgba(255,0,0,.26) !important;
}
#btnHang:hover{ background: rgba(255,0,0,.18) !important; }

html[data-theme="light"] #btnHang{
  color: rgba(120,0,0,.92) !important;
}
html[data-theme="light"] .mc-sidebtn{
  background: rgba(255,255,255,.82) !important;
  border-color: rgba(18,18,22,.14) !important;
  color: rgba(18,18,22,.88) !important;
  box-shadow: 0 10px 26px rgba(0,0,0,.10) !important;
}

.mc-sosbox{
  width:min(520px, 100%);
  border-radius:20px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(10,10,14,.72);
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  padding:18px;
  color:var(--text);
  text-align:center;
}
.mc-sosicon{font-size:34px; margin-bottom:6px;}
.mc-sostitle{font-weight:800; font-size:18px; margin-bottom:6px;}
.mc-sostext{font-size:14px; color:rgba(255,255,255,.9); line-height:1.35; margin-bottom:12px;}
.mc-sosactions{display:flex; gap:10px; justify-content:center; margin-bottom:10px;}
.mc-sosbtn{
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.08);
  color:var(--text);
  border-radius:14px;
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;
}
.mc-sosbtn:hover{background:rgba(255,255,255,.12);}
.mc-sosdanger{
  border-color: rgba(255,0,0,.32);
  background: rgba(255,0,0,.14);
}
.mc-sosdanger:hover{background: rgba(255,0,0,.20);}
.mc-sosnote{font-size:12px; color:var(--muted); line-height:1.3;}



.mc-uabtn{
  height:34px;
  padding:0 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  color: rgba(255,255,255,.95);
  cursor:pointer;
  font-weight:800;
  font-size:12px;
}
.mc-uabtn:hover{ background: rgba(0,0,0,.26); }
.mc-uabtn:active{ transform: translateY(1px) scale(.99); }

html[data-theme="light"] .mc-uabtn{
  background: rgba(18,18,22,.04);
  border-color: rgba(18,18,22,.12);
  color: rgba(18,18,22,.90);
}
.mc-invitebox{
  width: min(320px, 86vw);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(8,8,10,.78);
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  padding: 12px 12px 10px;
}

.mc-invitetitle{
  font-weight:900;
  letter-spacing:.2px;
  margin-bottom: 6px;
}
.mc-invitetext{
  color: rgba(242,244,248,.85);
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 12px;
}
.mc-inviteactions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
}
.mc-invitebtn{
  height:40px;
  padding:0 14px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.96);
  cursor:pointer;
  font-weight:900;
}
.mc-invitebtn:hover{ background: rgba(255,255,255,.10); }
.mc-inviteok{
  background: rgba(120,255,180,.14);
  border-color: rgba(120,255,180,.24);
}
.mc-invitenote{
  margin-top: 10px;
  font-size: 11px;
  color: rgba(242,244,248,.70);
}

html[data-theme="light"] .mc-invitebox{
  background: rgba(255,255,255,.92);
  border-color: rgba(18,18,22,.12);
}
html[data-theme="light"] .mc-invitetext,
html[data-theme="light"] .mc-invitenote{
  color: rgba(18,18,22,.70);
}
html[data-theme="light"] .mc-invitebtn{
  background: rgba(18,18,22,.04);
  border-color: rgba(18,18,22,.14);
  color: rgba(18,18,22,.90);
}


/* View lock: in UserRoom hide stage + hud completely */
#mcCallBody.mc-view-users #stage{display:none !important;}
#mcCallBody.mc-view-users #hud{display:none !important;}


/* Ensure Users view never shows chat overlay (prevents translucent chat layer over user list) */
#mcCallBody.mc-view-users #chatPanel{display:none !important;}
#mcCallBody.mc-view-users #mcPeerBar{display:none !important;}
#mcCallBody.mc-view-users #mcPeerMenu{display:none !important;}



/* --- FIX: show header call/video only in chat --- */
#mcCallWindow.mc-in-chat .mc-headaction{display:inline-flex !important;}
#mcCallWindow:not(.mc-in-chat) .mc-headaction{display:none !important;}
/* ensure dot positioning if used */
.mc-headbtn{position:relative;}


/* --- Notifications UI (unread dots + NEW badge) --- */
.mc-notifdot{
  position:absolute;
  top:6px;
  right:6px;
  width:10px;
  height:10px;
  border-radius:999px;
  background:#ff3b30;
  box-shadow:0 0 0 2px rgba(255,255,255,0.9);
  opacity:0;
  transform:scale(0.8);
  transition:opacity .15s ease, transform .15s ease;
  pointer-events:none;
}
.mc-notifdot.is-on{
  opacity:1;
  transform:scale(1);
}

/* user list unread indicator */
.mc-userrow{ position:relative; }
.mc-unreaddot{
  position:absolute;
  right:12px;
  top:50%;
  width:10px;
  height:10px;
  border-radius:999px;
  background:#ff3b30;
  transform:translateY(-50%);
}
.mc-newbadge{
  position:absolute;
  right:30px;
  top:50%;
  transform:translateY(-50%);
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
  padding:2px 6px;
  border-radius:999px;
  background:rgba(255,59,48,0.12);
  color:#ff3b30;
}

/* when unread, keep row readable */
.mc-userrow.has-unread .mc-username{ font-weight:700; }
