:root {
  font-family: system-ui, sans-serif;
  color-scheme: dark;
  background: #111;
  color: #eee;
}
* {
  box-sizing: border-box;
}
body {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  overflow-x: hidden;
}
body.wide-video-layout {
  max-width: none;
}
body.wide-video-layout .app-header,
body.wide-video-layout #controlPanel > * {
  width: 100%;
  max-width: 912px;
  margin-left: auto;
  margin-right: auto;
}
body.wide-video-layout #roomPanel > .room-summary,
body.wide-video-layout #roomPanel > .self-card,
body.wide-video-layout #roomPanel > .audio-peers-card,
body.wide-video-layout #roomPanel > .chat-card {
  width: 100%;
  max-width: 912px;
  margin-left: auto;
  margin-right: auto;
}
h1 {
  margin: 0 0 4px;
}
.muted {
  color: #aaa;
}
.hidden {
  display: none !important;
}
.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.panel-switch {
  display: flex;
  gap: 8px;
  flex: none;
}
.panel-tab {
  width: auto;
  min-width: 92px;
  color: #eee;
  background: #202020;
}
.panel-tab:hover:not(:disabled):not(.active) {
  background: #292929;
  color: #eee;
}
.panel-tab.active,
.panel-tab.active:hover:not(:disabled),
.panel-tab.active:focus-visible {
  background: #e8e8e8;
  color: #111;
  border-color: #e8e8e8;
}
.panel-viewport {
  overflow: hidden;
}
.panel-track {
  display: flex;
  width: 200%;
  transform: translateX(0);
  transition: transform 0.22s ease;
}
.panel-track.room {
  transform: translateX(-50%);
}
.panel {
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  padding-right: 1px;
}
.card {
  border: 1px solid #333;
  border-radius: 14px;
  padding: 18px;
  margin: 16px 0;
  background: #171717;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.wide {
  grid-column: 1/-1;
}
#hostInviteCard {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
#hostInviteCard > b {
  display: block;
}
#hostInviteCard textarea {
  display: block;
  margin: 0;
}
#hostInviteCard .actions {
  margin: 0;
  align-items: center;
}
label {
  display: block;
  font-size: 13px;
  color: #bbb;
  margin-bottom: 5px;
}
input,
textarea,
select,
button {
  box-sizing: border-box;
  width: 100%;
  padding: 10px;
  border-radius: 9px;
  border: 1px solid #444;
  background: #202020;
  color: #eee;
  font: inherit;
}
textarea {
  resize: vertical;
}
button {
  cursor: pointer;
  font-weight: 650;
}
button:hover:not(:disabled) {
  background: #292929;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
.actions {
  display: flex;
  gap: 10px;
}
.actions button {
  width: auto;
}
.primary {
  background: #e8e8e8;
  color: #111;
}
.primary:hover:not(:disabled) {
  background: #fff;
}
.log {
  height: 290px;
  overflow: auto;
  white-space: pre-wrap;
  background: #0c0c0c;
  border-radius: 9px;
  padding: 12px;
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}
.pill {
  display: inline-block;
  border: 1px solid #444;
  border-radius: 999px;
  padding: 4px 9px;
  margin: 3px;
  font-size: 12px;
}
.roster-pills {
  margin-top: 8px;
}

.pill,
.status-badge,
.transport-indicator,
.visual-label {
  cursor: default;
}
.ok {
  color: #9fda9f;
}
.bad {
  color: #ff9d9d;
}
details {
  border-top: 1px solid #2d2d2d;
  padding-top: 12px;
}
summary {
  cursor: pointer;
  color: #bbb;
  user-select: none;
}
.advanced-grid {
  margin-top: 12px;
}
.message-row {
  margin-top: 10px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
}
.check input {
  width: auto;
}
.room-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 0;
}
.status-badge {
  display: inline-block;
  border: 1px solid #444;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}
.mute-badge {
  width: 58px;
  text-align: center;
}
.status-badge.live {
  color: #a7e4a7;
  border-color: #416b41;
}
.status-badge.muted {
  color: #bbb;
}
.status-badge.warn {
  color: #ffd49a;
  border-color: #6c5838;
}
.peer-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.peer-activity {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}
.level-meter,
.connectivity-meter {
  display: block;
  flex: none;
  overflow: visible;
  shape-rendering: geometricPrecision;
}
.level-meter {
  width: 17px;
  height: 20px;
}
.connectivity-meter {
  width: 17px;
  height: 20px;
}
.level-bar,
.connectivity-bar {
  fill: #4a4a4a;
}
.level-bar {
  transition: fill 0.08s ease;
}
.connectivity-bar {
  transition: fill 0.12s ease;
}
.level-meter[data-level="1"] .level-bar:nth-child(-n + 1),
.level-meter[data-level="2"] .level-bar:nth-child(-n + 2),
.level-meter[data-level="3"] .level-bar:nth-child(-n + 3),
.level-meter[data-level="4"] .level-bar:nth-child(-n + 4) {
  fill: #b8e6b8;
}
.connectivity-meter[data-level="1"] .connectivity-bar:nth-of-type(-n + 1) {
  fill: #d7b56d;
}
.connectivity-meter[data-level="2"] .connectivity-bar:nth-of-type(-n + 2) {
  fill: #d5d58a;
}
.connectivity-meter[data-level="3"] .connectivity-bar:nth-of-type(-n + 3) {
  fill: #9fd79f;
}
.connectivity-meter[data-level="4"] .connectivity-bar:nth-of-type(-n + 4) {
  fill: #b8e6b8;
}
.audio-actions {
  margin-top: 14px;
}
.video-peer-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 16px auto 0;
  width: 100%;
  max-width: 912px;
}
.video-peer-list:empty {
  display: none;
}
.video-peer-card {
  width: 100%;
  margin: 0;
  transition:
    max-width 0.18s ease,
    width 0.18s ease;
}
.audio-peers-card {
  width: 100%;
  max-width: none;
}
.video-peer-card.wide-view {
  width: calc(100vw - 50px);
  max-width: none;
  align-self: center;
  position: relative;
}
.video-peer-card .visual-tile {
  margin-top: 0;
}
.video-peer-card .peer-controls {
  width: 100%;
  max-width: none;
}
.video-peer-card.wide-view .peer-controls {
  width: min(100%, 644px);
  margin-left: auto;
  margin-right: auto;
}
.video-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.video-card-actions .wide-toggle {
  width: auto;
  padding: 6px 9px;
  font-size: 12px;
}
.peer-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.peer-row {
  border-top: 1px solid #2d2d2d;
  padding-top: 12px;
}
.peer-row:first-child {
  border-top: 0;
  padding-top: 0;
}
.peer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.peer-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.host-icon {
  width: 15px;
  height: 15px;
  flex: none;
  fill: #d8d8d8;
  stroke: none;
}
.peer-connection-icon {
  width: 16px;
  height: 16px;
  min-width: 16px;
  max-width: 16px;
  fill: none;
  stroke: #8f8f8f;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.peer-connection-icon[data-connection-state="control"] {
  stroke: #cbbd82;
}
.peer-connection-icon[data-connection-state="media"] {
  color: #9bc79b;
  stroke: #9bc79b;
}
.peer-connection-icon[data-connection-state="media"] circle {
  fill: currentColor;
  stroke: currentColor;
}

.transport-indicator {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  border: 1px solid #3f3f3f;
  border-radius: 999px;
  color: #bbb;
  background: #1d1d1d;
  font-size: 11px;
  line-height: 1.25;
}
.transport-indicator[data-transport-kind="direct"] {
  color: #d9ead9;
  border-color: #496149;
}
.transport-indicator[data-transport-kind="handoff"] {
  color: #e3d7a2;
  border-color: #675d36;
}
.volume-line {
  display: grid;
  grid-template-columns: 16px 88px auto minmax(120px, 1fr) 58px auto;
  align-items: center;
  gap: 9px;
}
.volume-line label {
  margin: 0;
  color: #bbb;
}
.volume-line input[type="range"] {
  --volume-pct: 50%;
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  height: 18px;
}
.volume-line input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #777 0 var(--volume-pct), #3b3b3b var(--volume-pct) 100%);
}
.volume-line input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border: 1px solid #777;
  border-radius: 50%;
  background: #aaa;
}
.volume-line input[type="range"]::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: #3b3b3b;
}
.volume-line input[type="range"]::-moz-range-progress {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: #777;
}
.volume-line input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 1px solid #777;
  border-radius: 50%;
  background: #aaa;
}
.volume-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.reset-volume {
  width: auto;
  padding: 6px 8px;
  font-size: 12px;
}
.chat-log {
  height: 300px;
  overflow: auto;
  background: #0c0c0c;
  border-radius: 9px;
  padding: 12px;
  margin-top: 10px;
}
.chat-entry {
  margin: 0 0 10px;
}
.chat-entry:last-child {
  margin-bottom: 0;
}
.chat-author {
  font-weight: 650;
  margin-right: 7px;
}
.chat-compose input {
  flex: 1;
}
.chat-compose button {
  flex: none;
}
.self-card {
  border-color: #3d3d3d;
}

.visual-support {
  margin-top: 14px;
}
.visual-actions {
  margin-top: 10px;
}
.visual-tile {
  position: relative;
  margin: 12px 0;
  background: #111;
  border: 1px solid #2d2d2d;
  border-radius: 10px;
  overflow: hidden;
}
.visual-tile video,
.visual-tile canvas {
  display: block;
  width: 100%;
  max-height: 420px;
  background: #0b0b0b;
  object-fit: contain;
}
.visual-tile canvas {
  height: auto;
}
.video-peer-card.wide-view .visual-tile video,
.video-peer-card.wide-view .visual-tile canvas {
  max-height: none;
}
.visual-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.68);
  color: #ddd;
  font-size: 12px;
  pointer-events: none;
}
.visual-actions button.active {
  border-color: #6b8f6b;
  color: #cde8cd;
  background: #263226;
}
@media (prefers-reduced-motion: reduce) {
  .panel-track,
  .level-bar,
  .connectivity-bar,
  .video-peer-card {
    transition: none;
  }
}
@media (max-width: 650px) {
  body {
    padding: 16px;
  }
  .video-peer-card,
  .audio-peers-card {
    max-width: none;
  }
  .video-peer-card.wide-view {
    width: 100%;
  }
  .video-card-actions {
    gap: 6px;
  }
  .video-card-actions .wide-toggle {
    display: none;
  }
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }
  .panel-switch {
    width: 100%;
  }
  .panel-switch button {
    flex: 1;
  }
  .row {
    grid-template-columns: 1fr;
  }
  .actions {
    flex-wrap: wrap;
  }
  .volume-line {
    grid-template-columns: 16px 88px auto minmax(60px, 1fr) 58px auto;
    gap: 7px;
  }
  .room-summary {
    align-items: flex-start;
  }
  .peer-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .chat-compose {
    flex-wrap: nowrap;
  }
}

/* Media-control SVGs use Lucide icon geometry (ISC licensed). */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.button-icon {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
