:root {
  --bg: #0e0f13;
  --surface: #171920;
  --surface-2: #1f222b;
  --border: #2a2e39;
  --text: #e8eaf0;
  --muted: #8d93a3;
  --accent: #6d8cff;
  --accent-text: #0b0d14;
  --live: #ff4d5e;
  --ok: #3fd08a;
  --error: #ff7a85;
  --radius: 12px;
  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;
}

a { color: var(--accent); }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.brand { color: var(--text); font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.bar nav { display: flex; gap: 18px; }
.bar nav a { color: var(--muted); text-decoration: none; }
.bar nav a[aria-current="page"], .bar nav a:hover { color: var(--text); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 20px 16px 40px; display: grid; gap: 16px; }

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.stage video, .stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stage:fullscreen { border: 0; border-radius: 0; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: rgb(0 0 0 / 0.55);
  transition: opacity 0.2s;
}
.overlay[hidden] { display: grid; opacity: 0; pointer-events: none; }

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--live);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.fs {
  position: absolute;
  right: 12px;
  bottom: 12px;
  opacity: 0;
  transition: opacity 0.15s;
}
.stage:hover .fs, .fs:focus-visible { opacity: 1; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.controls label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.controls .spacer { flex: 1; }

.controls label.check { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; color: var(--text); font-size: 14px; }
.custom-res { display: flex; align-items: end; gap: 6px; }
.custom-res[hidden] { display: none; }
.custom-res .times { padding-bottom: 8px; color: var(--muted); }
.unit-input { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.controls input[type="number"] { width: 92px; }
.panel > .hint { margin: -4px 0 0; font-size: 13px; color: var(--muted); }

input[type="number"] {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
input[type="number"]:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

select, button {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
}
select:disabled { opacity: 0.5; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { background: var(--live); color: #fff; border-color: var(--live); font-weight: 600; }

.status { margin: 0; min-height: 1.5em; color: var(--muted); }
.status.error { color: var(--error); }
.status.ok { color: var(--ok); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 0;
}
.stats div { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }

.encoders summary { cursor: pointer; font-weight: 600; }
.encoders table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.encoders th, .encoders td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.encoders th { color: var(--muted); font-weight: 500; font-size: 12px; }
.encoders td.yes { color: var(--ok); }
.encoders td.no { color: var(--muted); }
.encoders code { color: var(--muted); font-size: 12px; }
.encoders .hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

.share-list { display: grid; gap: 6px; }
.share-list .share span { min-width: 7.5em; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: var(--muted); }
.share code { color: var(--text); background: var(--surface-2); padding: 4px 8px; border-radius: 6px; overflow-wrap: anywhere; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card {
  display: grid;
  gap: 6px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card h2 { margin: 0; font-size: 20px; }
.card p { margin: 0; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.live { background: var(--live); }
