:root {
  --bg: #0b0d10;
  --bg-soft: #12161b;
  --panel: #161b22;
  --border: #262d36;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #f6821f;
  --accent-soft: rgba(246, 130, 31, 0.14);
  --danger: #d64545;
  --ok: #3fb950;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2027 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 16, 0.75);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(139, 148, 158, 0.12);
  transition: background 0.2s, box-shadow 0.2s;
}
.dot.live { background: var(--ok); box-shadow: 0 0 0 4px rgba(63, 185, 80, 0.16); }
.dot.busy { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.16); }

.status {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  max-width: 60vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 40px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

/* ---------- connect panel ---------- */

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  max-width: 640px;
  width: 100%;
  margin: 4vh auto 0;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
}

.panel h1 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: -0.2px;
}

.hint {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13.5px;
}

code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.field > span em { font-style: normal; opacity: 0.65; }

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 10px 12px;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.checks { display: flex; gap: 20px; margin: 4px 0 20px; flex-wrap: wrap; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

button {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
  background: #1c232c;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
button:hover { background: #232c37; border-color: #333d49; }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border-color: var(--accent);
  color: #14181d;
  font-weight: 700;
  font-size: 14.5px;
}
button.primary:hover { background: #ff9333; border-color: #ff9333; }

button.danger { color: #ffb4b4; border-color: #4a2626; background: #2a1616; }
button.danger:hover { background: #351b1b; border-color: #63302f; }

.error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(214, 69, 69, 0.1);
  border: 1px solid rgba(214, 69, 69, 0.35);
  color: #ffb4b4;
  font-size: 13px;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.help { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 14px; }
.help summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.help p { color: var(--muted); font-size: 13px; }
.help pre {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
}
.help pre code { background: none; border: 0; padding: 0; }

/* ---------- session ---------- */

.session {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spacer { flex: 1; }

.session-name {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40vw;
}

.screen {
  position: relative;
  flex: 1;
  min-height: 60vh;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen:fullscreen { border-radius: 0; border: 0; }

.screen canvas { outline: none; }

.screen .overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  text-align: center;
  padding: 24px;
  z-index: 5;
}

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .panel { padding: 20px; margin-top: 0; }
  main { padding: 16px 12px 28px; }
}
