:root {
  --bg: #0c0d11;
  --surface: #15171d;
  --surface-high: #1c1f26;
  --outline: #2a2e38;
  --text: #f4f5f7;
  --text-2: #a0a6b1;
  --text-3: #6b717c;
  --accent: #b8f34a;
  --good: #3dd6c6;
  --bad: #ff6b5e;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header, main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

header { padding-top: 28px; }
h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.5px; }
h2 { margin: 28px 0 10px; font-size: 13px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-3); }
header p { margin: 0; color: var(--text-2); }

nav { display: flex; gap: 16px; margin-bottom: 14px; font-size: 13px; }
nav a { color: var(--text-3); text-decoration: none; }
nav a[aria-current] { color: var(--accent); }

.videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

figure { margin: 0; }

video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border-radius: 18px;
  object-fit: cover;
  display: block;
}

#local, .tile.self video { transform: scaleX(-1); }

.tile { position: relative; }
.tile figcaption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  margin: 0;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgb(12 13 17 / 0.7);
  color: var(--text);
}
.tile figcaption small { color: var(--text-2); margin-left: 6px; font-variant-numeric: tabular-nums; }

figcaption { margin-top: 6px; font-size: 13px; color: var(--text-2); }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

button {
  font: inherit;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 14px;
  border: 0;
  background: var(--accent);
  color: #0c0d11;
  cursor: pointer;
}

button:disabled { opacity: 0.35; cursor: default; }
#stop { background: var(--surface-high); color: var(--text); }

label { color: var(--text-2); }

input:not([type]), input[type="text"] {
  font: inherit;
  width: 9em;
  margin-left: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--text);
}

.stats {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  padding: 16px 18px;
  background: var(--surface);
  border-radius: 18px;
  min-height: 52px;
}

.stats dt { color: var(--text-3); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.log {
  list-style: none;
  margin: 0 0 40px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: 18px;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  max-height: 360px;
  overflow-y: auto;
}

.log .good { color: var(--good); }
.log .bad { color: var(--bad); }
.log .muted { color: var(--text-3); }
