:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --accent: #5865f2;
  --text: #e8e9ec;
  --muted: #9aa0ab;
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
header {
  padding: 16px 24px;
  border-bottom: 1px solid #23262e;
  display: flex;
  align-items: center;
  gap: 10px;
}
header h1 { font-size: 18px; margin: 0; }
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}
.card {
  background: var(--panel);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #23262e;
}
input[type=text] {
  background: #101216;
  border: 1px solid #2a2d36;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.row { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}
button.secondary { background: #2a2d36; }
button.danger { background: #d64545; }
button:disabled { opacity: 0.5; cursor: default; }
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #101216;
  padding: 10px 14px;
  border-radius: 8px;
}
.muted { color: var(--muted); font-size: 13px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.grid:has(.tile:only-child) {
  grid-template-columns: 1fr;
}
video {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: #000;
  aspect-ratio: 16/9;
  object-fit: contain;
  display: block;
}
.tile {
  resize: both;
  overflow: hidden;
  min-width: 220px;
  min-height: 140px;
  width: min(100%, 960px);
  height: min(70vh, 540px);
  border: 1px solid #23262e;
}
.grid:has(.tile:only-child) {
  justify-content: center;
}
.grid:has(.tile:only-child) .tile {
  margin: 0 auto;
}
body.room-page main {
  max-width: 1400px;
}
.room-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
}
.stage-main {
  flex: 1;
  min-width: 0;
  padding: 12px;
}
.participant-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.participant-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #101216;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}
#emptyHint {
  text-align: center;
  padding: 60px 0;
}
@media (max-width: 720px) {
  .room-layout { flex-direction: column; }
  .sidebar { width: 100%; }
}
.tile { position: relative; }
.tile .name {
  position: absolute;
  bottom: 6px;
  left: 8px;
  background: rgba(0,0,0,0.6);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.tile .fullscreen-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.6);
  padding: 4px 8px;
  font-size: 14px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.tile:hover .fullscreen-btn {
  opacity: 1;
}
.tile .vol-control {
  position: absolute;
  bottom: 6px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.6);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.15s;
}
.tile:hover .vol-control {
  opacity: 1;
}
.tile .vol-slider {
  width: 80px;
}
.controls { display: flex; gap: 10px; margin-top: 16px; }
a { color: var(--accent); }
code { background: #101216; padding: 2px 6px; border-radius: 4px; }

.app-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(88,101,242,0.16), rgba(88,101,242,0.05));
  border: 1px solid rgba(88,101,242,0.45);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
}
.app-banner button { white-space: nowrap; }
.app-banner a { text-decoration: none; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal { width: 380px; max-width: calc(100vw - 32px); }
select {
  background: #101216;
  border: 1px solid #2a2d36;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}
.segmented { display: flex; gap: 8px; margin-top: 6px; }
.segmented button {
  flex: 1;
  background: #101216;
  border: 1px solid #2a2d36;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
}
.segmented button.active {
  border-color: var(--accent);
  background: rgba(88, 101, 242, 0.15);
}
