.rost-audio-unlock { position: fixed; z-index: 110; bottom: 90px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 24px); min-height: 44px; padding: 10px 18px; border: 1px solid #526277; border-radius: 12px; color: #fff; background: #263447; font: 650 14px/1.4 sans-serif; cursor: pointer; }
.rost-audio-unlock[hidden] { display: none; }
.rost-live-tile__mic[hidden], .rost-live-avatar__muted[hidden] { display: none; }
.rost-microphone-dialog { box-sizing: border-box; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 22px; border: 1px solid #394252; border-radius: 18px; color: #f7f8fa; background: #181d27; font: 14px/1.5 Inter, sans-serif; }
.rost-microphone-dialog::backdrop { background: #080c14bb; }
.rost-microphone-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.rost-microphone-dialog h2 { margin: 0; font-size: 21px; }
.rost-microphone-dialog button, .rost-microphone-dialog select { min-height: 44px; border: 1px solid #4a5668; border-radius: 9px; padding: 8px 12px; color: #fff; background: #263142; font: inherit; }
.rost-microphone-dialog header button { min-width: 44px; font-size: 24px; }
.rost-microphone-dialog label, .rost-microphone-dialog select, .rost-microphone-dialog meter { display: block; width: 100%; min-width: 0; }
.rost-microphone-dialog select { margin: 6px 0 16px; }
.rost-microphone-dialog meter { margin-top: 18px; height: 20px; accent-color: #39c583; }
.rost-microphone-dialog p { min-height: 42px; }
.rost-microphone-dialog small { color: #aeb8c8; }
.rost-microphone-dialog :focus-visible { outline: 3px solid #72bdff; outline-offset: 2px; }

.rost-live-room {
  --rost-live-bg: #10131a;
  --rost-live-panel: #181d27;
  --rost-live-panel-soft: #222a37;
  --rost-live-text: #f7f8fa;
  --rost-live-muted: #9da8b9;
  --rost-live-accent: #e31b23;
  --rost-live-success: #39c583;
  --rost-live-warning: #ffb547;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 320px;
  overflow: hidden;
  color: var(--rost-live-text);
  background: var(--rost-live-bg);
  border-radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rost-live-room__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 0 18px;
  color: var(--rost-live-muted);
  background: rgba(24, 29, 39, .96);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: 13px;
  font-weight: 650;
}

.rost-live-room__connection {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.rost-live-room__connection::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  content: "";
  background: var(--rost-live-muted);
  border-radius: 50%;
}

.rost-live-room__connection[data-state="connected"]::before {
  background: var(--rost-live-success);
  box-shadow: 0 0 0 4px rgba(57, 197, 131, .13);
}

.rost-live-room__connection[data-state="connecting"]::before,
.rost-live-room__connection[data-state="reconnecting"]::before,
.rost-live-room__connection[data-state="previewing"]::before {
  background: var(--rost-live-warning);
  animation: rost-live-pulse 1.25s ease-in-out infinite;
}

.rost-live-room__connection[data-state="error"]::before,
.rost-live-room__connection[data-state="sdk-missing"]::before {
  background: var(--rost-live-accent);
}

.rost-live-room[data-network="poor"] .rost-live-room__connection::before,
.rost-live-room[data-network="lost"] .rost-live-room__connection::before {
  background: var(--rost-live-warning);
}

.rost-live-room__stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  padding: 10px;
  gap: 10px;
}

.rost-live-room__videos {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(120px, 1fr);
  min-height: 0;
  gap: 8px;
}

.rost-live-room__videos[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.rost-live-room__videos[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rost-live-room__videos[data-count="3"],
.rost-live-room__videos[data-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rost-live-tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--rost-live-panel);
  border: 2px solid transparent;
  border-radius: 14px;
}

.rost-live-tile.is-speaking {
  border-color: var(--rost-live-success);
}

.rost-live-tile.is-screen {
  grid-column: span 2;
  grid-row: span 2;
  background: #090b10;
}

.rost-live-tile__media,
.rost-live-tile__media video {
  width: 100%;
  height: 100%;
}

.rost-live-tile__media video {
  position: relative;
  z-index: 1;
  display: block;
  object-fit: cover;
}

.rost-live-tile.is-screen .rost-live-tile__media video {
  object-fit: contain;
}

.rost-live-tile.is-local:not(.is-screen) .rost-live-tile__media video {
  transform: scaleX(-1);
}

.rost-live-tile__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #313b4d, #1c222e);
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 780;
}

.rost-live-tile__fallback[hidden] {
  display: none;
}

.rost-live-tile__meta {
  position: absolute;
  z-index: 3;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  pointer-events: none;
}

.rost-live-tile__name,
.rost-live-tile__badge,
.rost-live-tile__mic {
  min-width: 0;
  padding: 5px 8px;
  overflow: hidden;
  color: #fff;
  background: rgba(6, 8, 12, .72);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rost-live-tile__name {
  margin-right: auto;
}

.rost-live-tile__badge {
  color: #fff;
  background: rgba(227, 27, 35, .9);
}

.rost-live-tile__mic {
  width: 26px;
  padding-inline: 0;
  color: #ffc1c4;
  text-align: center;
}

.rost-live-room__overflow {
  display: flex;
  gap: 8px;
  min-height: 60px;
  padding: 8px;
  overflow-x: auto;
  background: rgba(255, 255, 255, .035);
  border-radius: 13px;
  scrollbar-width: thin;
}

.rost-live-room__overflow[hidden] {
  display: none;
}

.rost-live-avatar {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(60px, 112px) auto;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 128px;
  padding: 5px 8px 5px 5px;
  background: var(--rost-live-panel-soft);
  border: 1px solid transparent;
  border-radius: 11px;
}

.rost-live-avatar.is-speaking {
  border-color: var(--rost-live-success);
}

.rost-live-avatar__circle {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #536077, #2b3444);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.rost-live-avatar.is-speaking .rost-live-avatar__circle {
  box-shadow: 0 0 0 3px rgba(57, 197, 131, .2);
}

.rost-live-avatar__name {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rost-live-avatar__muted {
  color: #f08d92;
  font-size: 14px;
}

.rost-live-room__audio {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

@keyframes rost-live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.72); }
}

@media (max-width: 920px) {
  .rost-live-room__videos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rost-live-tile.is-screen {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 240px;
  }
}

@media (max-width: 620px) {
  .rost-live-room {
    min-height: 420px;
    border-radius: 14px;
  }

  .rost-live-room__status {
    min-height: 44px;
    padding-inline: 12px;
  }

  .rost-live-room__stage {
    padding: 6px;
    gap: 6px;
  }

  .rost-live-room__videos {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: minmax(150px, 1fr);
    gap: 6px;
  }

  .rost-live-room__videos[data-count="2"],
  .rost-live-room__videos[data-count="3"],
  .rost-live-room__videos[data-count="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(120px, 1fr);
  }

  .rost-live-tile.is-screen {
    grid-column: 1 / -1;
    min-height: 210px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rost-live-room__connection::before { animation: none !important; }
}
