:root {
  --dark: #1d1f24;
  --panel: #24272e;
  --line: #34383f;
  --accent: #c9403f;
  --text: #f2f3f5;
  --muted: #9a9ca3;
}
* { margin: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(120% 90% at 50% 0%, #2a2e36 0%, var(--dark) 55%, #17181c 100%);
  color: var(--text);
  min-height: 100%;
}
.stage {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 18px 40px;
}
.brand { display: flex; align-items: center; gap: 12px; margin: 12px 0 28px; }
.brand .mark { width: 38px; height: 38px; border-radius: 22%; }
.wordmark { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.wordmark .dot { color: var(--accent); }

.card {
  width: 100%; max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 28px;
  box-shadow: 0 30px 70px rgba(0,0,0,.45);
}
.card h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; }
.card .sub { color: var(--muted); margin: 8px 0 22px; line-height: 1.45; font-size: 14px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 16px; }
input, select {
  width: 100%; margin-top: 7px;
  background: #1a1c21; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 12px 13px; font-size: 15px;
  font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
#fCode { letter-spacing: 4px; font-weight: 700; }

.primary {
  width: 100%; margin-top: 6px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 9px;
  padding: 14px; font-size: 15px; font-weight: 800;
  cursor: pointer; font-family: inherit;
  transition: filter .15s;
}
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: .55; cursor: default; }
.fineprint { color: var(--muted); font-size: 12px; margin-top: 16px; text-align: center; }
.error { color: #ff8a87; font-size: 13px; margin-bottom: 14px; }

/* Setup preview */
.preview {
  position: relative; aspect-ratio: 16/9;
  background: #101216; border-radius: 11px; overflow: hidden;
  margin-bottom: 20px;
}
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; font-weight: 600;
}
.level { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 5px; background: rgba(255,255,255,.14); border-radius: 3px; overflow: hidden; }
.level-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #3ecf6a, #d8c53a 70%, var(--accent)); transition: width .08s linear; }
.toggles { display: flex; gap: 10px; margin-bottom: 20px; }
.toggle {
  flex: 1; background: #1a1c21; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 10px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.toggle:not(.on) { color: var(--muted); border-color: #2a2d33; }
.toggle:not(.on)::before { content: "✕ "; color: var(--accent); }
.toggle.on::before { content: "● "; color: #3ecf6a; }

/* In-call */
.call { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.program {
  position: relative; aspect-ratio: 16/9; width: 100%;
  background: #0d0e10; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line);
}
.program > video { width: 100%; height: 100%; object-fit: contain; background: #0d0e10; }
.program-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 16px;
  align-items: center; justify-content: center; color: var(--muted); font-size: 14px;
}
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.self-view {
  position: absolute; right: 14px; bottom: 14px;
  width: 26%; max-width: 220px; aspect-ratio: 16/9;
  background: #101216; border-radius: 9px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.18); box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.self-view video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.controls { display: flex; align-items: center; gap: 10px; padding: 4px; }
.spacer { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 7px 14px; font-size: 13px; font-weight: 700; color: var(--muted);
}
.pill.live { color: #fff; }
.pill.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3ecf6a; box-shadow: 0 0 0 0 rgba(62,207,106,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(62,207,106,.5); } 70% { box-shadow: 0 0 0 7px rgba(62,207,106,0); } }
.ctrl {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 16px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; min-width: 62px;
}
.ctrl:not(.on) { color: var(--muted); }
.ctrl.leave { background: var(--accent); border-color: var(--accent); color: #fff; }

@media (max-width: 560px) {
  .self-view { width: 34%; right: 10px; bottom: 10px; }
  .ctrl { padding: 11px 12px; min-width: 54px; }
}
