:root {
  --bg: #0f1115;
  --panel: #191c23;
  --panel-2: #222631;
  --text: #eef0f4;
  --muted: #9aa3b2;
  --accent: #ff6a13;
  --accent-2: #ff8a45;
  --danger: #e5484d;
  --ok: #3fb950;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, select, input { font: inherit; color: inherit; }
a { color: var(--accent-2); }

/* ---------- главная ---------- */
.landing { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.landing .card { max-width: 560px; width: 100%; text-align: center; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; margin-bottom: 28px; }
.logo i { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center;
  font-style: normal; color: #fff; }
.landing h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; margin: 0 0 14px; }
.landing p.lead { color: var(--muted); margin: 0 0 28px; font-size: 18px; }
.btn { border: 0; border-radius: 12px; padding: 13px 22px; cursor: pointer; background: var(--panel-2); }
.btn.primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.big { font-size: 18px; padding: 16px 30px; }
.steps { display: grid; gap: 10px; margin: 34px 0 0; text-align: left; color: var(--muted); }
.steps div { background: var(--panel); border-radius: var(--radius); padding: 12px 16px; }
.steps b { color: var(--text); }

/* ---------- звонок ---------- */
.call { position: fixed; inset: 0; display: flex; flex-direction: column; }
.stage { position: relative; flex: 1; min-height: 0; background: #000; }
#remoteVideo { width: 100%; height: 100%; object-fit: contain; background: #000; }
#localVideo { position: absolute; right: 16px; top: 16px; width: min(26vw, 240px); aspect-ratio: 16/9;
  object-fit: cover; border-radius: 12px; background: var(--panel); border: 2px solid rgba(255,255,255,.15);
  transform: scaleX(-1); }
.waiting { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; }
.waiting .box { background: rgba(25,28,35,.92); padding: 22px 24px; border-radius: var(--radius); max-width: 460px; }
.waiting .link { display: flex; gap: 8px; margin-top: 14px; }
.waiting .link input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid #333a48; border-radius: 10px; padding: 10px 12px; }
.status { position: absolute; left: 16px; top: 16px; background: rgba(0,0,0,.55); padding: 6px 12px; border-radius: 20px;
  font-size: 14px; color: var(--muted); max-width: calc(100% - 300px); }
.status.ok { color: var(--ok); }

.subs { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(900px, calc(100% - 32px));
  text-align: center; pointer-events: none; }
.subs .line { display: inline-block; background: rgba(0,0,0,.72); padding: 8px 14px; border-radius: 10px;
  font-size: clamp(17px, 2.4vw, 24px); line-height: 1.35; }
.subs .line:empty { display: none; }
.subs .orig { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }

.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px;
  background: var(--panel); }
.ctl { border: 0; border-radius: 50px; padding: 11px 16px; background: var(--panel-2); cursor: pointer; white-space: nowrap; }
.ctl.off { background: #3a2226; color: #ffb4b6; }
.ctl.on { background: #1f3326; color: #9be9a8; }
.ctl.end { background: var(--danger); color: #fff; }
.bar label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.bar select { background: var(--panel-2); border: 0; border-radius: 10px; padding: 9px 10px; }
.bar input[type=range] { width: 110px; accent-color: var(--accent); }

.log { position: absolute; left: 16px; bottom: 16px; width: min(380px, calc(100% - 32px)); max-height: 45%;
  overflow: auto; background: rgba(25,28,35,.94); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; display: none; }
.log.open { display: block; }
.log .row { margin: 0 0 10px; }
.log .who { font-size: 12px; color: var(--muted); }
.log .tr { color: var(--text); }
.log .src { color: var(--muted); }

/* экран входа */
.prejoin { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: var(--bg); z-index: 5; }
.prejoin .box { width: min(520px, 100%); background: var(--panel); border-radius: var(--radius); padding: 22px; }
.prejoin video { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 12px; object-fit: cover; transform: scaleX(-1); }
.prejoin h2 { margin: 0 0 6px; font-size: 22px; }
.prejoin p { margin: 0 0 14px; color: var(--muted); }
.prejoin .row { display: flex; gap: 10px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.prejoin select { flex: 1; background: var(--panel-2); border: 0; border-radius: 10px; padding: 11px; }
.prejoin .hint { font-size: 13px; color: var(--muted); }

@media (max-width: 640px) {
  #localVideo { width: 34vw; right: 10px; top: 10px; }
  .status { max-width: calc(100% - 44vw); font-size: 13px; }
  .bar { gap: 8px; padding: 10px; }
  .ctl { padding: 10px 13px; }
  .bar input[type=range] { width: 80px; }
}
