:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #111;
  color: #eee;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
}

main {
  width: min(1100px, 100%);
  margin: auto;
  padding: 20px;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  margin: 0 0 20px;
}

#status {
  margin-right: auto;
  color: #aaa;
  font-size: 14px;
}

#login-form,
#join-form,
#controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 20px;
}

#login-form[hidden],
#join-form[hidden],
#controls[hidden],
#participants[hidden] {
  display: none;
}

label {
  display: grid;
  gap: 6px;
  color: #bbb;
  font-size: 14px;
}

input,
select,
button {
  min-height: 42px;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 9px 13px;
  font: inherit;
}

input,
select {
  width: min(220px, 100%);
  background: #1b1b1b;
  color: #eee;
}

button {
  background: #eee;
  color: #111;
  cursor: pointer;
}

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

#leave {
  background: #632b2b;
  color: #fff;
}

#error {
  min-height: 24px;
  color: #ff9b9b;
}

#participants {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 12px;
}

.participant {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #222;
}

.participant video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#local-video {
  transform: scaleX(-1);
}

.participant span {
  position: absolute;
  bottom: 8px;
  left: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  border-radius: 6px;
  padding: 4px 8px;
  background: #000a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#caption {
  position: sticky;
  bottom: 16px;
  display: flex;
  gap: 8px;
  margin-top: 16px;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px 16px;
  background: #000e;
  font-size: 18px;
  line-height: 1.4;
}

#caption[hidden] {
  display: none;
}

#caption-speaker {
  flex-shrink: 0;
  color: #aaa;
  font-size: 14px;
}
