:root {
  --bg: #0b0d10;
  --bg-2: #0e1116;
  --panel: #14171b;
  --panel-2: #171a1f;
  --line: #23272e;
  --text: #e6e8eb;
  --muted: #99a2ac;
  --accent: #16a34a;
  --accent-press: #22c55e;
  --danger: #e5534b;
  --ok: #22c55e;
  --warn: #d29922;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.screen { height: 100%; }
.hidden { display: none !important; }

#connect {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.card h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card .sub {
  margin: 4px 0 24px;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

input, select {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}

#target {
  font-size: 22px;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  color: #fff;
  background: var(--accent);
  transition: background .12s ease;
}

button:hover { background: var(--accent-press); }
button:disabled { opacity: .5; cursor: default; }

#go { width: 100%; margin-top: 4px; }

button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
button.ghost:hover { background: var(--panel-2); }

button.danger { background: var(--danger); }
button.danger:hover { background: #c9443d; }

.hint {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--danger);
}
.hint.ok { color: var(--ok); }
.hint.info { color: var(--muted); }

.foot {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

#session {
  display: flex;
  flex-direction: column;
}

.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.spacer { flex: 1; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex: 0 0 auto;
}
.dot.stale { background: #d29922; }

.peer {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.ctl {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.ctl select {
  width: auto;
  margin: 0;
  padding: 5px 8px;
  font-size: 13px;
  color: var(--text);
}

.stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  min-height: 0;
}

#screen {
  max-width: 100%;
  max-height: 100%;
  display: block;
  cursor: none;
  image-rendering: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(14, 16, 19, .82);
  font-size: 15px;
  color: var(--muted);
}
.overlay.show { display: flex; }

.stats {
  display: flex;
  gap: 20px;
  padding: 6px 14px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .bar { flex-wrap: wrap; gap: 8px; }
  .ctl { font-size: 11px; }
  .stats { gap: 12px; }
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.busy {
  color: var(--accent-press);
  border-color: rgba(34, 197, 94, .4);
  background: rgba(34, 197, 94, .12);
}
