/* Bühne (screen.ts): großes Bild der anderen Person, Kamera klein darüber, Leerzustand, Auswahl, Leiste darunter */
#screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.screen-stage {
  position: relative;
  flex: 1;
  min-height: 260px;
  overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 40%, rgb(99 102 241 / 0.08), transparent 70%),
    #07080c;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
}

/* ---- Bild der anderen Person ---- */
.screen-remote {
  position: absolute;
  inset: 0;
}
.screen-remote .screen-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.screen-video:fullscreen {
  object-fit: contain;
  background: #000;
}
.screen-remote-title {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: rgb(10 12 18 / 0.72);
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.screen-remote > .screen-remote-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgb(239 68 68 / 0.25);
}
/* Bild läuft im eigenen Fenster: Hinweis mit „Zurückholen“ statt des Bildes */
.screen-popout-note {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  background: #000;
}
/* Vollbild und Lautstärke: unten rechts, deutlich sichtbar beim Zeigen mit der Maus */
.screen-remote-tools {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  background: rgb(10 12 18 / 0.72);
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  opacity: 0.55;
  transition: opacity 0.2s;
}
.screen-stage:hover .screen-remote-tools {
  opacity: 1;
}
.screen-remote-tools button {
  padding: 7px 12px;
}
/* Schmale Bühne: zuerst „Vollbild“ nur als Symbol und kürzerer Lautstärke-Regler, sehr schmal alle Knöpfe am Bild nur als
   Symbol (Text steht im Hinweis beim Zeigen) */
.screen-stage {
  container: stage / inline-size;
}
@container stage (max-width: 640px) {
  .screen-remote-tools [data-action='fullscreen'] span {
    display: none;
  }
  .screen-remote-tools [data-action='fullscreen'] {
    padding: 7px 9px;
  }
  .screen-volume input {
    width: 80px;
  }
}
@container stage (max-width: 500px) {
  .screen-remote-tools button span {
    display: none;
  }
  .screen-remote-tools button {
    padding: 7px 9px;
  }
}
.screen-volume {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  color: var(--muted);
}
.screen-volume input {
  width: 110px;
}

/* ---- Kamera der anderen Person: kleines Bild unten links ---- */
.screen-camera {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  width: clamp(150px, 22%, 280px);
  overflow: hidden;
  background: #000;
  border: 2px solid rgb(255 255 255 / 0.12);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.screen-camera .screen-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.screen-camera .screen-remote-title {
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  font-size: 11px;
}

/* ---- Leerzustand ---- */
.screen-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}
.screen-stage:has(.screen-remote:not([hidden])) .screen-empty {
  display: none;
}
.screen-empty-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 6px;
  color: #fff;
  background: var(--brand);
  border-radius: 24px;
  box-shadow: 0 14px 34px rgb(99 102 241 / 0.35);
}
.screen-empty-icon .icon {
  width: 36px;
  height: 36px;
}
.screen-empty[data-sharing='true'] .screen-empty-icon {
  background: linear-gradient(135deg, #10b981, #22d3ee);
  box-shadow: 0 14px 34px rgb(16 185 129 / 0.35);
  animation: screen-pulse 2.4s ease-in-out infinite;
}
@keyframes screen-pulse {
  50% {
    transform: scale(1.05);
  }
}
.screen-empty-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.screen-empty-text {
  max-width: 400px;
  margin-bottom: 8px;
  color: var(--muted);
}
.screen-empty button {
  padding: 11px 20px;
}

/* ---- Auswahl: Bildschirm oder Fenster ---- */
.screen-picker {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
  background: rgb(9 11 16 / 0.96);
  backdrop-filter: blur(6px);
}
.screen-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.screen-picker-title {
  font-size: 17px;
  font-weight: 700;
}
.screen-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.screen-source {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.screen-source:hover {
  filter: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.screen-source img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}
.screen-source-name {
  overflow: hidden;
  padding: 0 2px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.screen-source-kind {
  padding: 0 2px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---- Leiste unter der Bühne ---- */
.screen-dock {
  container-type: inline-size;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 12px 10px 16px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.screen-status {
  flex: 1 1 220px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}
.screen-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
/* Wenig Platz in der Leiste: Kamera und Einstellungen nur als Symbol (Text steht im Hinweis beim Zeigen) */
@container (max-width: 640px) {
  .screen-status {
    flex-basis: 100%;
  }
  .screen-actions [data-action='camera'] span,
  .screen-settings > summary span {
    display: none;
  }
  .screen-actions [data-action='camera'],
  .screen-settings > summary {
    padding: 9px 11px;
  }
}

/* Einstellungen: Knopf öffnet ein Feld oberhalb der Leiste */
.screen-settings {
  position: relative;
}
.screen-settings > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  cursor: pointer;
  background: var(--panel-2);
  border-radius: var(--radius-s);
  box-shadow: inset 0 0 0 1px var(--line);
}
.screen-settings > summary::-webkit-details-marker {
  display: none;
}
.screen-settings[open] > summary {
  box-shadow: inset 0 0 0 1px var(--accent);
}
.screen-settings-body {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(360px, 86vw);
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.screen-settings-title {
  font-size: 13px;
  font-weight: 700;
}

.screen-mode {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--panel-2);
  border-radius: 12px;
}
.screen-pill {
  position: relative;
  flex: 1;
  padding: 8px 10px;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
  border-radius: 9px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.screen-pill:has(input:checked) {
  color: #fff;
  background: var(--brand);
}
.screen-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.screen-pill:has(input:focus-visible) {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}
.screen-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.screen-check {
  flex-direction: row;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text);
}
.screen-check input {
  margin-top: 2px;
}
.screen-hint {
  font-size: 12.5px;
  color: var(--muted);
}

/* Schmale Fenster: Bühne im Seitenverhältnis 16:9 */
@media (max-width: 759px) {
  .screen-stage {
    flex: none;
    min-height: 0;
    aspect-ratio: 16 / 10;
  }
  .screen-settings-body {
    right: auto;
    left: 0;
  }
}
