:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1d232c;
  --line: #2a323d;
  --text: #e6edf3;
  --muted: #8b97a6;
  --accent: #ff6b2c;
  --accent-hover: #ff7d44;
  --danger: #e5484d;
  --ok: #3fb950;
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.screen { display: none; height: 100%; }
.screen.is-active { display: flex; }

/* ---------------------------------------------------- Karten-Ansichten --- */

#screen-login, #screen-connect {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.card-wide { max-width: 460px; }

/* ------------------------------------------------------- Geraeteliste --- */

.devices { margin-top: 22px; }

.devices-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.btn-sm { padding: 5px; }
.btn-sm svg { width: 15px; height: 15px; }

.device-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.device {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.device:hover:not(:disabled) { border-color: var(--accent); }
.device:disabled { opacity: .45; cursor: default; }

.device-text { min-width: 0; flex: 1; }
.device-name {
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-sub { display: block; font-size: 12px; color: var(--muted); }

.device-tag {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  flex: none;
}

.empty { font-size: 13px; margin: 4px 0 0; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  margin: 22px 0 14px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.brand {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.brand span { color: var(--muted); font-weight: 400; }

.muted { color: var(--muted); }
#screen-login .muted, #screen-connect .muted { margin: 0 0 24px; font-size: 14px; }

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 13px;
  font: inherit;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }

#input-code {
  font-size: 22px;
  letter-spacing: 0.14em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}
.btn-primary:not(:disabled):hover { background: #ff7d44; }

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
  padding: 8px;
}
.btn-ghost:hover { background: #263040; }
.btn-ghost svg {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-danger { background: var(--danger); color: #fff; padding: 8px 14px; }
.btn-danger:hover { background: #f05055; }

.error {
  color: var(--danger);
  font-size: 13px;
  margin: 12px 0 0;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.status[hidden] { display: none; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------- Sitzung --- */

.screen-session { flex-direction: column; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.bar-info { display: flex; align-items: center; gap: 9px; min-width: 0; }
.bar-info strong { font-weight: 600; }
.bar-info .muted { font-size: 13px; }

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.dot.is-live { background: var(--ok); }
.dot.is-lost { background: var(--danger); }

.bar-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 0;
  background: #0a0d11;
}

.stage-inner { position: relative; height: 100%; display: flex; }

#video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  background: #000;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  outline: none;
  border-radius: var(--radius);
}
.overlay:focus-visible { box-shadow: 0 0 0 2px var(--accent); }

.waiting {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  background: #0a0d11;
  border-radius: var(--radius);
}
.waiting[hidden] { display: none; }

/* ---------------------------------- Dateien und Zwischenablage rechts --- */

.panel {
  width: 300px;
  flex: none;
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 18px;
}
.panel[hidden] { display: none; }

.panel-block { margin-bottom: 26px; }
.panel-block h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.panel-hint { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.btn-block { width: 100%; padding: 9px; }

.panel-actions { display: flex; gap: 6px; margin-top: 8px; }
.btn-sm-wide { flex: 1; padding: 7px; font-size: 13px; }

.panel textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
  outline: none;
}
.panel textarea:focus { border-color: var(--accent); }

.panel-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.panel-note[hidden] { display: none; }
.panel-note.is-error { color: var(--danger); }

/* --------------------------------------------------------------- Chat --- */

.chat {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.chat li {
  font-size: 13px;
  padding: 7px 10px;
  border-radius: var(--radius);
  max-width: 88%;
  word-break: break-word;
}
.chat .from-me { background: var(--accent); color: #fff; align-self: flex-end; }
.chat .from-device { background: var(--surface-2); border: 1px solid var(--line); align-self: flex-start; }

.chat-form { display: flex; gap: 6px; }
.chat-form input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.chat-form input:focus { border-color: var(--accent); }

/* ----------------------------------------------------------- Zustand --- */

.info { margin: 12px 0 0; font-size: 12px; }
.info div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.info dt { color: var(--muted); }
.info dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.info dd.is-warn { color: var(--danger); }

.device-search {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
  width: 120px;
  outline: none;
}
.device-search:focus { border-color: var(--accent); }

.transfers { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.transfer {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-size: 12px;
}
.transfer-head { display: flex; justify-content: space-between; gap: 8px; }
.transfer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-state { color: var(--muted); flex: none; }

.transfer-bar {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  margin-top: 7px;
  overflow: hidden;
}
.transfer-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width .15s;
}
.transfer.is-done .transfer-bar span { background: var(--ok); }

.transfer a { color: var(--accent); text-decoration: none; }
.transfer a:hover { text-decoration: underline; }

.dropzone {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: rgba(255, 107, 44, .12);
  color: var(--text);
  font-size: 14px;
  pointer-events: none;
}
.dropzone[hidden] { display: none; }

.statusbar {
  display: flex;
  gap: 16px;
  padding: 7px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------- Gruppen und Umbenennen --- */

.group-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 10px 0 2px;
  padding-left: 2px;
}
.group-head:first-child { margin-top: 0; }

.device-row { display: flex; gap: 6px; align-items: stretch; }
.device-row .device { flex: 1; min-width: 0; }

.device-edit {
  flex: none;
  width: 38px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s;
}
.device-edit:hover { color: var(--text); border-color: var(--accent); }
.device-edit svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.device-forget:hover { color: var(--danger); border-color: var(--danger); }

.brand img{display:block;height:30px;width:auto}
