:root {
  color-scheme: dark;
  --bg: #15171b;
  --panel: #1f2228;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #3b82f6;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body { display: flex; flex-direction: column; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

#lobby {
  margin: auto;
  width: min(92vw, 360px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#lobby h1 { margin: 0; font-size: 1.5rem; }
#lobby p { margin: 0; color: var(--muted); }

input {
  padding: 0.75rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #333;
  background: var(--panel);
  color: var(--text);
}

button {
  padding: 0.7rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

#join { background: var(--accent); color: #fff; }
#leave { background: var(--danger); color: #fff; }
button.off { opacity: 0.5; }

#error { color: var(--danger) !important; min-height: 1em; }

#grid {
  flex: 1;
  display: grid;
  gap: 6px;
  padding: 6px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  align-content: center;
}

.tile {
  position: relative;
  background: var(--panel);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

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

.tile span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.85rem;
}

.tile button.promote {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.55);
}

#admin {
  margin: 6px;
  padding: 0.75rem;
  border-radius: 10px;
  background: var(--panel);
}

#admin h2 { margin: 0 0 0.5rem; font-size: 1rem; }

#waitlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#waitlist li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#waitlist li span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#waitlist button { padding: 0.4rem 0.7rem; font-size: 0.9rem; }
#waitlist button.approve { background: #15803d; color: #fff; }
#waitlist button.reject { background: var(--danger); color: #fff; }

#controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}
