:root {
  color-scheme: dark;
  --bg: #0f1417;
  --panel: #182024;
  --panel-2: #202a2f;
  --line: #334044;
  --text: #f5f7f7;
  --muted: #aab6b9;
  --accent: #2fbf9b;
  --accent-2: #5e9cff;
  --warn: #f0b84f;
  --danger: #ef6a62;
  --danger-strong: #d83b36;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
.network-popover {
  -webkit-user-select: text;
  user-select: text;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button:hover {
  border-color: var(--accent);
  background-color: #263238;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.participant:focus-visible,
.video-tile:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #061411;
  font-weight: 700;
}

button.danger {
  background: var(--danger-strong);
  border-color: #ff8b84;
  color: #fff7f6;
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(216, 59, 54, 0.28), 0 0 18px rgba(216, 59, 54, 0.16);
}

button.sharing {
  background: #12483d;
  border-color: #55d9b7;
  color: #72e2c4;
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(47, 191, 155, 0.3), 0 0 18px rgba(47, 191, 155, 0.2);
}

button.active {
  background: #153c35;
  border-color: var(--accent);
}

button.ptt-active {
  background: #12483d;
  border-color: #55d9b7;
  color: #72e2c4;
  font-weight: 800;
  box-shadow: inset 0 0 0 2px #9cf3dc, 0 0 0 2px rgba(47, 191, 155, 0.55), 0 0 22px rgba(47, 191, 155, 0.3);
}

#muteButton.danger,
#menuMuteButton.danger {
  background: #12483d;
  border-color: #55d9b7;
  color: #72e2c4;
  box-shadow: 0 0 0 1px rgba(47, 191, 155, 0.3), 0 0 18px rgba(47, 191, 155, 0.2);
}

#pttButton,
#menuPttButton {
  touch-action: none;
  -webkit-touch-callout: none;
}

.icon-control {
  padding: 0;
}

.control-icon,
.status-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: block;
  position: relative;
  background-color: currentColor;
  -webkit-mask-image: var(--icon-url);
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-image: var(--icon-url);
  mask-position: center;
  mask-size: contain;
  mask-repeat: no-repeat;
}

.icon-camera { --icon-url: url("icons/camera.svg"); }
.icon-camera-off { --icon-url: url("icons/camera-off.svg"); }
.icon-switch-camera { --icon-url: url("icons/switch-camera.svg"); }
.icon-hand { --icon-url: url("icons/hand.svg"); }
.icon-screen-share { --icon-url: url("icons/screen-share.svg"); }
.icon-screen-share-off { --icon-url: url("icons/screen-share-off.svg"); }
.icon-ptt-up { --icon-url: url("icons/ptt-up.svg"); }
.icon-ptt-down { --icon-url: url("icons/ptt-down.svg"); }
.icon-terminal { --icon-url: url("icons/square-terminal.svg"); }
.icon-mic { --icon-url: url("icons/mic.svg"); }
.icon-mic-off { --icon-url: url("icons/mic-off.svg"); }
.icon-check { --icon-url: url("icons/check.svg"); }
.icon-clock { --icon-url: url("icons/clock.svg"); }
.icon-settings { --icon-url: url("icons/settings.svg"); }

.icon-mic-off {
  color: #ff7770;
}

.icon-mic,
.icon-check,
.status-indicator.camera-live .status-icon,
.status-indicator.share-live .status-icon,
button.sharing .control-icon,
button.ptt-active .control-icon,
#muteButton.danger .control-icon,
#menuMuteButton.danger .control-icon {
  color: #55d9b7;
}

.icon-control.has-slashed-icon {
  position: relative;
}

.icon-control.has-slashed-icon::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 34px;
  top: 50%;
  left: 50%;
  border-radius: 3px;
  background: currentColor;
  box-shadow: 0 0 0 1px rgba(10, 14, 16, 0.8);
  transform: translate(-50%, -50%) rotate(-43deg);
  pointer-events: none;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c1113;
  color: var(--text);
  padding: 0 10px;
}

input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.hidden {
  display: none !important;
}

.mobile-only {
  display: none !important;
}

.minimal-utilities {
  display: contents;
}

.web-client .desktop-server-field,
.web-client .desktop-password-save {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(47, 191, 155, 0.14), transparent 36%),
    linear-gradient(315deg, rgba(94, 156, 255, 0.12), transparent 42%),
    var(--bg);
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 32, 36, 0.94);
}

.login-panel h1 {
  margin: 0;
  font-size: 28px;
}

.login-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.server-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.remember-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.check-label {
  display: inline-flex !important;
  grid-template-columns: none !important;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px !important;
}

.error {
  color: #ffbbb6;
  min-height: 20px;
}

.room-view {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bg);
}

.topbar {
  position: relative;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  grid-template-rows: auto;
  gap: 5px;
  align-items: center;
  min-height: 34px;
  padding: 2px 5px;
  border-bottom: 1px solid var(--line);
  background: #11181b;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.brand strong {
  font-size: 13px;
}

.brand span {
  color: var(--muted);
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
}

.view-controls,
.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.top-actions {
  justify-content: flex-start;
  gap: 3px;
  flex-wrap: nowrap;
}

.view-controls {
  position: relative;
  justify-self: end;
}

.view-controls > span {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.view-controls select {
  color: transparent;
}

.view-controls option {
  color: var(--text);
}

.network-health-wrap {
  position: relative;
}

.network-health {
  width: 30px;
  height: 30px;
  min-height: 30px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #182024;
}

.network-health span {
  width: 4px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
}

.network-health span:nth-child(1) { height: 6px; }
.network-health span:nth-child(2) { height: 11px; }
.network-health span:nth-child(3) { height: 17px; }
.network-health.good { color: var(--accent); }
.network-health.connecting { color: var(--warn); }
.network-health.poor { color: var(--danger); }

.mobile-network-button {
  place-items: center !important;
  color: var(--warn);
}

.mobile-network-button .network-bars {
  width: 18px;
  height: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}

.mobile-network-button .network-bars > span {
  width: 4px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
}

.mobile-network-button .network-bars > span:nth-child(1) { height: 8px; }
.mobile-network-button .network-bars > span:nth-child(2) { height: 15px; }
.mobile-network-button .network-bars > span:nth-child(3) { height: 22px; }
.mobile-network-button.good { color: var(--accent); }
.mobile-network-button.connecting { color: var(--warn); }
.mobile-network-button.poor { color: var(--danger); }

.network-popover {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 40;
  width: min(440px, calc(100vw - 16px));
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(20, 28, 32, 0.97);
  color: var(--text);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.45);
}

.ticket-count {
  width: 50px;
  height: 30px;
  min-height: 30px;
  display: grid;
  grid-template-rows: 17px 8px;
  place-items: center;
  padding: 1px 5px;
  border-color: #286b59;
  background: #132b25;
}

.ticket-count strong { color: #bdf7e8; font-size: 16px; line-height: 1; }
.ticket-count span { color: var(--muted); font-size: 7px; text-transform: uppercase; }
.ticket-count.ticket-error { border-color: #824440; }
.ticket-count.has-tickets strong { color: #ff6b66; }

.network-popover > span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.network-popover > strong {
  font-size: 17px;
}

.network-popover dl {
  display: grid;
  gap: 7px;
  margin: 5px 0 0;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.network-popover dl div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 12px;
  line-height: 1.35;
}

.network-popover dt {
  color: #dffdf6;
  font-weight: 700;
}

.network-popover dd {
  margin: 0;
  color: var(--muted);
}

.network-media-details {
  margin-top: 2px;
  padding: 10px;
  border-top: 1px solid var(--line);
  border-radius: 4px;
  background: #0d1316;
  white-space: pre-line;
}

#retryMediaButton {
  min-height: 32px;
  margin-top: 2px;
}

#retryMediaButton.attention {
  border-color: var(--warn);
  color: #ffe5a8;
}

.room-footer {
  min-width: 0;
  padding: 3px 4px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: #11181b;
}

.room-footer .control-group {
  flex: 0 0 auto;
  min-height: 60px;
}

.room-footer .top-actions button,
.room-footer .top-actions select,
.room-footer #muteButton,
.room-footer #pttButton,
.room-footer #handRaiseButton,
.room-footer #brbButton,
.room-footer #lunchButton,
.room-footer #cameraButton,
.room-footer #screenButton,
.room-footer #popoutButton,
.room-footer #audioSettingsButton,
.room-footer #consoleButton,
.room-footer #logoutButton {
  width: 60px;
  height: 60px;
  min-height: 60px;
  flex: 0 0 60px;
  padding: 5px;
  overflow: hidden;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
}

.status-state-source {
  display: none !important;
}

.room-footer .icon-button {
  font-size: 23px;
}

.room-footer .icon-control .control-icon {
  width: 30px;
  height: 30px;
}

#brbButton.active,
#lunchButton.active,
#menuBrbButton.active,
#menuLunchButton.active {
  border-color: var(--warn);
  background: #3a311d;
  color: #ffe5a8;
}

#brbButton,
#lunchButton {
  padding-left: 2px !important;
  padding-right: 2px !important;
  font-size: 15px;
  font-weight: 700;
}

#brbButton.showing-available,
#lunchButton.showing-available {
  font-size: 11px;
}

.console-glyph {
  position: relative;
  width: 29px;
  height: 23px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.console-glyph::before {
  content: ">_";
  position: absolute;
  left: 3px;
  bottom: 2px;
  font-family: Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.console-glyph::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 3px;
  width: 8px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
}

.control-group {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.control-group + .control-group {
  padding-left: 5px;
  border-left: 1px solid var(--line);
}

.top-actions button {
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  line-height: 1;
  white-space: nowrap;
}

.view-controls select {
  width: 104px;
  height: 30px;
  min-height: 30px;
}

#screenButton {
  width: 100px;
  height: 36px;
  min-height: 36px;
  padding: 0 8px;
  white-space: nowrap;
}

#popoutButton {
  width: 80px;
}

.top-actions #popoutButton.hidden {
  display: none !important;
}

#pttButton {
  width: 52px;
}

#statusSelect {
  width: 112px;
  height: 36px;
  min-height: 36px;
  padding: 0 8px;
}

#muteButton {
  width: 82px;
}

#logoutButton {
  width: 76px;
}

#audioSettingsButton {
  width: 40px;
  padding: 0;
  font-size: 21px;
}

#audioSettingsButton .control-icon {
  width: 34px;
  height: 34px;
}

#mobileSettingsButton .control-icon {
  width: 29px;
  height: 29px;
}

#cameraButton {
  width: 108px;
  height: 36px;
  min-height: 36px;
  white-space: nowrap;
}

.camera-confirm-panel {
  width: min(680px, calc(100vw - 32px));
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.camera-confirm-panel video {
  grid-row: 2;
  min-height: 0;
  height: 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: contain;
  background: #050708;
}

.camera-confirm-panel .camera-permission-help { grid-row: 2; }
.camera-confirm-panel .camera-confirm-actions { grid-row: 3; }

.room-view.view-mobile .camera-confirm-panel > header {
  min-height: 40px;
  padding: 4px 8px 4px 12px;
}

.room-view.view-mobile .camera-confirm-panel > header h2 { font-size: 15px; }

.room-view.view-mobile .camera-confirm-panel > header button {
  width: 34px;
  height: 32px;
  min-height: 32px;
  font-size: 19px;
}

.camera-permission-help {
  min-height: 240px;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 28px;
  background: #11181b;
  text-align: center;
}

.camera-permission-help strong {
  color: #ffd4d0;
  font-size: 18px;
}

.camera-permission-help p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.camera-permission-help code {
  max-width: 560px;
  padding: 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1012;
  color: #d9ecfa;
  font-family: Consolas, monospace;
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
}

.support-message-panel {
  width: min(560px, 100%);
  height: auto;
}

.support-message-body {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.support-message-body strong {
  font-size: 18px;
}

.support-message-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.support-message-body code {
  padding: 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1012;
  color: #d9ecfa;
  font-size: 12px;
}

.mobile-visual-popout {
  z-index: 40;
  padding: 0;
  background: #050708;
}

.mobile-visual-panel {
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: #050708;
}

.mobile-visual-panel header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: max(8px, env(safe-area-inset-top)) 10px 8px 14px;
  border-bottom: 1px solid var(--line);
  background: #11181b;
}

.mobile-visual-panel header > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-visual-panel header button {
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 24px;
}

.mobile-visual-panel main {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.mobile-visual-panel video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050708;
}

.mobile-visual-panel #mobileVisualEmpty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.camera-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.camera-preview-switch {
  width: 48px;
  min-height: 44px;
  place-items: center;
  margin-right: auto;
  padding: 0;
}

.camera-preview-switch .control-icon {
  width: 29px;
  height: 29px;
}

.mobile-permissions {
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #11181b;
}

.mobile-permissions h3 {
  margin: 0;
}

.permission-state-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.permission-state-grid > div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 6px;
  background: #182125;
}

.permission-state-grid span {
  color: var(--muted);
  font-size: 12px;
}

.permission-state-grid strong[data-state="granted"] { color: #55d9b7; }
.permission-state-grid strong[data-state="prompt"] { color: #ffe5a8; }
.permission-state-grid strong[data-state="denied"] { color: #ff8b84; }
.permission-state-grid strong[data-state="unknown"] { color: var(--muted); }

.permission-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.permission-actions button {
  min-width: 0;
  min-height: 48px;
  height: auto;
  padding: 8px;
  white-space: normal;
}

.permission-action-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.permission-help-panel {
  width: min(520px, calc(100vw - 24px));
}

.permission-help-body {
  display: grid;
  gap: 14px;
  padding: 18px;
  overflow: auto;
}

.permission-help-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.content {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
}

.participants-wrap {
  min-height: 0;
  overflow: auto;
  background: linear-gradient(180deg, #12191c, #101619);
}

.participants {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
}

.participant {
  width: fit-content;
  min-width: 208px;
  max-width: 310px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #1a2327, var(--panel));
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.participant:hover {
  border-color: #516166;
  background: #1d282c;
}

.participant.active-speaker {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(47, 191, 155, 0.36);
}

.participant.is-selected {
  border-color: var(--warn);
  background: #25251f;
  box-shadow: inset 0 0 0 1px rgba(240, 184, 79, 0.5), 0 0 0 1px rgba(240, 184, 79, 0.2);
}

.room-view.density-minimal .participant.is-selected {
  border-color: #66d9bd;
  background: #1d2d2d;
  box-shadow: inset 0 0 0 1px rgba(102, 217, 189, 0.5), 0 0 0 1px rgba(102, 217, 189, 0.18);
}

.participant.is-brb .avatar {
  box-shadow: inset 0 0 0 2px rgba(240, 184, 79, 0.7);
}

.participant-main {
  display: grid;
  grid-template-columns: 42px minmax(112px, max-content);
  gap: 10px;
  align-items: center;
}

.avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--avatar-bg, #2d4f54);
  color: #dffdf6;
  font-weight: 800;
}

.avatar-color-0 { --avatar-bg: #2d6a63; }
.avatar-color-1 { --avatar-bg: #3767a6; }
.avatar-color-2 { --avatar-bg: #8a4f72; }
.avatar-color-3 { --avatar-bg: #8a5d2f; }
.avatar-color-4 { --avatar-bg: #4f6f35; }
.avatar-color-5 { --avatar-bg: #7656a5; }
.avatar-color-6 { --avatar-bg: #9a4545; }
.avatar-color-7 { --avatar-bg: #356f83; }

.participant.active-speaker .avatar::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 191, 155, 0.24);
}

.participant-name {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #283338;
  color: var(--muted);
  font-size: 12px;
}

.pill.status-brb {
  background: #3a3120;
  color: #ffe0a6;
}

.pill.status-lunch {
  background: #243a59;
  color: #d7e7ff;
}

.pill.muted {
  background: #3a2425;
  color: #ffd4d0;
}

.pill.mic-live {
  background: #163b33;
  color: #bdf7e8;
}

.pill.camera-live {
  background: #243a59;
  color: #cfe1ff;
}

.pill.share-live {
  background: #4a2430;
  color: #ffd7df;
}

.participant-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.screen-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: #0a0e10;
}

.video-stage {
  display: none;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  background: #0a0e10;
}

.room-view.view-video.no-share .screen-stage {
  display: none;
}

.room-view.view-video .screen-stage {
  display: none;
}

.room-view.view-video .participants-wrap {
  display: none;
}

.room-view.view-video.no-share .video-stage {
  display: block;
  grid-row: 1;
}

.room-view.view-video.has-share .video-stage {
  display: block;
  grid-row: 1;
}

.video-grid {
  width: 100%;
  height: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  align-content: start;
  gap: 12px;
}

.video-grid[data-count="1"],
.video-grid[data-count="2"],
.video-grid[data-count="3"],
.video-grid[data-count="4"] {
  height: 100%;
}

.video-grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.video-grid[data-count="2"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.video-grid[data-count="3"],
.video-grid[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.video-grid[data-count="1"] .video-tile,
.video-grid[data-count="2"] .video-tile,
.video-grid[data-count="3"] .video-tile,
.video-grid[data-count="4"] .video-tile { aspect-ratio: auto; }

.video-tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 16 / 10;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11181b;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.video-tile.active-speaker {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(47, 191, 155, 0.35);
}

.video-tile.is-selected {
  border-color: var(--warn);
  box-shadow: inset 0 0 0 1px rgba(240, 184, 79, 0.55), 0 0 0 1px rgba(240, 184, 79, 0.2);
}

.video-media {
  position: absolute;
  inset: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #080c0e;
}

.video-tile .video-media > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain !important;
  object-position: center;
  background: #050708;
}

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

.video-tile video.screen-visual {
  object-fit: contain;
}

.video-avatar {
  width: 76px;
  height: 76px;
  position: absolute;
  inset: calc(50% - 10px) auto auto 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--avatar-bg, #2d4f54);
  color: #dffdf6;
  font-size: 24px;
  font-weight: 800;
}

.video-info {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 4;
  min-width: 0;
  width: fit-content;
  max-width: calc(100% - 20px);
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-shadow: 0 1px 3px #000, 0 0 5px #000;
  pointer-events: none;
}

.video-identity {
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.video-name {
  max-width: 240px;
  flex: 0 1 auto;
  overflow: hidden;
  padding: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-meta {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.video-meta .pill {
  min-width: 38px;
  min-height: 38px;
  justify-content: center;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(17, 25, 29, 0.88);
}

.status-indicator .status-icon {
  width: 27px;
  height: 27px;
}

.status-indicator-text {
  margin-left: 5px;
  font-size: 13px;
  font-weight: 800;
}

.video-popout {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 34px;
  height: 34px;
  min-height: 34px;
  flex: 0 0 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.hand-raise-indicator {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 6;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #ffd983;
  border-radius: 6px;
  background: rgba(50, 39, 14, 0.92);
  font-size: 23px;
  line-height: 1;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.38);
}

.hand-raised > .hand-raise-indicator {
  display: grid;
}

.speaker-meter {
  --speaker-level: 0;
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: block;
  border-radius: 50%;
  opacity: 0;
  background: conic-gradient(var(--accent) calc(var(--speaker-level) * 1turn), rgba(255,255,255,0.12) 0);
  box-shadow: 0 2px 12px rgba(0,0,0,0.42);
  transition: opacity 120ms ease;
  pointer-events: none;
}

.speaker-meter::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #11181b;
}

.speaker-meter.visible { opacity: 1; }
.hand-raised > .speaker-meter { left: 58px; }
.participant .speaker-meter { width: 32px; height: 32px; top: 8px; right: 8px; left: auto; }

.video-meta .status-available {
  min-width: 38px;
  justify-content: center;
  color: #bdf7e8;
  font-weight: 900;
}

.video-popout.active {
  border-color: var(--accent);
  color: #bdf7e8;
}

html.broadcast-popout,
html.broadcast-popout body {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: #050708;
  color: #f5f7f7;
  font-family: "Segoe UI", Arial, sans-serif;
}

html.broadcast-popout *,
html.broadcast-popout *::before,
html.broadcast-popout *::after {
  box-sizing: border-box;
}

html.broadcast-popout body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

html.broadcast-popout header {
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  overflow: hidden;
  background: #11181b;
  border-bottom: 1px solid #334044;
}

html.broadcast-popout header > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.broadcast-popout .popout-actions { display: flex; gap: 7px; }

html.broadcast-popout button {
  min-height: 28px;
  border: 1px solid #334044;
  border-radius: 6px;
  background: #202a2f;
  color: #f5f7f7;
}

html.broadcast-popout main {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

html.broadcast-popout video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  background: #050708;
}

html.broadcast-popout #empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #aab6b9;
}

html.broadcast-popout #kind {
  color: #aab6b9;
  font-size: 12px;
}

.visual-kind {
  position: absolute;
  left: auto;
  right: 9px;
  bottom: 9px;
  padding: 4px 7px;
  border-radius: 5px;
  background: rgba(5, 8, 10, 0.78);
  color: var(--muted);
  font-size: 11px;
}

.visual-capture {
  position: absolute;
  top: 10px;
  right: 54px;
  z-index: 6;
  min-height: 34px;
  padding: 0 10px;
  background: rgba(17, 25, 29, 0.88);
}

.live-camera-quality {
  position: absolute;
  top: 10px;
  right: 54px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(17, 25, 29, 0.9);
  color: var(--muted);
  font-size: 10px;
}

.live-camera-quality select {
  width: 66px;
  min-height: 28px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 11px;
}

.video-idle {
  position: absolute;
  top: calc(50% + 48px);
  color: var(--muted);
  font-size: 12px;
}

.video-pending {
  position: absolute;
  left: 50%;
  top: calc(50% + 54px);
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .video-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 350px) {
  .web-client .minimal-utilities { gap: 5px; right: 6px; }
  .web-client .minimal-utility,
  .web-client .minimal-expand { width: 42px; height: 44px; min-height: 44px; }
  .web-client .room-view.view-mobile .ticket-count { width: 60px; height: 44px; min-height: 44px; }
}

.room-view.no-share .screen-stage {
  display: none;
}

.room-view.has-share.view-people .screen-stage {
  display: none;
}

.room-view.has-share.view-people .participants {
  display: flex;
}

.room-view.density-minimal {
  min-width: 0;
  font-size: 17px;
  grid-template-rows: 1fr;
}

.room-view.density-minimal .room-footer {
  display: none;
}

.room-view.density-minimal .topbar {
  display: none;
}

.room-view.density-minimal .content {
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr;
}

.room-view.density-minimal .participants-wrap {
  position: relative;
  display: block;
  grid-row: 1;
  grid-column: 1;
}

.room-view.density-minimal .participants {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: stretch;
  align-items: stretch;
  gap: 14px;
  bottom: calc(33.333vh + 8px);
  padding: 14px 86px 10px 14px;
}

.room-view.density-minimal .participant {
  flex: 1 1 360px;
  width: auto;
  min-width: 280px;
  max-width: 560px;
  min-height: 0;
  gap: 0;
  align-content: center;
  padding: 18px 20px;
  border-radius: 8px;
  background: #172024;
}

.room-view.density-minimal:not(.view-mobile) .ticket-count {
  order: -1;
  flex: 0 0 210px;
  width: 210px;
  height: auto;
  min-height: 0;
  align-self: stretch;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 24px 14px;
  border-radius: 8px;
}

.room-view.density-minimal:not(.view-mobile) .ticket-count strong { font-size: 82px; }
.room-view.density-minimal:not(.view-mobile) .ticket-count span { font-size: 18px; }

.room-view.density-minimal .participant.is-selected {
  border-color: #f0b84f;
  outline: 1px solid rgba(240, 184, 79, 0.9);
  outline-offset: -3px;
  background: #2b281f;
  box-shadow: 0 0 0 1px rgba(240, 184, 79, 0.3);
}

.room-view.density-minimal .participant-main {
  grid-template-columns: 104px minmax(180px, 1fr);
  gap: 20px;
}

.room-view.density-minimal .avatar {
  width: 104px;
  height: 104px;
  border-radius: 8px;
  font-size: 26px;
}

.room-view.density-minimal .participant-meta {
  margin-top: 1px;
  gap: 8px;
}

.room-view.density-minimal .participant-meta .status-indicator {
  min-width: 64px;
  min-height: 64px;
  justify-content: center;
  padding: 0 10px;
  border-radius: 6px;
}

.room-view.density-minimal .participant-meta .status-icon {
  width: 50px;
  height: 50px;
}

.room-view.density-minimal .participant-meta .status-indicator-text {
  font-size: 20px;
}

.room-view.density-minimal .participant-name {
  max-width: 430px;
  font-size: 30px;
  line-height: 1.15;
}

.room-view.density-minimal:not(.view-mobile) .participant .speaker-meter {
  width: 64px;
  height: 64px;
  top: 14px;
  right: 14px;
}

.room-view.density-minimal .screen-stage {
  display: none;
}

.room-view.density-minimal .video-stage {
  display: none;
}

.room-view.view-video.density-minimal .video-stage,
.room-view.view-video.no-share.density-minimal .video-stage,
.room-view.view-video.has-share.density-minimal .video-stage {
  display: none;
}

.web-client .room-view.view-mobile .participants-wrap {
  display: none;
}

.web-client .room-view.view-mobile .video-stage,
.web-client .room-view.view-mobile.no-share .video-stage,
.web-client .room-view.view-mobile.has-share .video-stage {
  display: block;
}

.minimal-expand {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 6;
  width: 56px;
  height: 56px;
  min-height: 56px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 7px;
  background: #202a2f;
  font-size: 28px;
  line-height: 1;
}

.participant-menu {
  position: fixed;
  z-index: 8;
  min-width: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #151d21;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.room-view:not(.density-minimal) .participant-menu {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  background: rgba(13, 19, 22, 0.56);
  border-color: rgba(102, 121, 127, 0.55);
  backdrop-filter: blur(7px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

.room-view:not(.density-minimal) .participant-menu button {
  flex: 1 1 82px;
  opacity: 0.68;
  background: rgba(28, 38, 43, 0.72);
  transition: opacity 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.room-view:not(.density-minimal) .participant-menu button:hover,
.room-view:not(.density-minimal) .participant-menu button:focus-visible {
  opacity: 1;
  background: #263238;
}

.participant-menu button {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  text-align: left;
  white-space: nowrap;
}

.participant-volume {
  min-width: 190px;
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) 40px;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(28, 38, 43, 0.86);
  color: var(--text);
  font-size: 12px;
}
.participant-volume input { min-width: 80px; }
.participant-volume output { text-align: right; color: var(--muted); }

.camera-quality-control {
  min-width: 132px;
  display: grid;
  grid-template-columns: auto 68px;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(28, 38, 43, 0.86);
  color: var(--text);
  font-size: 12px;
}

.camera-quality-control select { min-width: 0; min-height: 30px; padding: 0 5px; }

#menuMuteButton {
  width: 76px;
}

#menuPttButton {
  width: 52px;
}

#menuDirectButton {
  width: 72px;
}

#menuCameraButton {
  width: 104px;
}

#menuShareButton {
  width: 104px;
}

#menuBrbButton {
  width: 82px;
}

#menuLunchButton {
  width: 82px;
}

#menuHandButton {
  width: 96px;
}

#menuConsoleButton {
  width: 90px;
}

.console-panel {
  width: min(720px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 32px));
}

.console-panel header > div:first-child {
  display: grid;
  gap: 3px;
}

.console-panel header span {
  color: var(--muted);
  font-size: 12px;
}

.console-header-actions {
  display: flex;
  gap: 7px;
}

.console-header-actions button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 20px;
}

.console-events {
  min-height: 0;
  overflow-y: auto;
  padding: 8px 16px 16px;
}

.console-event {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid rgba(51, 64, 68, 0.72);
}

.console-event-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #202a2f;
  color: var(--accent);
  font-size: 17px;
}

.console-event > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.console-event strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.console-event time,
.console-empty {
  color: var(--muted);
  font-size: 12px;
}

.console-empty {
  padding: 28px 4px;
  text-align: center;
}

.room-view:not(.density-minimal) .toast {
  bottom: 92px;
}

.participant-menu button:disabled {
  opacity: 0.52;
  cursor: default;
}

.screen-empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
}

.screen-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050708;
}

.screen-label {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(8, 12, 14, 0.78);
  color: var(--text);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1a2226;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
  z-index: 20;
  pointer-events: none;
}

.room-view.density-minimal .toast {
  left: 12px;
  right: 62px;
  top: 12px;
  bottom: auto;
  max-width: none;
  padding: 9px 12px;
  font-size: 13px;
}

.room-view.density-minimal.has-toast .content {
  padding-top: 58px;
}

.room-view.density-minimal.has-toast .participants {
  padding-top: 72px;
}

.room-view.density-minimal .participant-menu {
  grid-template-rows: minmax(0, 1fr);
  grid-auto-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  padding: 10px;
}

.room-view.density-minimal .participant-menu button {
  width: auto !important;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 8px 12px;
  overflow: hidden;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
  overflow-wrap: normal;
}

.room-view.density-minimal .participant-volume {
  min-width: 270px;
  height: 100%;
  grid-template-columns: auto minmax(100px, 1fr) 58px;
  padding: 12px;
  font-size: 22px;
}

.room-view.density-minimal .camera-quality-control {
  min-width: 180px;
  height: 100%;
  grid-template-columns: auto minmax(72px, 1fr);
  padding: 10px;
  font-size: 20px;
}

.room-view.density-minimal .camera-quality-control select { min-height: 52px; font-size: 18px; }

.room-view.density-minimal:not(.view-mobile) .participant-menu .control-icon {
  width: 62px;
  height: 62px;
}

.room-view.has-direct:not(.density-minimal) .toast {
  bottom: 76px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.64);
}

.modal-panel {
  width: min(880px, 100%);
  max-height: min(720px, 90vh);
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.modal-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-panel h2 {
  margin: 0;
  font-size: 18px;
}

.audio-settings-panel {
  width: min(620px, 100%);
  max-height: calc(100vh - 24px);
}

.audio-settings-body {
  display: grid;
  gap: 16px;
  padding: 16px;
  overflow: auto;
}

.audio-settings-body h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hotkey-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

.hotkey-field input {
  cursor: pointer;
}

.hotkey-field .icon-button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 20px;
}

.settings-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.save-feedback {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #151d21;
  font-size: 15px;
  font-weight: 700;
}

.save-feedback.saving {
  border-color: #5e7890;
  background: #1b2932;
  color: #d9ecfa;
}

.save-feedback.success {
  border-color: var(--accent);
  background: #153c35;
  color: #c8fff1;
  box-shadow: 0 0 0 1px rgba(47, 191, 155, 0.2);
}

.save-feedback.error {
  border-color: var(--danger);
  background: #3a2425;
  color: #ffd4d0;
}

.account-actions .save-feedback {
  min-width: 0;
  flex: 1 1 auto;
  margin-right: auto;
}

.audio-settings-body label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.audio-meter {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0b1012;
}

.audio-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 80ms linear;
}

.audio-test-row {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-test-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.call-prompt {
  width: min(460px, 100%);
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.takeover-prompt {
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.takeover-prompt h2,
.takeover-prompt p {
  margin: 0 0 7px;
}

.takeover-prompt p {
  color: var(--muted);
  line-height: 1.45;
}

.takeover-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--warn);
  color: #1b1305;
  font-size: 24px;
  font-weight: 800;
}

.call-prompt h2,
.call-prompt p {
  margin: 0 0 6px;
}

.call-prompt-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #061411;
  font-size: 24px;
  font-weight: 800;
}

.call-countdown {
  color: var(--muted);
  font-size: 12px;
}

.call-prompt-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.direct-call-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 12;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 8px 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #14231f;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
}

.direct-call-bar div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.direct-call-bar span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-view.density-minimal .direct-call-bar {
  left: 12px;
  right: 12px;
  bottom: auto;
  min-height: 56px;
}

.screen-sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 12px;
  overflow: auto;
}

#screenPicker .modal-panel { grid-template-rows: auto auto minmax(0, 1fr); }

.screen-source-type {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 0;
  color: var(--muted);
}
.screen-source-type select { min-width: 140px; min-height: 36px; }
.screen-source-empty { color: var(--muted); padding: 18px; }

.force-mute-panel {
  width: min(560px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
  border: 2px solid var(--danger);
  border-radius: 8px;
  background: #241718;
  box-shadow: 0 24px 90px rgba(0,0,0,0.68);
}
.force-mute-icon { width: 64px; height: 64px; color: var(--danger); }
.force-mute-panel h2 { margin: 2px 0 8px; font-size: 24px; }
.force-mute-panel p { margin: 0; color: #ffd8d5; }
.force-mute-panel button { grid-column: 1 / -1; min-height: 46px; }

.source-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11181b;
  padding: 8px;
  text-align: left;
}

.source-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 5px;
  background: #050708;
}

.source-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-sink {
  display: none;
}

@media (max-width: 850px) {
  .room-view.density-minimal .participant {
    min-height: 104px;
    padding: 12px;
  }

  .room-view.density-minimal .participant-main {
    grid-template-columns: 52px minmax(140px, 1fr);
    gap: 10px;
  }

  .room-view.density-minimal .avatar {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }

  .room-view.density-minimal .participant-name {
    font-size: 18px;
  }

  .room-view.density-minimal .pill {
    min-height: 24px;
    padding: 0 7px;
    font-size: 12px;
  }

  .room-view.density-minimal .participant-menu {
    gap: 6px;
    padding: 8px;
  }

  .room-view.density-minimal .participant-menu button {
    min-height: 72px;
    padding: 0 4px;
    font-size: 14px;
  }

  .room-view.density-minimal .top-actions {
    grid-template-columns: 84px 1fr auto auto auto;
  }

  .room-view.density-minimal .participants-wrap {
    max-height: none;
    border-bottom: 0;
  }

  .content {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .participants-wrap {
    grid-column: auto;
    grid-row: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 260px;
  }
}

@media (max-width: 700px) {
  html.web-client,
  html.web-client body {
    width: 100%;
    min-width: 0;
    min-height: 100%;
  }

  html.web-client body {
    min-height: 100dvh;
    overflow-x: hidden;
    overscroll-behavior: none;
  }

  .web-client .login-view {
    min-height: 100dvh;
    place-items: start center;
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .web-client .login-panel {
    margin: auto 0;
    gap: 16px;
    padding: 20px 18px;
  }

  .web-client .login-panel input,
  .web-client .login-panel button {
    min-height: 48px;
  }

  .web-client .room-view {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .web-client .topbar {
    position: relative;
    z-index: 5;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 10px 10px;
  }

  .web-client .view-controls select {
    width: 116px;
    min-height: 44px;
  }

  .web-client .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .web-client .control-group {
    width: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .web-client .control-group + .control-group {
    padding: 8px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .web-client .top-actions button,
  .web-client .top-actions select,
  .web-client #muteButton,
  .web-client #pttButton,
  .web-client #statusSelect,
  .web-client #cameraButton,
  .web-client #screenButton,
  .web-client #popoutButton,
  .web-client #audioSettingsButton,
  .web-client #logoutButton {
    width: 100%;
    height: 48px;
    min-height: 48px;
    padding: 0 8px;
  }

  .web-client .utility-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .web-client .content {
    min-height: 0;
    overflow: hidden;
  }

  .web-client .video-stage,
  .web-client .participants-wrap {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .web-client .video-stage {
    padding: 8px;
  }

  .web-client .video-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .web-client .video-tile {
    width: 100%;
    aspect-ratio: 16 / 10;
  }

  .web-client .video-info {
    min-height: 68px;
    padding: 9px;
  }

  .web-client .video-name {
    font-size: 15px;
  }

  .web-client .video-meta .pill {
    min-width: 36px;
    min-height: 36px;
    padding: 0 6px;
    font-size: 13px;
  }

  .web-client .video-meta .status-icon {
    width: 26px;
    height: 26px;
  }

  .web-client .participant-menu {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    width: auto;
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-columns: unset;
    gap: 8px;
    padding: 8px;
  }

  .web-client .participant-menu button {
    width: 100% !important;
    min-width: 0;
    min-height: 52px;
    padding: 6px;
    justify-content: center;
    text-align: center;
    white-space: normal;
  }

  .web-client .modal {
    place-items: stretch;
    padding: 0;
  }

  .web-client .modal-panel,
  .web-client .audio-settings-panel,
  .web-client .camera-confirm-panel {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    height: 100dvh;
    border-width: 0;
    border-radius: 0;
  }

  .web-client .support-message-panel {
    height: 100dvh;
  }

  .web-client .support-message-body {
    align-content: center;
    padding: 24px 18px max(24px, env(safe-area-inset-bottom));
  }

  .web-client .modal-panel header {
    padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  }

  .web-client .modal-panel header button {
    width: 44px;
    min-height: 44px;
    padding: 0;
    font-size: 24px;
  }

  .web-client .audio-settings-body {
    gap: 18px;
    padding: 16px 14px max(20px, env(safe-area-inset-bottom));
  }

  .web-client .settings-grid,
  .web-client .account-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .web-client .audio-settings-body input:not([type="checkbox"]):not([type="range"]),
  .web-client .audio-settings-body select,
  .web-client .audio-settings-body button {
    min-height: 48px;
  }

  .web-client .settings-footer,
  .web-client .settings-footer.account-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .web-client .settings-footer button {
    width: 100%;
  }

  .web-client .account-actions .save-feedback {
    width: 100%;
  }

  .web-client .call-prompt,
  .web-client .takeover-prompt {
    width: calc(100% - 24px);
    align-self: center;
    margin: auto;
  }

  .web-client .call-prompt-actions button,
  .web-client .takeover-actions button,
  .web-client .direct-call-bar button {
    min-height: 48px;
  }

  .web-client .toast {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    max-width: none;
  }

  .web-client .direct-call-bar {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
  }

  .web-client .screen-sources {
    grid-template-columns: minmax(0, 1fr);
  }

  .web-client .room-view.view-mobile {
    height: 100dvh;
    font-size: 16px;
  }

  .web-client .room-view.view-mobile .content {
    position: absolute;
    inset: 0;
    overflow: hidden;
  }

  .web-client .room-view.view-mobile .video-stage {
    position: absolute;
    inset: 0 0 190px;
    padding: max(72px, calc(env(safe-area-inset-top) + 64px)) 10px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .web-client .room-view.view-mobile .video-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    height: auto;
    gap: 10px;
  }

  .web-client .room-view.view-mobile .video-tile {
    width: 100%;
    height: 170px;
    aspect-ratio: auto;
  }

  .web-client .room-view.view-mobile .video-tile.is-self {
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: 0 5px 18px rgba(0,0,0,0.44);
  }

  .web-client .room-view.view-mobile .video-tile video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
  }

  .web-client .room-view.view-mobile .video-info {
    min-height: 0;
    max-width: calc(100% - 16px);
    left: 8px;
    bottom: 8px;
    padding: 0;
  }

  .web-client .room-view.view-mobile .video-popout {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .web-client .room-view.view-mobile .video-avatar {
    width: 50px;
    height: 50px;
    inset: 50% auto auto 50%;
    font-size: 19px;
  }

  .web-client .room-view.view-mobile .video-idle,
  .web-client .room-view.view-mobile .video-pending {
    display: none;
  }

  .web-client .room-view.view-mobile .participants {
    position: absolute;
    inset: 0 0 190px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 10px;
    padding: max(72px, calc(env(safe-area-inset-top) + 64px)) 10px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .web-client .room-view.view-mobile.has-toast .participants {
    padding-top: max(72px, calc(env(safe-area-inset-top) + 64px));
  }

  .web-client .room-view.view-mobile .participant {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 96px;
    padding: 12px;
  }

  .web-client .room-view.view-mobile .participant-main {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
  }

  .web-client .room-view.view-mobile .avatar {
    width: 58px;
    height: 58px;
    font-size: 20px;
  }

  .web-client .room-view.view-mobile .participant-name {
    max-width: 100%;
    font-size: 20px;
  }

  .web-client .room-view.view-mobile .pill {
    min-height: 26px;
    padding: 0 7px;
    font-size: 12px;
  }

  .web-client .room-view.view-mobile .video-meta .pill {
    min-width: 36px;
    min-height: 36px;
    padding: 0 6px;
  }

  .web-client .room-view.view-mobile .video-meta .status-icon {
    width: 26px;
    height: 26px;
  }

  .web-client .minimal-utilities {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    z-index: 10;
    display: flex;
    gap: 8px;
  }

  .web-client .room-view.view-mobile .ticket-count {
    width: 68px;
    height: 48px;
    min-height: 48px;
    grid-template-rows: 27px 11px;
  }

  .web-client .room-view.view-mobile .mobile-only {
    display: grid !important;
  }

  .web-client .room-view.view-mobile .network-health-wrap {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block !important;
    pointer-events: none;
  }

  .web-client .room-view.view-mobile #networkHealth {
    display: none;
  }

  .web-client .room-view.view-mobile > .network-popover {
    position: fixed;
    top: max(68px, calc(env(safe-area-inset-top) + 58px));
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100dvh - 84px - env(safe-area-inset-top));
    overflow-y: auto;
    pointer-events: auto;
  }

  .web-client .minimal-utility,
  .web-client .minimal-expand {
    position: static;
    width: 48px;
    height: 48px;
    min-height: 48px;
    place-items: center;
    padding: 0;
    font-size: 23px;
  }

  .web-client .room-view.view-mobile #minimalExpandButton,
  .web-client .room-view.view-mobile #menuShareButton,
  .web-client .room-view.view-mobile #menuConsoleButton {
    display: none !important;
  }

  .web-client .room-view.view-mobile .minimal-utility .control-icon {
    width: 25px;
    height: 25px;
  }

  .web-client .room-view.view-mobile .participant-menu {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: minmax(64px, auto);
    grid-auto-columns: unset;
    align-items: stretch;
    max-height: 242px;
    overflow-y: auto;
  }

  .web-client .room-view.view-mobile .participant-menu button {
    min-height: 64px;
    height: auto;
    padding: 6px;
    font-size: 17px;
    line-height: 1.1;
  }

  .web-client .room-view.view-mobile .participant-menu .control-icon {
    width: 34px;
    height: 34px;
  }

  .web-client .room-view.view-mobile .toast {
    left: 10px;
    right: 10px;
    top: max(68px, calc(env(safe-area-inset-top) + 58px));
    bottom: auto;
    padding: 8px 10px;
  }

  .web-client .room-view.view-mobile .direct-call-bar {
    top: auto !important;
    left: 8px !important;
    right: 8px !important;
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 156px) !important;
  }
}

@media (orientation: landscape) and (max-height: 700px) {
  .web-client .room-view.view-mobile .mobile-only { display: grid !important; }

  .web-client .room-view.view-mobile .minimal-utilities {
    position: fixed;
    top: max(6px, env(safe-area-inset-top));
    right: 8px;
    z-index: 10;
    display: flex;
    gap: 6px;
  }

  .web-client .room-view.view-mobile .minimal-utility {
    position: static;
    width: 44px;
    height: 44px;
    min-height: 44px;
    place-items: center;
    padding: 0;
  }

  .web-client .room-view.view-mobile .ticket-count {
    width: 60px;
    height: 44px;
    min-height: 44px;
  }

  .web-client .room-view.view-mobile .camera-confirm-panel {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 30vw);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .web-client .room-view.view-mobile .camera-confirm-panel > header {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .web-client .room-view.view-mobile .camera-confirm-panel > video,
  .web-client .room-view.view-mobile .camera-confirm-panel > .camera-permission-help {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
    object-fit: contain;
  }

  .web-client .room-view.view-mobile .camera-confirm-panel > .camera-confirm-actions {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    padding: 12px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .web-client .room-view.view-mobile .camera-confirm-panel > .camera-confirm-actions button {
    width: 100%;
    min-height: 48px;
    margin: 0;
  }

  .web-client .room-view.view-mobile.local-camera-live .video-stage,
  .web-client .room-view.view-mobile.local-camera-live.no-share .video-stage,
  .web-client .room-view.view-mobile.local-camera-live.has-share .video-stage {
    position: absolute;
    inset: max(56px, calc(env(safe-area-inset-top) + 52px)) min(270px, 32vw) 8px 8px;
    padding: 0;
    overflow: auto;
  }

  .web-client .room-view.view-mobile.local-camera-live .video-grid {
    width: 100%;
    height: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .web-client .room-view.view-mobile.local-camera-live .video-tile {
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .web-client .room-view.view-mobile.local-camera-live .video-tile.is-self {
    position: relative;
    top: auto;
    grid-column: 1 / -1;
  }

  .web-client .room-view.view-mobile.local-camera-live .participant-menu {
    left: auto !important;
    right: 8px !important;
    top: max(56px, calc(env(safe-area-inset-top) + 52px)) !important;
    bottom: 8px !important;
    width: calc(min(270px, 32vw) - 16px) !important;
    max-width: none !important;
    max-height: none;
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-columns: unset;
    grid-auto-rows: minmax(0, 1fr);
    gap: 6px;
    padding: 6px;
    overflow-y: auto;
  }

  .web-client .room-view.view-mobile.local-camera-live .participant-menu button {
    min-height: 52px;
  }

  .web-client .room-view.view-mobile.local-camera-live .camera-quality-control {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    height: auto;
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 5px;
    font-size: 12px;
    text-align: center;
  }

  .web-client .room-view.view-mobile.local-camera-live .camera-quality-control select {
    width: 100%;
    min-height: 34px;
    font-size: 13px;
  }

  .web-client .room-view.view-mobile .participants {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .web-client .room-view.view-mobile .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .web-client .room-view.view-mobile .video-tile {
    height: 154px;
  }
}

@media (max-width: 700px) {
  .web-client .room-view.view-mobile .video-stage,
  .web-client .room-view.view-mobile .participants {
    bottom: 170px;
  }

  .web-client .room-view.view-mobile .video-info {
    position: absolute;
    left: 8px;
    bottom: 8px;
    min-height: 0;
    max-width: calc(100% - 62px);
    padding: 0;
  }

  .web-client .room-view.view-mobile .video-popout {
    position: absolute;
    top: 8px;
    right: 8px;
  }
}
