/* screenoserv viewer — dark, minimal, collapsible sidebar on the right. */
:root {
  --bg: #0e1116;
  --panel: #171b22;
  --panel-2: #1f242d;
  --border: #2a3038;
  --text: #e6e9ee;
  --muted: #9aa4b2;
  --accent: #4c8dff;
  --danger: #e5534b;
  --ok: #3fb950;
  --sidebar-w: 280px;
}

* { box-sizing: border-box; }

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

[hidden] { display: none !important; }

/* ── Join view ─────────────────────────────────────────────────────────── */
.join-view {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
}

.card {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.card h1 {
  font-size: 1.25rem;
  margin: 0 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  background: var(--accent);
  color: #06101f;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 7px;
  font-size: 0.85rem;
}

.hint { color: var(--muted); margin: 0; font-size: 0.9rem; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.6rem 0.7rem;
  color: var(--text);
  font-size: 0.95rem;
}
input:focus { outline: none; border-color: var(--accent); }

#room-fields { display: flex; flex-direction: column; gap: 0.85rem; }

button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.6rem 0.8rem;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--panel-2);
  transition: filter 0.12s ease, background 0.12s ease;
}
button:hover { filter: brightness(1.15); }

button.primary { background: var(--accent); border-color: var(--accent); color: #06101f; font-weight: 600; }
button.danger  { background: transparent; border-color: var(--danger); color: var(--danger); }
button.ghost   { background: var(--panel-2); text-align: left; }

.status { margin: 0; font-size: 0.85rem; padding: 0.5rem 0.65rem; border-radius: 8px; }
.status[data-kind="info"]  { color: var(--muted); background: var(--panel-2); }
.status[data-kind="error"] { color: #ffd7d4; background: rgba(229, 83, 75, 0.15); }
.status[data-kind="ok"]    { color: #c6f6cf; background: rgba(63, 185, 80, 0.15); }

.legal { color: var(--muted); font-size: 0.75rem; opacity: 0.7; }

/* ── Stage ─────────────────────────────────────────────────────────────── */
.stage {
  position: fixed;
  inset: 0;
  display: flex;
  background: #000;
}

.video-wrap { position: relative; flex: 1; min-width: 0; background: #000; }

#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  font-size: 1.05rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

/* ── Sidebar (right, collapsible) ──────────────────────────────────────── */
.sidebar {
  position: relative;
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--panel);
  border-left: 1px solid var(--border);
  transition: flex-basis 0.22s ease, width 0.22s ease;
  overflow: visible;
}

.sidebar-toggle {
  position: absolute;
  top: 14px;
  left: -34px;
  width: 34px;
  height: 38px;
  border-radius: 9px 0 0 9px;
  border-right: none;
  background: var(--panel);
  font-size: 1.1rem;
  line-height: 1;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  height: 100%;
  overflow-y: auto;
}

.sidebar-content h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0.2rem 0 0.3rem; }

/* Collapsed state: sidebar shrinks to zero, the toggle tab stays reachable. */
.stage.sidebar-collapsed .sidebar { width: 0; flex-basis: 0; }
.stage.sidebar-collapsed .sidebar-content { opacity: 0; pointer-events: none; }

/* ── Info panel ────────────────────────────────────────────────────────── */
.info-panel {
  margin-top: 0.4rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
}
.info-panel h3 { font-size: 0.8rem; margin: 0 0 0.5rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.info-panel dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.75rem; }
.info-panel dt { color: var(--muted); font-size: 0.82rem; }
.info-panel dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.88rem; }

#btn-leave { margin-top: auto; }
