.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: url("/icons/icon.svg") center / contain no-repeat;
  flex: 0 0 auto;
}

.settings-avatar-button {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.settings-avatar-button {
  width: 72px;
  height: 72px;
}

.settings-avatar-button:focus-visible {
  outline: 3px solid rgba(78, 161, 255, 0.36);
  outline-offset: 3px;
}

.profile-avatar-preview {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  color: #06120d;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0;
  background:
    linear-gradient(135deg, rgba(38, 208, 124, 0.95), rgba(78, 161, 255, 0.92)),
    #26d07c;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.profile-avatar-preview.large {
  width: 72px;
  height: 72px;
  font-size: 24px;
}

.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.brand-copy {
  display: grid;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.brand-copy strong,
#roomLabel {
  grid-column: 1;
}

#roomLabel {
  display: block;
  max-width: 54vw;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-button,
.status-badge,
.primary-button,
.control-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.danger-button {
  color: #fff3f3;
  border-color: rgba(255, 107, 107, 0.42);
}

.danger-button:not(:disabled):hover {
  border-color: rgba(255, 107, 107, 0.72);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.primary-button,
.icon-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button-icon,
.control-icon {
  display: block;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

.icon-button .button-icon,
.tile-action .button-icon {
  width: 20px;
  height: 20px;
}

.recent-room-icon-button .button-icon {
  width: 17px;
  height: 17px;
}

.icon-link {
  --icon-url: url("/icons/ui/link.svg");
}

.icon-settings {
  --icon-url: url("/icons/ui/settings.svg");
}

.icon-paperclip {
  --icon-url: url("/icons/ui/paperclip.svg");
}

.icon-smile {
  --icon-url: url("/icons/ui/smile.svg");
}

.icon-send {
  --icon-url: url("/icons/ui/send.svg");
}

.icon-x {
  --icon-url: url("/icons/ui/x.svg");
}

.icon-maximize-2 {
  --icon-url: url("/icons/ui/maximize-2.svg");
}

.icon-minimize-2 {
  --icon-url: url("/icons/ui/minimize-2.svg");
}

.icon-minus {
  --icon-url: url("/icons/ui/minus.svg");
}

.icon-rotate-ccw {
  --icon-url: url("/icons/ui/rotate-ccw.svg");
}

.icon-trash-2 {
  --icon-url: url("/icons/ui/trash-2.svg");
}

.icon-pin {
  --icon-url: url("/icons/ui/pin.svg");
}

.icon-pin-off {
  --icon-url: url("/icons/ui/pin-off.svg");
}

.icon-panel-right-open {
  --icon-url: url("/icons/ui/panel-right-open.svg");
}

.icon-panel-right-close {
  --icon-url: url("/icons/ui/panel-right-close.svg");
}

.button-icon.icon-mic {
  --icon-url: url("/icons/ui/mic.svg");
}

.icon-mic-off {
  --icon-url: url("/icons/ui/mic-off.svg");
}

.status-badge {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
}

.status-badge[data-state="online"] {
  color: #08130d;
  background: var(--green);
  border-color: var(--green);
}

.status-badge[data-state="connecting"] {
  color: #1b1202;
  background: var(--amber);
  border-color: var(--amber);
}

.toast {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 45;
  width: max-content;
  max-width: min(280px, calc(100vw - 32px));
  padding: 9px 12px;
  color: #06120d;
  background: var(--green);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px);
  transition: opacity 160ms ease, transform 160ms ease;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.manual-copy-popover {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 120;
  display: grid;
  gap: 9px;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px;
  color: var(--text);
  background: rgba(13, 18, 26, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.manual-copy-popover input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  color: var(--text);
  background: #0e141c;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
}

.manual-copy-popover .ghost-button {
  min-height: 38px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.video-tile {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05070a;
  box-shadow: var(--shadow);
  --zoom: 1;
  --pan-x: 0px;
  --pan-y: 0px;
}

.video-tile.is-pip {
  cursor: grab;
}

.video-tile video {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  grid-row: 1;
  object-fit: contain;
  object-position: center center;
  background: #05070a;
  transform: translate(var(--pan-x), var(--pan-y)) scale(var(--zoom));
  transform-origin: center center;
  will-change: transform;
}

.focus-layout .video-tile {
  min-height: 0;
}

.focus-layout .video-tile.is-featured {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.focus-layout .video-tile.is-featured video {
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.focus-layout .video-tile.is-pip {
  position: absolute;
  right: 18px;
  bottom: var(--pip-offset, 18px);
  z-index: 4;
  width: clamp(168px, 22vw, 280px);
  aspect-ratio: 16 / 9;
  min-height: 0;
  border-color: rgba(78, 161, 255, 0.48);
  touch-action: none;
  user-select: none;
}

.focus-layout .video-tile.is-pip.is-dragging {
  cursor: grabbing;
  z-index: 8;
}

.focus-layout .video-tile.is-pip.is-resizing {
  cursor: nwse-resize;
  z-index: 9;
}

.focus-layout .video-tile.is-pip video {
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.video-tile.is-hidden-tile {
  display: none;
}

.video-tile[data-state="connecting"] video {
  opacity: 0.42;
}

.video-tile::before {
  content: attr(data-placeholder);
  position: absolute;
  inset: 0 0 48px;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 24px;
  text-align: center;
  pointer-events: none;
}

.video-tile.has-video::before {
  content: "";
}

.tile-action {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--text);
  background: rgba(8, 12, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.tile-action:hover {
  background: rgba(28, 36, 48, 0.92);
}

.expand-button {
  top: 10px;
  left: 10px;
  font-size: 18px;
  line-height: 1;
}

.hide-button {
  top: 10px;
  left: 56px;
  font-size: 22px;
  line-height: 1;
}

.hide-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.zoom-reset-button {
  top: 56px;
  left: 10px;
  display: none;
  font-size: 18px;
  line-height: 1;
}

.tile-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: none;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 0 45%, rgba(255, 255, 255, 0.74) 45% 55%, transparent 55% 100%);
  border: 0;
  border-radius: 0 0 8px 0;
  opacity: 0.78;
}

.focus-layout .video-tile.is-pip .tile-resize-handle {
  display: block;
}

.tile-resize-handle:hover {
  opacity: 1;
}

.hidden-tile-dock {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(420px, calc(100% - 36px));
  pointer-events: auto;
}

.hidden-tile-dock[hidden] {
  display: none;
}

.hidden-tile-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
  background: rgba(8, 12, 18, 0.84);
  border: 1px solid rgba(78, 161, 255, 0.58);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hidden-tile-button:hover {
  background: rgba(28, 36, 48, 0.95);
}

.video-tile.is-fullscreen .zoom-reset-button,
.video-tile:fullscreen .zoom-reset-button {
  display: grid;
}

.video-tile.is-fullscreen.is-zoomed,
.video-tile:fullscreen.is-zoomed {
  cursor: grab;
}

.video-tile.is-panning,
.video-tile.is-panning video {
  cursor: grabbing;
}

.tile-footer {
  position: relative;
  z-index: 3;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  margin: 8px 10px 10px;
  padding: 6px 9px;
  color: var(--text);
  background: rgba(8, 12, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.tile-footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-footer span:last-child {
  color: var(--muted);
  flex: 0 0 auto;
}

.room-lobby-heading {
  display: grid;
  gap: 8px;
}

.room-lobby-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.12;
}

.room-lobby-heading p,
.recent-room-empty {
  margin: 0;
  color: var(--muted);
}

.room-lobby-form label,
.join-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.recent-rooms {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.recent-room-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.recent-room-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  background: #101720;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.recent-room-card.is-pinned {
  border-color: rgba(38, 208, 124, 0.62);
}

.recent-room-main {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 0;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
}

.recent-room-main strong,
.recent-room-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-room-main small {
  color: var(--muted);
  font-size: 12px;
}

.recent-room-actions {
  display: flex;
  gap: 6px;
}

.recent-room-icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 17px;
  line-height: 1;
}

.recent-room-card:hover,
.recent-room-icon-button:hover {
  border-color: rgba(78, 161, 255, 0.72);
}

.recent-room-icon-button.danger:hover {
  color: #fff3f3;
  border-color: rgba(255, 107, 107, 0.72);
}

.settings-panel {
  padding: 12px;
  background: rgba(13, 18, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-panel summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  list-style: none;
}

.settings-panel summary::-webkit-details-marker {
  display: none;
}

.settings-panel summary::after {
  content: "";
  float: right;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}

.settings-panel[open] summary {
  margin-bottom: 12px;
}

.settings-panel[open] summary::after {
  margin-top: 8px;
  transform: rotate(225deg);
}

.settings-dialog {
  width: min(460px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 28px));
  max-height: min(620px, calc(100svh - 28px));
  padding: 0;
  color: var(--text);
  background: rgba(13, 18, 26, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-dialog:not([open]) {
  display: none;
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.settings-dialog-card {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.settings-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-dialog-header h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.settings-dialog-header .icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.settings-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #0e141c;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.profile-name-field {
  min-width: 0;
}

.profile-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.profile-avatar-input {
  display: none;
}

.avatar-crop-dialog {
  width: min(390px, calc(100vw - 24px));
  padding: 0;
  color: var(--text);
  background: rgba(13, 18, 26, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.avatar-crop-dialog:not([open]) {
  display: none;
}

.avatar-crop-dialog::backdrop {
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(4px);
}

.avatar-crop-card {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.avatar-crop-frame {
  position: relative;
  width: min(300px, calc(100vw - 70px));
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  touch-action: none;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.06) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.06) 75%),
    #070b10;
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: grab;
}

.avatar-crop-frame:active {
  cursor: grabbing;
}

.avatar-crop-frame img {
  position: absolute;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.avatar-crop-circle {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 74%;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(0, 0, 0, 0.44) inset;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.avatar-crop-card input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.avatar-crop-actions {
  display: grid;
}

.settings-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.settings-toggle {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  color: var(--text);
  background: #0e141c;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.settings-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-toggle-box {
  position: relative;
  width: 42px;
  height: 24px;
  background: rgba(238, 242, 248, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.settings-toggle-box::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 160ms ease, background-color 160ms ease;
}

.settings-toggle input:checked + .settings-toggle-box {
  background: rgba(38, 208, 124, 0.24);
  border-color: rgba(38, 208, 124, 0.72);
}

.settings-toggle input:checked + .settings-toggle-box::after {
  background: var(--green);
  transform: translateX(18px);
}

.settings-toggle input:focus-visible + .settings-toggle-box {
  box-shadow: 0 0 0 3px rgba(78, 161, 255, 0.18);
}

.settings-toggle-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.settings-toggle-copy strong {
  font-size: 13px;
}

.settings-toggle-copy small {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
}

.room-lobby-form input,
.join-form input,
.settings-grid input:not([type="range"]):not([type="file"]),
.settings-grid select {
  width: 100%;
  min-height: 42px;
  color: var(--text);
  background: #0e141c;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  padding: 0 12px;
}

.settings-grid select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.room-lobby-form input:focus,
.join-form input:focus,
.settings-grid input:not([type="range"]):not([type="file"]):focus,
.settings-grid select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(78, 161, 255, 0.18);
}

.settings-grid select:disabled {
  color: rgba(238, 242, 248, 0.42);
  cursor: not-allowed;
}

.primary-button {
  color: #06120d;
  background: var(--green);
  font-weight: 700;
}

.compact-join-form {
  display: none;
}

.stage-controls {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  --stage-controls-y: 0px;
  grid-template-columns: repeat(3, 52px);
  width: auto;
  padding: 8px;
  background: rgba(8, 12, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transform: translate(-50%, var(--stage-controls-y));
  transition: opacity 160ms ease, transform 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .stage:not(:hover):not(:focus-within) .stage-controls {
    --stage-controls-y: 10px;
    opacity: 0;
    pointer-events: none;
  }
}

.control-button {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 62px;
  padding: 0;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.stage-controls .control-button {
  width: 52px;
  min-height: 48px;
}

.control-button.is-media-on,
.control-button.screen-toggle.is-active {
  color: #06120d;
  background: var(--green);
  border-color: var(--green);
}

.control-button.is-media-off {
  color: #fff3f3;
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.72);
}

.control-button.screen-toggle:not(.is-active) {
  color: var(--text);
  background: var(--panel-strong);
  border-color: var(--line);
}

.control-button.danger {
  color: #fff3f3;
  border-color: rgba(255, 107, 107, 0.42);
}

.control-icon {
  width: 28px;
  height: 28px;
}

.icon-mic {
  --icon-url: url("/icons/ui/mic-off.svg");
}

.control-button.is-media-on .icon-mic {
  --icon-url: url("/icons/ui/mic.svg");
}

.icon-camera {
  --icon-url: url("/icons/ui/video-off.svg");
}

.control-button.is-media-on .icon-camera {
  --icon-url: url("/icons/ui/video.svg");
}

.icon-screen {
  --icon-url: url("/icons/ui/monitor.svg");
}

.control-button.screen-toggle.is-active .icon-screen {
  --icon-url: url("/icons/ui/monitor-up.svg");
}

.participants,
.chat-panel {
  min-height: 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.participant-sidebar .participants {
  position: relative;
  height: 100%;
  padding-top: 0;
  border-top: 0;
}

.section-heading {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.section-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.section-heading span {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  color: #08130d;
  background: var(--green);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

#participantList {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  align-content: start;
  justify-items: center;
}

.participant-sidebar .section-heading {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.participant-sidebar .section-heading h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.participant-sidebar .section-heading span {
  min-width: 32px;
  height: 28px;
}

.participant-sidebar .section-actions {
  display: grid;
  justify-items: center;
}

.participant-sidebar .icon-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
}

.participant-item {
  position: relative;
  display: grid;
  place-items: center;
}

.participant-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  aspect-ratio: 1 / 1;
  overflow: visible;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.participant-avatar-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: inherit;
  background: #101720;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.participant-avatar-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  clip-path: circle(50%);
}

.participant-avatar:hover .participant-avatar-face,
.participant-item.is-open .participant-avatar-face {
  border-color: rgba(78, 161, 255, 0.72);
}

.participant-item.is-speaking .participant-avatar-face {
  color: #06120d;
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(38, 208, 124, 0.18);
}

.participant-status-dots {
  position: absolute;
  right: -4px;
  bottom: 4px;
  display: grid;
  gap: 3px;
  padding: 0;
  z-index: 1;
}

.participant-muted-badge {
  position: absolute;
  top: -4px;
  right: -5px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  color: #fff;
  background: var(--red);
  border: 2px solid #080c12;
  border-radius: 50%;
  pointer-events: none;
}

.participant-muted-badge .button-icon {
  width: 11px;
  height: 11px;
}

.participant-status-dot {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(8, 12, 18, 0.96);
  border-radius: 50%;
  background: rgba(238, 242, 248, 0.2);
  box-shadow: 0 0 0 1px rgba(238, 242, 248, 0.1);
}

.participant-status-dot.is-active.is-mic {
  background: var(--green);
}

.participant-status-dot.is-active.is-camera {
  background: var(--blue);
}

.participant-status-dot.is-active.is-screen {
  background: var(--amber);
}

.participant-status-dot.is-quality-poor,
.participant-status-dot.is-quality-lost,
.participant-status-dot.is-quality-unknown {
  background: #ff6b6b;
}

.participant-popover {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  z-index: 16;
  display: grid;
  gap: 6px;
  min-width: 190px;
  max-width: 260px;
  padding: 10px;
  color: var(--text);
  background: rgba(8, 12, 18, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: translateY(-50%);
}

.participant-popover[hidden] {
  display: none;
}

.participant-popover strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.participant-popover small {
  color: var(--muted);
}

.participant-status-legend {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.participant-audio-controls {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.participant-audio-header,
.participant-audio-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.participant-audio-header {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.participant-audio-header strong {
  color: var(--text);
  font-size: 12px;
}

.participant-audio-header strong.is-boosted {
  color: var(--red);
}

.participant-audio-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--green);
}

.participant-audio-row input[type="range"].is-boosted {
  accent-color: var(--red);
}

.participant-mute-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  min-height: 32px;
  padding: 0;
  color: var(--text);
  background: #101720;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.participant-mute-button .button-icon {
  width: 18px;
  height: 18px;
}

.participant-mute-button:hover {
  border-color: rgba(78, 161, 255, 0.72);
}

.participant-mute-button.is-muted {
  color: #fff3f3;
  border-color: rgba(255, 107, 107, 0.72);
  background: rgba(255, 107, 107, 0.12);
}

.participant-hidden-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
}

.participant-hidden-tile-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  background: rgba(78, 161, 255, 0.16);
  border: 1px solid rgba(78, 161, 255, 0.58);
  border-radius: 50%;
}

.stage > .call-stats {
  position: absolute;
  left: 18px;
  bottom: 88px;
  z-index: 12;
  width: min(540px, calc(100% - 36px));
  padding: 7px 8px;
  background: rgba(8, 12, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.call-stats {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.call-stats[hidden] {
  display: none;
}

.call-stats .section-heading {
  margin-bottom: 0;
}

.call-stats .section-heading h2 {
  font-size: 11px;
}

.call-stats .section-heading span {
  min-width: 24px;
  height: 22px;
  font-size: 10px;
  border-radius: 6px;
}

.call-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.call-stat {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.call-stat span,
.call-stat small {
  color: var(--muted);
  font-size: 10px;
}

.call-stat strong {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
}

.chat-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-panel.is-dragging-image::after {
  content: "Отпустите фото";
  position: absolute;
  inset: 8px;
  z-index: 22;
  display: grid;
  place-items: center;
  color: var(--text);
  font-weight: 800;
  background: rgba(8, 12, 18, 0.78);
  border: 1px dashed rgba(78, 161, 255, 0.84);
  border-radius: 8px;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.side-panel .chat-panel {
  height: 100%;
  padding-top: 0;
  border-top: 0;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 220ms ease, transform 240ms ease;
}

.chat-panel-toggle {
  position: absolute;
  left: -40px;
  top: 16px;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 40px;
  height: 44px;
  color: var(--text);
  background: rgba(13, 18, 26, 0.96);
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  box-shadow: var(--shadow);
  font-weight: 800;
  line-height: 1;
}

.chat-panel-toggle:hover {
  border-color: rgba(78, 161, 255, 0.72);
}

body.has-expanded-video .chat-panel-toggle {
  display: none;
}

.app-layout.chat-collapsed .chat-panel-toggle {
  left: 4px;
  top: 16px;
  width: 36px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.app-layout.chat-collapsed .chat-panel {
  opacity: 0;
  pointer-events: none;
  transform: translateX(18px);
}

.chat-messages {
  align-content: start;
  min-height: 180px;
  overflow: auto;
  color: var(--muted);
  font-size: 13px;
}

.chat-message {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #101720;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-message-meta strong {
  max-width: 190px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-message-meta time {
  flex: 0 0 auto;
  color: rgba(238, 242, 248, 0.48);
  font-size: 12px;
}

.chat-message p {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.chat-image-button {
  display: block;
  width: 100%;
  max-width: 260px;
  padding: 0;
  overflow: hidden;
  background: #05070a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.chat-image-button img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #05070a;
}

.chat-form {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.chat-form.is-uploading::after {
  content: "Загрузка фото...";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 17;
  padding: 8px 10px;
  color: var(--text);
  background: rgba(8, 12, 18, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.chat-input-row {
  display: grid;
  grid-template-columns: 40px 40px minmax(0, 1fr) 40px;
  gap: 8px;
}

.chat-input-row .icon-button,
.chat-send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  line-height: 1;
}

.chat-input-row .button-icon {
  width: 20px;
  height: 20px;
  margin: auto;
}

.chat-image-input {
  display: none;
}

.chat-input-row input {
  width: 100%;
  min-height: 40px;
  color: var(--text);
  background: #0e141c;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  padding: 0 12px;
}

.chat-input-row input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(78, 161, 255, 0.18);
}

.chat-send-button {
  border-radius: 8px;
}

.emoji-picker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 18;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 4px;
  max-height: 220px;
  padding: 8px;
  overflow: auto;
  background: rgba(8, 12, 18, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.emoji-picker[hidden] {
  display: none;
}

.emoji-option {
  display: grid;
  place-items: center;
  height: 34px;
  padding: 0;
  font-size: 19px;
  background: #101720;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.emoji-option:hover {
  background: rgba(78, 161, 255, 0.18);
}

.chat-image-dialog {
  width: min(960px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  max-height: min(760px, calc(100svh - 28px));
  padding: 0;
  color: var(--text);
  background: rgba(5, 7, 10, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.chat-image-dialog:not([open]) {
  display: none;
}

.chat-image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.chat-image-dialog-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.chat-image-dialog-card .icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  background: rgba(8, 12, 18, 0.82);
  font-size: 22px;
}

.chat-image-dialog-card img {
  display: block;
  width: 100%;
  max-height: calc(100svh - 120px);
  object-fit: contain;
  background: #05070a;
  border-radius: 8px;
}

.chat-image-dialog-card p {
  margin: 0;
  min-height: 18px;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 13px;
}

.video-tile:fullscreen,
.video-tile.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #000;
}

.video-tile:fullscreen video,
.video-tile.is-fullscreen video {
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.video-tile:fullscreen .tile-footer,
.video-tile.is-fullscreen .tile-footer {
  margin: 10px 16px 16px;
}

.video-tile:fullscreen .expand-button,
.video-tile.is-fullscreen .expand-button {
  top: 16px;
  left: 16px;
}

.video-tile:fullscreen .zoom-reset-button,
.video-tile.is-fullscreen .zoom-reset-button {
  top: 64px;
  left: 16px;
}
