.mc-callwindow{
  transform: translateZ(0);
  will-change: transform;

  position:fixed;
  right:16px;
  bottom:16px;
  width:420px;
  height:620px;
  max-width:min(92vw,520px);
  max-height:min(92vh,760px);
  background:var(--glass);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
  color:var(--text);
  display:flex;
  flex-direction:column;
  z-index:9999;
}

.mc-callheader{
  touch-action: none;

  height:54px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(to bottom, rgba(255,255,255,.06), rgba(255,255,255,.02));
  cursor:grab;
  user-select:none;

  min-height:56px;
}

.mc-callheader:active{cursor:grabbing;}
.mc-callbrand{font-weight:700;letter-spacing:.3px;}
.mc-callsub{font-size:12px;color:var(--muted);margin-top:2px;}
.mc-calltitle{display:flex;flex-direction:column;line-height:1.05;}
.mc-callheader-actions{display:flex;gap:8px;align-items:center;}
.mc-callbody{
  position:relative;
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
}

#remoteVideo{
  position:absolute;inset:0;width:100%;height:100%;
  object-fit:cover;background:#111;
}
#localVideo{
  position:absolute;
  right:12px; top:12px;
  width:120px;height:170px;
  object-fit:cover;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.18);
  background:#111;
  box-shadow:0 10px 30px rgba(0,0,0,.5);
}

.mc-controls{
  position:absolute;
  left:12px; right:12px; top:12px;
  display:flex; gap:8px;
  padding:10px;
  border-radius:16px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.35);
  }


/* Header buttons (match index.html) */
.mc-callheadbtns{display:flex;gap:8px;align-items:center;}
/* --- Premium motion + safe micro-interactions --- */
@media (prefers-reduced-motion: reduce){
  *{animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important;}

.mc-callwindow{ transition: box-shadow 180ms ease, border-color 180ms ease; }
.mc-callwindow:hover{ border-color: rgba(255,255,255,.18); box-shadow: 0 22px 70px rgba(0,0,0,.62); }
/* Video compositing hints (Android/WebView stability) */
#remoteVideo,#localVideo{
  transform: translateZ(0);
  backface-visibility:hidden;
  will-change: transform;
}



/* Header subtle shine */
.mc-callheader{ position:relative; }
.mc-callheader::after{
  content:"";
  position:absolute;
  left:0; right:0; top:0;
  height:1px;
  background: rgba(255,255,255,.14);
  opacity:.55;
  pointer-events:none;
}



.mc-controls:hover{
  border-color: rgba(255,255,255,.18);
}



/* Call window surfaces in light mode (keep no backdrop-filter for Android stability) */
html[data-theme="light"] .mc-callwindow{
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,249,253,.92));
}
html[data-theme="light"] .mc-callheader{
  background: rgba(255,255,255,.72);
}
html[data-theme="light"] .mc-controls{
  background: rgba(255,255,255,.70);
}
/* Global theme toggle button (top-left, outside call window) */
.mc-globalTheme{
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10050;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 20px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 110ms ease, background 140ms ease, border-color 140ms ease, filter 140ms ease;
}
html[data-theme="light"] .mc-callwindow{
  border-color: rgba(18,18,22,.12);
  box-shadow: 0 26px 80px rgba(0,0,0,.22);
}

html[data-theme="light"] .mc-callheader{
  border-bottom-color: rgba(18,18,22,.12);
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.72));
}

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

/* --- L-Layout controls (minimal) --- */
.mc-stage{ position:relative; }

.mc-controls > *{ pointer-events:auto; }

/* --- Idle hide: controls become almost invisible when not used --- */
.mc-stage.mc-idle-ui .mc-controls,
.mc-stage.mc-idle-ui .mc-sideactions{
  opacity: .08;
  transform: translateY(0);
}
.mc-stage.mc-idle-ui .mc-controls:hover,
.mc-stage.mc-idle-ui .mc-sideactions:hover{
  opacity: 1;
}

.mc-controls,
.mc-sideactions{
  opacity: 1;
  transition: opacity 220ms ease;
}

/* --- L-shape layout v2 (bottom-left) --- */
.mc-controls{
  left: 12px !important;
  right: auto !important;
  bottom: 12px !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.mc-controls .mc-ctl{
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: .2px;
}

/* Ultra-idle: almost invisible + subtle scale */
.mc-stage.mc-idle-ui .mc-controls,
.mc-stage.mc-idle-ui .mc-sideactions{
  opacity: .06;
}
.mc-stage.mc-idle-ui .mc-controls,
.mc-stage.mc-idle-ui .mc-sideactions{
  transform: scale(.985);
  transform-origin: left bottom;
  transition: opacity 220ms ease, transform 220ms ease;
}
.mc-controls,
.mc-sideactions{
  transition: opacity 220ms ease, transform 220ms ease;
  transform: scale(1);
}

/* PiP: long-press affordance */
#localVideo{
  cursor: pointer;
}





/* Controls: bottom-left cluster, always on top */
.mc-controls{
  position:absolute !important;
  left:12px !important;
  bottom:12px !important;
  top:auto !important;
  right:auto !important;

  display:flex !important;
  gap:10px !important;
  padding:0 !important;

  background: transparent !important;
  border: 0 !important;
  box-shadow:none !important;

  z-index:60 !important;
}

.mc-controls .mc-ctl{
  width:52px !important;
  height:52px !important;
  padding:0 !important;
  border-radius:16px !important;
  display:grid !important;
  place-items:center !important;
  font-weight:800 !important;
  letter-spacing:.2px !important;
}

/* Side actions on the stage (video) */
.mc-sideactions{
  position:absolute !important;
  left:12px !important;
  top:50% !important;
  transform: translateY(-50%) !important;
  z-index:55 !important;
}

/* Idle: almost invisible */
.mc-callbody.mc-idle-ui .mc-controls,
.mc-callbody.mc-idle-ui .mc-sideactions{
  opacity:.06 !important;
  transform: scale(.985) !important;
  transform-origin:left bottom;
  transition: opacity 220ms ease, transform 220ms ease;
}
.mc-callbody .mc-controls,
.mc-callbody .mc-sideactions{
  opacity:1;
  transition: opacity 220ms ease, transform 220ms ease;
}

.mc-callbody.mc-idle-ui #btnHang{ opacity:.18 !important; }


/* Main controls -> bottom center */
.mc-controls{
  position:absolute !important;
  left:50% !important;
  bottom:12px !important;
  top:auto !important;
  right:auto !important;
  transform: translateX(-50%) !important;

  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:10px !important;

  padding:10px 12px !important;
  border-radius:18px !important;
  border:1px solid rgba(255,255,255,.16) !important;
  background: rgba(0,0,0,.28) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,.35) !important;

  z-index:60 !important;
  pointer-events:auto !important;
}

/* Buttons in bar */
.mc-controls .mc-ctl{
  width:auto !important;
  min-width:78px !important;
  height:44px !important;
  padding:0 14px !important;
  border-radius:16px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-weight:800 !important;
}

/* Keep local PiP clear of buttons */
#localVideo{
  right:12px !important;
  top:12px !important;
}

/* Idle fade applies to controls + sideactions as before (use existing class on mcCallBody) */
.mc-callbody.mc-idle-ui .mc-controls,
.mc-callbody.mc-idle-ui .mc-sideactions{
  opacity:.08 !important;
  transform: translateX(-50%) scale(.985) !important;
}

.mc-callbody.mc-idle-ui .mc-sideactions{
  transform: translateY(-50%) scale(.985) !important;
}

/* Light theme variants */
html[data-theme="light"] .mc-controls{
  background: rgba(255,255,255,.70) !important;
  border-color: rgba(18,18,22,.14) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,.12) !important;
}
/* =========================
   UI DISTRIBUTION v2 (authoritative, 1766967773)
   Request: Move Flip + Fullscreen vertical to TOP-LEFT corner (inside stage)
   + Polish: tighter buttons, consistent glass, safe spacing from header/PiP
   ========================= */

.mc-stage{ position:relative; }

/* Keep PiP out of the way (top-right) */
#localVideo{
  right:12px !important;
  top:12px !important;
}

/* Main controls stay bottom-center glass bar (from v1) */
.mc-controls{
  position:absolute !important;
  left:50% !important;
  bottom:12px !important;
  top:auto !important;
  right:auto !important;
  transform: translateX(-50%) !important;

  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:10px !important;

  padding:10px 12px !important;
  border-radius:18px !important;
  border:1px solid rgba(255,255,255,.16) !important;
  background: rgba(0,0,0,.28) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,.35) !important;

  z-index:60 !important;
  pointer-events:auto !important;
}

/* Buttons in bar */
.mc-controls .mc-ctl{
  width:auto !important;
  min-width:78px !important;
  height:44px !important;
  padding:0 14px !important;
  border-radius:16px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-weight:800 !important;
}
/* Idle fade uses correct transforms (avoid x-translate on sideactions now) */
.mc-callbody.mc-idle-ui .mc-controls{
  opacity:.08 !important;
  transform: translateX(-50%) scale(.985) !important;
}
.mc-callbody.mc-idle-ui .mc-sideactions{
  opacity:.08 !important;
  transform: scale(.985) !important;
  transform-origin: left top !important;
}

/* Light theme variants */
html[data-theme="light"] .mc-controls{
  background: rgba(255,255,255,.70) !important;
  border-color: rgba(18,18,22,.14) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,.12) !important;
}
/* Bottom controls: icon-only, centered */
.mc-controls{
  position:absolute !important;
  left:50% !important;
  bottom:12px !important;
  top:auto !important;
  right:auto !important;
  transform: translateX(-50%) !important;

  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:10px !important;

  padding:10px 12px !important;
  border-radius:20px !important;
  border:1px solid rgba(255,255,255,.16) !important;
  background: rgba(0,0,0,.28) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,.35) !important;

  z-index:75 !important;
}

.mc-controls .mc-ctl{
  width:52px !important;
  min-width:52px !important;
  height:52px !important;
  padding:0 !important;
  border-radius:18px !important;
  display:grid !important;
  place-items:center !important;

  border:1px solid rgba(255,255,255,.16) !important;
  background: rgba(255,255,255,.06) !important;
  color: rgba(255,255,255,.96) !important;
  font-weight:900 !important;
  font-size:18px !important;
  letter-spacing:0 !important;
}
.mc-controls .mc-ctl:hover{ background: rgba(255,255,255,.10) !important; }
.mc-controls .mc-ctl:active{ transform: translateY(1px) scale(.99) !important; }

/* Keep PiP top-right */
#localVideo{
  right:12px !important;
  top:12px !important;
}

/* Idle fade (use mc-callbody.mc-idle-ui) */
.mc-callbody.mc-idle-ui .mc-controls,
.mc-callbody.mc-idle-ui .mc-sideactions{
  opacity:.08 !important;
  transform: scale(.985) !important;
  transform-origin: left top !important;
}
.mc-callbody.mc-idle-ui .mc-controls{
  transform: translateX(-50%) scale(.985) !important;
  transform-origin: center bottom !important;
}

/* Light theme */
html[data-theme="light"] .mc-controls{
  background: rgba(255,255,255,.78) !important;
  border-color: rgba(18,18,22,.14) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,.12) !important;
}
html[data-theme="light"] .mc-controls .mc-ctl{
  background: rgba(18,18,22,.04) !important;
  border-color: rgba(18,18,22,.14) !important;
  color: rgba(18,18,22,.88) !important;
}
#mcCallBody.mc-mode-video #stage{ display:block !important; }

.mc-uabtn.mc-uacall{ background: rgba(120,180,255,.16); border-color: rgba(120,180,255,.26); }
.mc-uabtn.mc-uavideo{ background: rgba(255,180,120,.14); border-color: rgba(255,180,120,.24); }

html[data-theme="light"] .mc-uabtn.mc-uacall{
  background: rgba(80,120,255,.16);
  border-color: rgba(80,120,255,.22);
}
html[data-theme="light"] .mc-uabtn.mc-uavideo{
  background: rgba(255,140,80,.14);
  border-color: rgba(255,140,80,.22);
}

/* Make the user list feel like the main page */
#mcCallBody.mc-mode-presence #mcUserList{
  padding-top: 6px;
}
