/* Пульт: окно просмотра. Сетка 8 px, скругление 8 px, рамки 1 px, без градиентов и свечения */
:root {
  --bg: #0b1120;
  --panel: #111827;
  --panel-2: #172033;
  --line: #243045;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #f1f5f9;
  --primary-ink: #0f172a;
  --good: #22c55e;
  --mid: #f59e0b;
  --bad: #ef4444;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
.sprite { position: absolute; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- вход ---------- */
.login { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 24px; }
.card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.brand { display: flex; gap: 16px; align-items: center; margin-bottom: 24px; }
.brand img { border-radius: 10px; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 600; }
.brand p { margin: 0; font-size: 14px; }
form label { display: block; font-size: 14px; color: var(--muted); margin: 16px 0 8px; }
form label:first-child { margin-top: 0; }
input:not([type=checkbox]) { width: 100%; height: 44px; padding: 0 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); font: inherit; outline: none; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid #94a3b8; outline-offset: 2px; }
.id-input { height: 56px !important; font-size: 28px !important; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.check { display: flex !important; align-items: center; gap: 8px; color: var(--text) !important; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
button { font: inherit; cursor: pointer; }
.primary { width: 100%; height: 44px; margin-top: 24px; background: var(--primary); color: var(--primary-ink); border: 0;
  border-radius: var(--radius); font-weight: 600; }
.primary:disabled { opacity: .6; cursor: progress; }
.ghost { height: 40px; padding: 0 16px; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); }
.msg { margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.msg:empty { display: none; }
.msg.error { color: #fca5a5; }

.recent { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.recent h2 { margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 8px; }
.recent .go { flex: 1; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; min-height: 44px; padding: 8px 8px;
  background: none; border: 0; color: var(--text); border-radius: var(--radius); text-align: left; }
.recent .go:hover { background: var(--panel-2); }
.recent .go b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .go span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.recent .rm { width: 32px; height: 32px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); border-radius: var(--radius); }
.recent .rm:hover { background: var(--panel-2); color: var(--text); }
.recent .rm svg { width: 16px; height: 16px; }

.get { max-width: 400px; text-align: center; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.get a { color: var(--text); font-weight: 500; }

/* ---------- сеанс ---------- */
.session { position: fixed; inset: 0; background: #000; overflow: hidden; }
.surface { position: absolute; inset: 0; touch-action: none; outline: none; user-select: none; -webkit-user-select: none; }
.surface video { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: 0 0; background: #000; }

.bar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px;
  max-width: calc(100% - 16px); padding: 4px 4px 4px 12px; background: rgba(17, 24, 39, .94); border: 1px solid var(--line);
  border-radius: 10px; transition: opacity .2s ease, transform .2s ease; z-index: 5; }
.bar.hide { opacity: 0; transform: translate(-50%, -8px); pointer-events: none; }
.peer { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.quality { display: inline-flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 13px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.good { background: var(--good); } .dot.mid { background: var(--mid); } .dot.bad { background: var(--bad); }
.sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.ico { width: 36px; height: 36px; display: grid; place-items: center; background: none; border: 0; color: var(--text); border-radius: var(--radius); flex: none; }
.ico:hover { background: var(--panel-2); }
.ico.danger { color: #fca5a5; }
.bar select { height: 36px; padding: 0 8px; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: 13px; }
.bar select option { background: var(--panel); }
.touch-only { display: none; }
@media (pointer: coarse) {
  .touch-only { display: grid; }
  .peer, .sep { display: none; }
  .quality { padding: 0 4px; }
}
@media (max-width: 640px) { #qualityText { font-size: 12px; } .bar { left: 8px; right: 8px; transform: none; overflow-x: auto; } .bar.hide { transform: translateY(-8px); } }

.menu { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 6; display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.menu button { height: 40px; padding: 0 16px; background: none; color: var(--text); border: 1px solid transparent; border-radius: var(--radius); text-align: left; white-space: nowrap; }
.menu button:hover { background: var(--panel-2); border-color: var(--line); }

.toasts { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 7; max-width: min(360px, calc(100% - 32px)); }
.toast { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.toast .row { display: flex; gap: 8px; justify-content: flex-end; }
.toast .act { height: 32px; padding: 0 12px; background: var(--primary); color: var(--primary-ink); border: 0; border-radius: 6px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.toast .act svg { width: 16px; height: 16px; }
.toast .later { height: 32px; padding: 0 12px; background: none; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--text); transition: width .2s linear; }

.drop { position: absolute; inset: 16px; display: grid; place-items: center; border: 2px dashed var(--muted); border-radius: 12px;
  background: rgba(11, 17, 32, .8); font-size: 18px; z-index: 8; pointer-events: none; }
.kbd { position: absolute; left: -1000px; top: 0; width: 10px; height: 10px; opacity: 0; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 24px; width: min(440px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
dialog .row .primary { width: auto; margin: 0; padding: 0 16px; height: 40px; }
