:root {
  --bg: #090c10;
  --panel: #10151c;
  --panel-2: #0c1117;
  --line: #202a36;
  --text: #f5f7fa;
  --muted-ui: #8fa0b4;
  --green: #5fd17c;
  --green-soft: #173523;
  --red: #ef6b75;
  --red-soft: #3a171b;
  --yellow: #e3bd68;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #18212b;
  color: var(--text);
  min-height: 38px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--green); border-color: var(--green); color: #071109; }
button.ghost { background: transparent; }
button.danger { background: var(--red-soft); border-color: #74343b; color: #ffd9dc; }
button.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
input, select, textarea {
  width: 100%;
  border: 1px solid #2a3542;
  border-radius: 9px;
  background: #0b1016;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #4a657d; }
textarea { min-height: 90px; resize: vertical; }
label { display: grid; gap: 6px; color: #d5dde7; font-size: 12px; font-weight: 750; }
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 9px; }
.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.muted, .subtle { color: var(--muted-ui); }
.subtle { font-size: 12px; }
.code-line { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }

/* Participant join */
.participant-page { overflow: hidden; }
.join-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.join-card { width: min(600px, 100%); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.join-brand { color: #8ddca0; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.join-card h1 { margin: 5px 0 8px; font-size: 28px; }
.join-card p { margin: 0 0 18px; }
.inline-status { margin-top: 12px; min-height: 38px; display: flex; align-items: center; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted-ui); }
.inline-status.ok { border-color: #285d39; color: #9ee4ae; }
.inline-status.bad { border-color: #6c3036; color: #ffadb4; }
.device-details { border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.device-details summary { padding: 11px; cursor: pointer; font-weight: 750; }
.device-options { padding: 0 11px 11px; }

/* Host */
.host-page { min-height: 100vh; }
.app-shell { padding: 12px; }
.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f141a;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand h1 { margin: 0; font-size: 17px; }
.brand p { margin: 3px 0 0; color: var(--muted-ui); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.show-code { display: grid; line-height: 1; }
.show-code span { color: var(--muted-ui); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; font-weight: 900; }
.show-code strong { margin-top: 4px; font-family: ui-monospace, monospace; font-size: 20px; letter-spacing: .13em; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted-ui); font-size: 10px; font-weight: 850; }
.status-pill.ok { color: #9ae2ab; border-color: #285d39; background: #102018; }
.status-pill.bad { color: #ffadb4; border-color: #653037; background: #211014; }
.status-pill.warn { color: #f2d690; border-color: #66502b; background: #211b0e; }
.dashboard { display: grid; grid-template-columns: minmax(250px, .82fr) minmax(420px, 1.35fr) minmax(310px, 1fr); gap: 10px; margin-top: 10px; align-items: start; }
.column { display: grid; gap: 10px; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.panel-head { min-height: 41px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 11px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 13px; }
.panel-body { padding: 11px; }
.wait-item, .participant-card, .question-item { border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); padding: 10px; }
.wait-name, .participant-name { font-weight: 850; }
.life-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 9px 0; }
.life-hearts { color: #ff667a; font-size: 18px; letter-spacing: 2px; }
.life-hearts .dead { color: #45515f; }
.volume-row { display: grid; grid-template-columns: 1fr 40px; align-items: center; gap: 8px; margin: 9px 0; }
.volume-row input { padding: 0; }
.question-current { display: grid; gap: 8px; padding: 12px; border: 1px solid #293541; border-radius: 11px; background: #0b1016; }
.question-label { color: var(--muted-ui); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.question-display { font-size: 18px; line-height: 1.25; font-weight: 850; }
.answer-display { padding: 10px; border-radius: 8px; background: #121a22; color: #cbd8e5; white-space: pre-wrap; }
.import-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.question-select-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.round-box { display: flex; align-items: center; justify-content: space-between; padding: 10px 11px; border-radius: 10px; border: 1px solid #2d3c49; background: #0b1016; }
.round-box strong { font-size: 22px; }
.media-preview { position: relative; aspect-ratio: 16 / 9; border-radius: 11px; overflow: hidden; background: #05080b; border: 1px solid var(--line); }
.media-preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media-preview-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #607185; font-weight: 800; font-size: 12px; }
.device-grid { display: grid; gap: 8px; }
.overlay-preview-wrap { aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #06090c; }
.overlay-preview-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.obs-status-box { padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: #0b1016; color: var(--muted-ui); font-size: 12px; }
.audio-rack { position: fixed; width: 1px; height: 1px; overflow: hidden; left: -10000px; top: -10000px; }
.audio-rack iframe { width: 1px; height: 1px; border: 0; }
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #121820; box-shadow: 0 14px 35px rgba(0,0,0,.35); }
.toast.ok { border-color: #2c6840; }
.toast.bad { border-color: #72343b; }
@media (max-width: 1100px) {
  .dashboard { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { flex-wrap: wrap; }
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.button-link:hover { filter: brightness(1.08); }

/* v6: automatische Gast-Geraete + echte lokale Kamera-Vorschau */
.guest-preview-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 14px 0 16px;
  overflow: hidden;
  border: 1px solid #2a3542;
  border-radius: 12px;
  background: #05080b;
}
.guest-preview-shell video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  background: #05080b;
}
.guest-preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  color: #77889b;
  background: #080d12;
  text-align: center;
  font-weight: 800;
}
.guest-preview-shell.preview-error { border-color: #673139; }
.device-details-open {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.device-details-open .device-options { padding: 11px; }
.device-grid-guest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
@media (max-width: 620px) {
  .device-grid-guest { grid-template-columns: 1fr; }
}
