:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --accent-hover: #4493f8;
  --ok: #3fb950;
  --off: #6e7681;
  --danger: #da3633;
  --danger-hover: #f85149;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.screen { min-height: 100%; display: flex; flex-direction: column; }
.center { display: flex; align-items: center; justify-content: center; padding: 16px; }
.grow { flex: 1; }

.card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
h1 { font-size: 22px; margin: 0 0 4px; text-align: center; }

.logo { display: flex; justify-content: center; gap: 14px; margin-bottom: 4px; }
.logo span { width: 22px; height: 30px; border-radius: 11px; background: #5ee1ff; box-shadow: 0 0 14px #5ee1ff88; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
}
input:focus { outline: 2px solid var(--accent); border-color: transparent; }

button { font: inherit; cursor: pointer; border: none; border-radius: 10px; color: var(--text); }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); padding: 12px 16px; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary.big { padding: 16px; font-size: 18px; }
.ghost { background: transparent; border: 1px solid var(--border); padding: 7px 14px; }
.ghost:hover { background: var(--surface-2); }

.error { color: var(--danger-hover); margin: 0; min-height: 1.4em; font-size: 14px; text-align: center; }
.hint { color: var(--muted); font-size: 13px; margin: 0; text-align: center; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted);
}
.topbar b { color: var(--text); }

.lobby-card { gap: 18px; }
.robot-status { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 17px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--off); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* --- Разговор --- */
#call { height: 100%; background: #000; }
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#remote-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 18px; text-align: center; padding: 16px; background: #000;
}
#self-video {
  position: absolute; right: 16px; bottom: 16px;
  width: min(26vw, 240px); aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  transform: scaleX(-1);
}
#self-video.off { visibility: hidden; }
.pill {
  position: absolute; top: 16px; left: 16px;
  background: #000a; border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; font-size: 14px;
}
.pill.right { left: auto; right: 16px; }
.audio-unlock { position: absolute; left: 16px; bottom: 16px; }
.pill.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; }

.controls {
  display: flex; justify-content: center; gap: 18px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.round {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--surface-2); padding: 10px 14px; min-width: 96px; border-radius: 14px; font-size: 13px;
}
.round:hover { background: var(--border); }
.round svg { width: 26px; height: 26px; fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.round .slash { display: none; stroke-width: 2.4; }
.round[aria-pressed="false"] { background: var(--text); color: var(--bg); }
.round[aria-pressed="false"] .slash { display: inline; }
.round.danger { background: var(--danger); }
.round.danger:hover { background: var(--danger-hover); }

@media (max-width: 520px) {
  .controls { gap: 10px; }
  .round { min-width: 0; flex: 1; }
  #self-video { width: 34vw; right: 10px; bottom: 10px; }
}
