/* The room is a canvas with a floating dock. All media/drag containers stay intact. */
#app > .shell.in-call {
  --room-top-space: 86px;
  --room-bottom-space: 112px;
  position: relative;
  width: calc(100% - 28px);
  max-width: none;
  height: calc(100dvh - 28px);
  min-height: 0;
  margin: 14px;
  padding: 0;
  overflow: hidden;
  border-radius: 32px;
}
.in-call > .ux-topbar {
  position: absolute;
  top: 18px;
  left: 22px;
  right: 22px;
  z-index: 35;
  margin: 0;
  pointer-events: none;
}
.in-call > .ux-topbar > * { pointer-events: auto; }
.in-call > .ux-topbar {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  grid-template-areas: "account summary brand";
  column-gap: 20px;
  row-gap: 4px;
}
.in-call > .ux-topbar > .header-right { grid-area: account; justify-self: start; margin: 0; border-radius: 999px !important; padding: 6px 8px !important; }
.in-call > .ux-topbar > .brand { grid-area: brand; justify-self: end; margin: 0; padding: 5px 60px 5px 0 !important; background: transparent !important; border: 0; box-shadow: none; }
.in-call > .ux-topbar > .brand > .sg-pane { display: none !important; }
.in-call .room-call-summary {
  grid-area: summary;
  place-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  max-width: min(440px,38vw);
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid rgba(232,245,255,.24);
  border-radius: 999px;
  background: linear-gradient(135deg,rgba(255,255,255,.12),rgba(255,255,255,.025)),rgba(11,25,44,.35);
  box-shadow: 0 12px 32px rgba(0,0,0,.15),inset 0 1px 0 rgba(255,255,255,.16);
  backdrop-filter: blur(16px) saturate(1.12);
  -webkit-backdrop-filter: blur(16px) saturate(1.12);
}
.in-call .room-call-summary .calls-header-context { display: block; flex: 0 1 auto; order: 0; min-width: 0; max-width: 180px; margin: 0; padding: 0; }
.in-call .room-call-summary .calls-header-title { display: block; margin: 0; font-size: 14px; line-height: 1.25; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.in-call .ux-topbar .header-right > .calls-cabinet-entry { padding: 8px 11px; font-size: 11px; min-height: 36px; border-radius: 999px; }
.in-call .room-call-summary .call-meta { display: flex; flex: 0 1 auto; flex-wrap: nowrap; align-items: center; min-width: 0; font-size: 11px; line-height: 1.3; margin: 0; gap: 8px; padding: 0 0 0 12px; border-left: 1px solid rgba(232,245,255,.18); }
.in-call .room-call-summary #duration { flex: none; min-width: 3.5ch; padding: 4px 7px; font-size: 11px; font-variant-numeric: tabular-nums; border: 0; border-radius: 999px; }
.in-call .room-call-summary #connection-state { display: block; width: auto; height: auto; min-width: 0; max-width: none; font-size: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.in-call .room-call-summary #connection-state::before { content: none; display: none; }
.in-call .room-call-summary #recording-state { flex: none; width: auto; height: auto; min-width: 0; min-height: 0; max-width: 15ch; padding: 4px 7px; border-radius: 999px; font-size: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body:has(.in-call) #toast { top: 108px; bottom: auto; pointer-events: none; }
.in-call > .call-area {
  position: absolute;
  inset: 0;
  display: block;
  min-height: 0;
  padding: 0;
}
.in-call .call-content {
  position: absolute;
  inset: var(--room-top-space) 16px var(--room-bottom-space);
  display: block;
  min-height: 0;
  min-width: 0;
  padding: 0;
  margin: 0;
}
.in-call .calls-stage-wrap {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 27px;
}
.in-call .stage,
.in-call .stage.calls-overlay-layout {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  margin: 0;
  border-radius: 27px;
}
.in-call .stage.grid { gap: 10px; background: transparent; }
.in-call .stage.grid > .tile { min-height: 0; border-radius: 24px; }
.in-call .stage.calls-overlay-layout > .calls-primary { border-radius: 27px; }
.in-call .shared-content { border-radius: 27px; }
.in-call .shared-content > video { object-fit: contain; }
.in-call .stage:has(.shared-content:not([hidden]))::after { display: none; }
.in-call .calls-stage-actions { top: 16px; right: 16px; }

/* Secondary panels float above the canvas without shifting participant coordinates. */
.in-call #side-panel:not([hidden]) {
  position: absolute;
  inset: 12px 12px 12px auto;
  z-index: 32;
  width: min(350px,calc(100% - 24px));
  height: auto;
  min-height: 0;
  max-height: none;
  border-radius: 24px;
  background: linear-gradient(135deg,#ffffff0b,#ffffff02),#14283ef5;
  box-shadow: 0 20px 70px #0007,inset 0 1px 0 #ffffff26;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.in-call #side-panel .panel-head { padding: 18px; }
.in-call #side-panel .panel-body { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.in-call #side-panel .panel-head h2 { font-size: 19px; font-weight: 500; }
.in-call .calls-audio-notice:not([hidden]) {
  position: absolute;
  top: calc(var(--room-top-space) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 38;
  width: min(620px,calc(100% - 48px));
  margin: 0;
  box-shadow: 0 12px 40px #0006;
}
.in-call .calls-whisper-notice:not([hidden]) {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 26;
  width: min(530px,calc(100% - 28px));
  max-height: min(40%,230px);
  overflow: auto;
  box-shadow: 0 12px 40px #0006;
}

@media (max-width:800px) {
  .in-call > .ux-topbar { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "account brand" "summary summary"; column-gap: 10px; row-gap: 6px; }
  .in-call .room-call-summary { width: max-content; max-width: 100%; min-height: 32px; padding: 5px 12px; gap: 10px; }
  .in-call .room-call-summary .calls-header-context { max-width: 35vw; }
  .in-call .room-call-summary .calls-header-title { font-size: 11px; }
  .in-call .ux-topbar .header-right > .calls-cabinet-entry { display: none; }
  .in-call > .ux-topbar > .brand { padding: 0 !important; }
  .in-call > .ux-topbar > .header-right { justify-self: start; padding: 3px 5px !important; }
  .in-call .room-call-summary .call-meta { font-size: 9px; gap: 6px; padding-left: 10px; }
  .in-call .room-call-summary #duration { padding: 2px 4px; font-size: 9px; }
  .in-call .room-call-summary #recording-state { max-width: 10ch; font-size: 9px; }
}
/* A readable, stable dock: devices, conversation, More, leave. */
.in-call .toolbar.room-dock {
  position: absolute;
  z-index: 45;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex !important;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  width: auto;
  max-width: calc(100% - 44px);
  gap: 5px !important;
  margin: 0;
  padding: 9px;
  border-radius: 999px;
  overflow: visible;
  box-shadow: 0 18px 55px #0007,inset 0 1px 0 #ffffff38;
}
.in-call .room-dock > .tool,
.in-call .room-dock .room-more-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  min-width: 62px;
  height: 62px;
  min-height: 62px;
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 5px;
  border-radius: 999px;
  gap: 6px;
}
.in-call .room-dock > .tool > .icon,
.in-call .room-dock .room-more-toggle > .icon { width: 22px; height: 22px; }
.in-call .room-dock .room-more-toggle > .icon { fill: currentColor; stroke: none; }
.in-call .room-dock > .tool span,
.in-call .room-dock .room-more-toggle span { font-size: 10px; line-height: 1.2; white-space: nowrap; }
.in-call .room-dock [data-action="mic"] { order: 10; }
.in-call .room-dock [data-action="camera"] { order: 20; }
.in-call .room-dock [data-action="screen"] { order: 30; }
.in-call .room-dock [data-action="translation"] { order: 40; }
.in-call .room-dock [data-action="chat"] { order: 50; }
.in-call .room-dock [data-action="people"] { order: 60; }
.in-call .room-dock > .room-more { order: 70; }
.in-call .room-dock > [data-action="leave"] {
  order: 80;
  margin-left: 5px;
  width: 76px;
  color: #fff;
  border-color: #ffb2c34d;
  background: linear-gradient(135deg,#cf4c69,#9e2e48);
  box-shadow: inset 0 1px 0 #ffffff24;
}
.in-call .room-dock > [data-action="translation"] {
  color: #c5e5ff;
  background: #80bbff13;
  border-color: #c2e1ff2e;
}
.in-call .room-dock > [data-action][aria-expanded="true"],
.in-call .room-dock .room-more-toggle[aria-expanded="true"] {
  color: #eaf6ff;
  background: linear-gradient(135deg,#7dbfff38,#3589e724);
  border-color: #b1dbff8c;
}
.in-call .room-dock .tool:focus-visible { outline: 2px solid #b2deff; outline-offset: 3px; }

.in-call .room-more { position: relative; flex: 0 0 auto; }
.in-call .room-more-menu {
  position: absolute;
  z-index: 60;
  right: 0;
  bottom: calc(100% + 16px);
  width: 258px;
  max-width: calc(100vw - 30px);
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 22px;
  border-color: #d4eaff4d;
  background: #152b41f5;
  box-shadow: 0 20px 60px #0007,inset 0 1px 0 #ffffff24;
}
.in-call .room-more-menu[hidden] { display: none !important; }
.in-call .room-more-menu .sg-pane { opacity: .24; }
.in-call .toolbar .room-more-menu > .room-more-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  height: auto;
  padding: 12px 14px;
  margin: 0;
  gap: 13px;
  border-radius: 14px;
  text-align: left;
}
.in-call .toolbar .room-more-menu > .room-more-item span { font-size: 13px; line-height: 1.35; white-space: normal; }
.in-call .toolbar .room-more-menu > .room-more-item > .icon { width: 20px; height: 20px; flex: none; }

/* Help is an ordinary menu action during a call; its original dialog handler stays. */
html.calls-matte body .in-call .toolbar .room-more-menu > .cg-launch.room-help {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: auto !important;
  min-height: 46px !important;
  max-height: none !important;
  padding: 12px 14px !important;
  margin: 0 !important;
  gap: 13px !important;
  border: 1px solid transparent !important;
  border-radius: 14px !important;
  color: #e9f2fa !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  transform: none;
}
html.calls-matte body .in-call .toolbar .room-more-menu > .cg-launch.room-help:hover { background: rgba(255,255,255,.07) !important; border-color: rgba(232,245,255,.2) !important; }
html.calls-matte body .in-call .toolbar .room-more-menu > .cg-launch.room-help::after { content: none !important; display: none !important; }
.in-call .room-help .cg-launch-label { display: inline !important; position: static !important; width: auto !important; height: auto !important; clip-path: none !important; overflow: visible !important; font-size: 13px !important; }
.in-call .room-help .cg-launch-icon { display: block; width: 20px; height: 20px; flex: none; }

/* Shared-screen expansion keeps the same dock and a safe drawing rectangle. */
.share-expanded .in-call .calls-stage-wrap,
.share-expanded.in-call .calls-stage-wrap {
  position: relative;
  inset: auto;
  z-index: auto;
  width: 100%;
  height: 100%;
}
.share-expanded .in-call .shared-content,
.share-expanded.in-call .shared-content { inset: 0; }
html:fullscreen #app > .shell.in-call { width: 100%; height: 100dvh; margin: 0; border-radius: 0; }

@media (max-width: 1050px) and (min-width: 801px) {
  .in-call .room-dock > .tool,
  .in-call .room-dock .room-more-toggle { width: 64px; min-width: 58px; }
  .in-call .room-dock > [data-action="leave"] { width: 68px; }
}
@media (max-width: 800px) {
  #app > .shell.in-call {
    --room-top-space: calc(110px + env(safe-area-inset-top,0px));
    --room-bottom-space: calc(160px + env(safe-area-inset-bottom,0px));
    width: 100%;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
  }
  .in-call > .ux-topbar {
    inset: max(12px,env(safe-area-inset-top)) 14px auto;
  }
  .in-call .call-content { left: 10px; right: 10px; }
  .in-call .stage,
  .in-call .stage.calls-overlay-layout,
  .in-call .calls-stage-wrap,
  .in-call .shared-content { border-radius: 22px; }
  .in-call .stage.grid { gap: 7px; }
  .in-call .stage.grid > .tile { border-radius: 18px; }
  .in-call .toolbar.room-dock {
    display: grid !important;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 4px !important;
    width: min(510px,calc(100% - 28px));
    max-width: none;
    bottom: max(12px,env(safe-area-inset-bottom));
    padding: 8px;
    border-radius: 36px;
  }
  .in-call .room-dock > .tool,
  .in-call .room-dock .room-more-toggle,
  .in-call .room-dock > [data-action="leave"] {
    width: 100%;
    min-width: 0;
    height: 55px;
    min-height: 55px;
    margin: 0;
    padding: 7px 3px;
    border-radius: 999px;
    grid-column: auto;
  }
  .in-call .room-more { display: block; min-width: 0; }
  .in-call .room-dock > .tool span,
  .in-call .room-dock .room-more-toggle span { font-size: 10px; }
  .in-call .room-more-menu { bottom: calc(100% + 12px); width: 250px; }
  .in-call #side-panel:not([hidden]) { inset: 8px; width: auto; border-radius: 21px; }
  .in-call .calls-stage-actions { top: 12px; right: 12px; }
  .in-call .calls-stage-actions > button { width: 34px !important; min-width: 34px !important; height: 34px !important; min-height: 34px !important; flex-basis: 34px !important; }
  .in-call .calls-audio-notice:not([hidden]) { width: calc(100% - 36px); }
}
@media (max-height: 650px) and (min-width: 801px) {
  #app > .shell.in-call { --room-top-space: 76px; --room-bottom-space: 98px; }
  .in-call > .ux-topbar { top: 12px; }
  .in-call .toolbar.room-dock { bottom: 14px; padding: 7px; }
  .in-call .room-dock > .tool,
  .in-call .room-dock .room-more-toggle { height: 56px; min-height: 56px; }
}
@media (max-width: 800px) and (max-height: 560px) and (orientation: landscape) {
  #app > .shell.in-call { --room-top-space: 76px; --room-bottom-space: 90px; }
  .in-call > .ux-topbar { grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); grid-template-areas: "account summary brand"; gap: 8px; }
  .in-call .room-call-summary { max-width: 34vw; }
  .in-call .room-call-summary .calls-header-context { max-width: 10vw; }
  .in-call .toolbar.room-dock { display: flex !important; width: calc(100% - 24px); gap: 2px !important; padding: 6px; bottom: 8px; }
  .in-call .room-dock > .tool,
  .in-call .room-dock > .room-more { flex: 1 1 0; min-width: 0; }
  .in-call .room-dock > .tool,
  .in-call .room-dock .room-more-toggle { height: 54px; min-height: 54px; }
  .in-call .room-dock > .tool span,
  .in-call .room-dock .room-more-toggle span { font-size: 9px; }
}
@media (prefers-reduced-transparency: reduce) {
  .in-call #side-panel:not([hidden]),
  .in-call .room-more-menu,
  .in-call .room-call-summary { background: #192d43 !important; backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Keep the room's outer margin inside the viewport-height app container. */
#app:has(> .shell.in-call) { display: flow-root; }
body:has(> #app > .shell.in-call)::before { content: none; }

/* Mobile full screen is a video-only presentation state, independent of the
 * native Fullscreen API. The existing stage, streams and share nodes stay put. */
html.calls-video-focus,
html.calls-video-focus body {
  overflow: hidden !important;
  overscroll-behavior: none;
}
html.calls-video-focus body { background: #000 !important; }
html.calls-video-focus body::before,
html.calls-video-focus body::after { content: none !important; }
html.calls-video-focus #app { min-height: 0; height: 100dvh; overflow: hidden; }
html.calls-video-focus #app > .shell.in-call.room-video-focus {
  --room-top-space: 0px;
  --room-bottom-space: 0px;
  position: fixed !important;
  top: var(--calls-video-focus-top, 0px) !important;
  left: var(--calls-video-focus-left, 0px) !important;
  right: auto !important;
  bottom: auto !important;
  width: var(--calls-video-focus-width, 100%) !important;
  height: var(--calls-video-focus-height, 100dvh) !important;
  min-height: 0 !important;
  max-width: none;
  max-height: none;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #000 !important;
  z-index: 1000;
}
html.calls-video-focus .room-video-focus :is(.call-area, .call-content, .calls-stage-wrap) {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}
html.calls-video-focus .room-video-focus #call-stage {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #000 !important;
  --calls-control-space: 0px;
}
html.calls-video-focus .room-video-focus #call-stage::before,
html.calls-video-focus .room-video-focus #call-stage::after { content: none !important; }
html.calls-video-focus .room-video-focus #call-stage > :is(.calls-primary, .shared-content):not([hidden]) {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}
html.calls-video-focus .room-video-focus #call-stage.grid { gap: 4px; }
html.calls-video-focus .room-video-focus #call-stage.grid > .tile { border: 0 !important; border-radius: 0 !important; }
html.calls-video-focus .room-video-focus #call-stage video { background: #000; }
/* Hide chrome at every boundary, including late external widget insertion.
 * visibility keeps audio/video elements and their playback lifetime intact. */
html.calls-video-focus body > :not(#app),
html.calls-video-focus body > :not(#app) *,
html.calls-video-focus #app > :not(.room-video-focus),
html.calls-video-focus #app > :not(.room-video-focus) *,
html.calls-video-focus .room-video-focus > :not(.call-area),
html.calls-video-focus .room-video-focus > :not(.call-area) *,
html.calls-video-focus .room-video-focus .call-area > :not(.call-content),
html.calls-video-focus .room-video-focus .call-area > :not(.call-content) *,
html.calls-video-focus .room-video-focus .call-content > :not(.calls-stage-wrap),
html.calls-video-focus .room-video-focus .call-content > :not(.calls-stage-wrap) *,
html.calls-video-focus .room-video-focus .calls-stage-wrap > :not(#call-stage):not(.room-video-focus-exit),
html.calls-video-focus .room-video-focus .calls-stage-wrap > :not(#call-stage):not(.room-video-focus-exit) *,
html.calls-video-focus .room-video-focus #call-stage > :not(.tile):not(.shared-content):not(.camera-off),
html.calls-video-focus .room-video-focus #call-stage > :not(.tile):not(.shared-content):not(.camera-off) *,
html.calls-video-focus .room-video-focus #call-stage > .tile > :not(video):not(.camera-off),
html.calls-video-focus .room-video-focus #call-stage > .tile > :not(video):not(.camera-off) *,
html.calls-video-focus .room-video-focus #call-stage > .shared-content > :not(video),
html.calls-video-focus .room-video-focus #call-stage > .shared-content > :not(video) * {
  visibility: hidden !important;
  pointer-events: none !important;
}
html.calls-video-focus .room-video-focus .room-video-focus-exit {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: grid;
  align-content: start;
  justify-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.room-video-focus-exit > span {
  max-width: 100%;
  padding: 9px 13px;
  border: 1px solid #ffffff38;
  border-radius: 999px;
  background: #101820b8;
  font: 400 13px/1.4 system-ui, sans-serif;
  text-align: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity .35s ease;
}
.room-video-focus-exit.hint-dismissed > span { opacity: 0; }
.room-video-focus-exit:focus-visible { outline: 2px solid #b2deff; outline-offset: -4px; }
.room-video-focus-exit:focus-visible > span { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .room-video-focus-exit > span { transition: none; }
}
