.form-field,
.dialog-form {
  display: grid;
  gap: 8px;
}

.in-room, .in-room body { height: 100%; overflow: hidden; }
.in-room body { display: grid; height: 100dvh; grid-template-rows: auto minmax(0, 1fr); }
.in-room main { min-height: 0; }
.in-room .nav { min-height: 52px; }
.in-room .room {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding-block: 12px max(10px, env(safe-area-inset-bottom));
}
.in-room .room-top { margin-bottom: 10px; gap: 10px; align-items: center; }
.in-room .room-top:has(.youtube-warning:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 5px; }
.youtube-warning { grid-column: 1 / -1; margin: 0; color: #ffcfaa; font-size: .84rem; }
.room-top > div:first-child { min-width: 0; }
#fullscreen-movie-title { display: none; }
.screen:is(:fullscreen, [data-expanded]) #fullscreen-movie-title:not([hidden]) {
  display: block;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .95rem;
  font-weight: 600;
}
.in-room .room-top h1 { font-size: clamp(1.15rem, 2.5vw, 2rem); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.in-room .connection-state { font-size: .78rem; margin-bottom: 3px; }
.room-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.room-top .room-actions { flex-wrap: nowrap; }
.privacy-label { color: var(--green); font-size: .84rem; }
.in-room .room-grid { min-height: 0; align-items: stretch; gap: 12px; }
.in-room .viewer {
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) repeat(3, auto);
  align-items: stretch;
  gap: 7px;
}
.in-room .screen { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; min-height: 0; }
.in-room .screen .picture { min-height: 0; aspect-ratio: auto; }
.in-room .screen .picture > video { height: 100%; }
.screen[data-fade-controls] > .picture { isolation: auto; }
.in-room .stage { padding: 8px; }
.in-room .stage-inner { gap: 4px; }
.in-room .stage h2 { font-size: clamp(1rem, 2.5vw, 1.7rem); }
.in-room .stage p { font-size: .87rem; }
.in-room .stage-mark { display: none; }
.in-room .stage .button { min-height: 34px; padding-block: 4px; width: auto; }
.in-room .screen :where(.controls, .share-controls, .voice-bar) { padding-block: 6px; }
.in-room .controls { gap: 5px; }
.screen[data-fade-controls] #video {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#video-controls button { touch-action: manipulation; }
#video-controls .icon-button svg { pointer-events: none; }
#video-controls, .screen:is(:fullscreen, [data-expanded]) > #voice-bar { transition: opacity 200ms ease; }
.screen[data-fade-controls][data-mouse-away]:not(:fullscreen, [data-expanded]) > #video-controls:not(:active, :has(:focus-visible)),
.screen[data-fade-controls][data-touch-hidden] > #video-controls:not(:active, :has(:focus-visible)),
.screen[data-fade-controls][data-fullscreen-idle]:is(:fullscreen, [data-expanded]) > :is(#video-controls, #voice-bar):not(:active, :has(:focus-visible, #voice-talk[aria-pressed="true"])) {
  opacity: 0;
  pointer-events: none;
}
.player-key-feedback {
  position: absolute;
  z-index: 6;
  inset: 50% auto auto 50%;
  translate: -50% calc(-50% + 6px);
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 124px;
  padding: 14px 18px;
  border: 1px solid #ffffff26;
  border-radius: 24px;
  background: #17151cdb;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px #0006;
  color: #fff;
  font-size: .83rem;
  line-height: 1.15;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, translate 180ms ease, visibility 0s linear 180ms;
}
.player-key-feedback[data-visible] {
  opacity: 1;
  visibility: visible;
  translate: -50% -50%;
  transition-delay: 0s;
}
.player-key-feedback svg { width: 28px; height: 28px; }
.player-key-feedback strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.player-key-feedback[data-action="backward"] .player-key-seek-icon { scale: -1 1; }
.player-key-feedback[data-volume] .player-key-seek-icon,
.player-key-feedback:not([data-volume]) :is(.player-key-volume-icon, .player-key-meter),
.player-key-feedback[data-volume-locked] .player-key-meter { display: none; }
.player-key-meter {
  width: 100%;
  height: 4px;
  margin-top: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--volume-level), #ffffff40 var(--volume-level));
}
.picture:has(> .player-key-feedback[data-visible]) > .video-buffering {
  top: max(22px, calc(50% - 101px));
}

.in-room .screen[data-expanded] {
  position: fixed;
  inset: 0;
  z-index: 20;
  height: 100dvh;
  border-radius: 0;
  background: #0a090d;
}
.screen:is(:fullscreen, [data-expanded]):has(> #video-controls:not([hidden])) {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  border: 0;
}
.screen[data-fade-controls] > :is(.picture, #video-controls),
.screen:is(:fullscreen, [data-expanded]):has(> #video-controls:not([hidden])) > :is(.picture, #video-controls, #voice-bar) {
  grid-area: 1 / 1;
}
.in-room .screen:is([data-fade-controls], :fullscreen, [data-expanded]) > #video-controls {
  align-self: end;
  z-index: 2;
  padding: 7px clamp(10px, 2.5vw, 32px) max(8px, env(safe-area-inset-bottom));
  background: linear-gradient(rgb(0 0 0 / 35%), rgb(0 0 0 / 90%));
}
.screen:is(:fullscreen, [data-expanded]):has(> #video-controls:not([hidden])) > #voice-bar {
  align-self: start;
  justify-self: end;
  z-index: 2;
  margin: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 8px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 10px;
  background: rgb(20 17 25 / 85%);
}
.screen[data-fade-controls] .comments,
.screen:is(:fullscreen, [data-expanded]):has(> #video-controls:not([hidden])) .comments {
  inset: min(80px, 22%) 12px auto;
  max-height: 35%;
  justify-content: flex-start;
}
.in-room .primary-play { width: 47px; height: 47px; border-radius: 13px; }
.in-room .stream-info { margin: 0; font-size: .78rem; }
.in-room .comment-form { gap: 6px; }
.in-room .comment-form :where(input, .button) { min-height: 38px; padding-block: 6px; }
.in-room .room-side { min-height: 0; overflow: auto; align-content: start; gap: 8px; scrollbar-width: thin; }
.in-room .room-side .panel { padding: 12px; }
.in-room .members { margin-block: 8px; max-height: none; overflow: visible; }
.in-room .member { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px; }
.voice-wave { display: inline-flex; align-items: center; height: 16px; gap: 2px; flex: none; }
.voice-wave > span {
  width: 2px;
  height: 60%;
  border-radius: 2px;
  background: currentColor;
  animation: speaking-wave .65s ease-in-out infinite alternate;
}
.voice-wave > span:nth-child(2), .voice-wave > span:nth-child(4) { height: 80%; animation-delay: -.2s; }
.voice-wave > span:nth-child(3) { height: 100%; animation-delay: -.38s; }
.voice-wave > span:last-child { animation-delay: -.48s; }
@keyframes speaking-wave { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
.avatar > .voice-wave,
.member[data-speaking] .avatar-initial,
.member:not([data-speaking]) .member-speaking { display: none; }
.member[data-speaking] .avatar {
  background: #23392f;
  color: var(--green);
  box-shadow: inset 0 0 0 1px #47715a;
}
.member[data-speaking] .avatar > .voice-wave { display: inline-flex; }
.voice-speakers {
  position: absolute;
  z-index: 5;
  inset: 10px auto auto 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: min(calc(100% - 20px), 30rem);
  pointer-events: none;
}
.screen:is(:fullscreen, [data-expanded]) .voice-speakers, .focused-share > .voice-speakers {
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
}
.screen:is(:fullscreen, [data-expanded]) .voice-speakers {
  top: calc(max(8px, env(safe-area-inset-top)) + var(--fullscreen-voice-height, 0px) + 8px);
}
.voice-speaker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid #496658;
  border-radius: 999px;
  background: #171f1ce8;
  color: #eef6f0;
  font-size: .84rem;
}
.voice-speaker .voice-wave { height: 13px; color: var(--green); }
.voice-speaker > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-manage, .voice-mix .button { min-height: 32px; padding: 4px 7px; font-size: .8rem; }
.voice-mix { grid-column: 2 / -1; display: flex; align-items: center; gap: 6px; font-size: .8rem; }
.voice-mix input { flex: 1; min-width: 35px; accent-color: var(--accent); }
.voice-mix output { min-width: 2.7em; text-align: end; }
.sidebar-heading, #sidebar-open { display: none; }

.in-room .share-grid { height: 100%; grid-auto-rows: minmax(0, 1fr); overflow: auto; }
.in-room .share-tile:not(.focused-share) { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.in-room .share-tile:not(.focused-share) video { min-height: 0; height: 100%; aspect-ratio: auto; object-fit: contain; }
.in-room .share-tile figcaption { gap: 5px; min-height: 0; padding: 4px 6px; flex-wrap: wrap; }
.share-state, .share-resolution { color: var(--muted); font-size: .78rem; }
.share-name { min-width: 3ch; }
.share-tile .share-focus-toggle { min-height: 36px; min-width: 36px; padding: 5px; }
.share-tile[data-waiting="true"] > video { visibility: hidden; }
.share-tile select { max-width: 116px; }
.media-options {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 29px;
  justify-content: center;
}
.media-options .button { min-height: 28px; padding: 3px 9px; font-size: .82rem; }
.media-options label { font-size: .8rem; }
.media-options select, .share-tile select, .room-dialog select {
  min-width: 0;
  color: var(--text);
  background: #211d26;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 7px;
  font: inherit;
}
.media-options select, .share-tile select { font-size: .78rem; }
.quality-message {
  position: absolute;
  z-index: 4;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  width: max-content;
  max-width: calc(100% - 20px);
  padding: 6px 10px;
  border-radius: 8px;
  background: #19141de8;
  color: var(--text);
  text-align: center;
  font-size: .86rem;
  pointer-events: none;
}

.room-dialog {
  width: min(480px, calc(100% - 28px));
  max-height: min(720px, calc(100dvh - 28px));
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
  border-radius: 14px;
}
.room-dialog[open] { display: grid; gap: 9px; }
.room-dialog::backdrop { background: #08060ac9; }
.room-dialog h2 { overflow-wrap: anywhere; }
.room-dialog form, .room-dialog p { margin: 0; }
.room-dialog select { max-width: 100%; width: 100%; min-height: 38px; }
.room-dialog ul { margin: 0; padding-inline-start: 20px; }
.room-dialog summary, #room-access summary { cursor: pointer; font-weight: 600; }
.room-dialog details > :not(summary) { margin-top: 8px; }
.subtitle-offset-row, .subtitle-timing-row { display: flex; align-items: center; gap: 5px; }
.subtitle-offset-row input { flex: 1; }
.subtitle-timing-row { justify-content: space-between; }
#subtitle-rate { font-size: .85rem; color: var(--muted); }
#password-form { margin-block: 8px; }
.blocked-list li { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.danger-button { color: #ffb19d; }
#video::cue { color: #fff; background-color: #0a090dd9; }

.in-room #mobile-setup {
  position: fixed;
  z-index: 10;
  inset: auto 12px 12px auto;
  overflow: auto;
  max-height: calc(100dvh - 24px);
  width: min(500px, calc(100vw - 24px));
  box-shadow: 0 12px 65px #000b;
}

@media (max-width: 780px) {
  .in-room .wrap { width: calc(100% - 20px); }
  .in-room .room-grid { grid-template-columns: minmax(0, 1fr); }
  .in-room .room-top { flex-wrap: nowrap; }
  .in-room .room-actions .button { padding-inline: 8px; min-height: 37px; font-size: .82rem; }
  #sidebar-open { display: inline-flex; }
  .sidebar-heading { display: flex; }
  .in-room .room-side {
    position: fixed;
    inset: 5px 5px 5px auto;
    z-index: 8;
    width: min(345px, calc(100% - 10px));
    padding: 9px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 10px 60px #000b;
  }
  .in-room .room-side:not([data-open="true"]) { display: none; }
}
@media (max-width: 340px) {
  .in-room .privacy-label { display: none; }
}

@media (max-width: 500px) {
  .in-room .share-tile:not(.focused-share) .share-state { display: none; }
  .in-room .share-tile select { max-width: 90px; }
  .in-room .room-top h1 { font-size: 1.12rem; }
  .in-room #invite .icon-copy { display: none; }
}

@media (max-height: 500px) {
  .in-room .nav { min-height: 33px; }
  .in-room .brand-mark { width: 24px; }
  .in-room .room { padding-block: 5px; }
  .in-room .room-top { margin-bottom: 4px; }
  .in-room .room-top h1 { font-size: 1.06rem; }
  .in-room .controls { padding-block: 3px; }
  .in-room .primary-play { width: 36px; height: 36px; }
  .in-room .transport-row .icon-button { max-height: 36px; }
  .in-room .media-options, .in-room .media-options .button { min-height: 23px; }
  .in-room .voice-bar { padding-block: 3px; }
  .in-room .voice-bar .button { min-height: 36px; padding-block: 3px; }
  .in-room .share-grid[data-count="5"], .in-room .share-grid[data-count="4"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
