:root {
  color-scheme: dark;
  --bg: #17181b;
  --panel: #202226;
  --line: #34373d;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --blue: #1a73e8;
  --red: #d93025;
  --green: #34a853;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

header { display: flex; align-items: center; gap: 10px; }
header h1 { margin: 0; font-size: 18px; font-weight: 600; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px #d9302533; }

.status {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
}
.status.live { border-color: #1e6b36; background: #15291c; color: #a8dab5; }
.status.warn { border-color: #6b4e0a; background: #2b2410; color: #fdd663; }
.status.error { border-color: #7a2e29; background: #3b1f1d; color: #f6b3ae; }

.preview {
  position: relative;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  max-height: 55vh;
  width: 100%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
}
.preview video { width: 100%; height: 100%; object-fit: cover; display: none; }
.preview.on video { display: block; }
.preview.on .preview-empty { display: none; }
.preview.mirror video { transform: scaleX(-1); }
.preview-empty { color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.live-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .04em;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.row { display: flex; gap: 10px; }
.row > button { flex: 1; }

.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 20px; height: 20px; }
.sel { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.sel select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px;
}

button {
  font: inherit; color: var(--text); cursor: pointer;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 13px 14px; min-height: 48px;
}
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; font-size: 17px; }
button.danger { color: #f28b82; }

.retry { margin: 0; }
.retry button { width: 100%; }
.tips { margin: 4px 2px 0; color: var(--muted); font-size: 13px; }
[hidden] { display: none !important; }
