/*
 * Videochat.
 *
 * Der Gesprächsschirm liegt über allem. Ein Anruf ist nichts, was nebenher in
 * einer Spalte läuft — wer telefoniert, tut nichts anderes.
 */

/* Solange ein Gespräch läuft, soll dahinter nichts scrollen. */
body.im-anruf { overflow: hidden; }

.anruf-schirm {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  background: #14100F;
  color: #fff;
}

.anruf-schirm .buehne {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Das Bild der Gegenseite füllt die Fläche; angeschnitten ist besser als
   verzerrt oder von schwarzen Balken gerahmt. */
.anruf-schirm video.fern {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #14100F;
}

/* Das eigene Bild klein in der Ecke, gespiegelt — so kennt man sich selbst. */
.anruf-schirm video.nah {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 26vw;
  max-width: 220px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, .28);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  background: #2A2422;
  transform: scaleX(-1);
}
.anruf-schirm video.nah.dunkel { opacity: .25; }

.anruf-schirm .kopfzeile {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  /* Verlauf statt Balken: Der Name bleibt lesbar, ohne das Bild zu zerschneiden. */
  background: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
}
.anruf-schirm .kopfzeile .nam { font-weight: 600; font-size: 16px; }
.anruf-schirm .kopfzeile .fir { font-size: 13px; opacity: .8; }

.anruf-schirm .stand {
  margin-left: auto;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
}
.anruf-schirm .stand.gut { background: rgba(46, 125, 91, .85); }

.anruf-schirm .leiste {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  background: #14100F;
}

.rundknopf {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .12s ease, background-color .12s ease;
}
.rundknopf:active { transform: scale(.94); }
.rundknopf.hell  { background: rgba(255, 255, 255, .18); color: #fff; }
.rundknopf.hell.aus { background: #fff; color: #14100F; }
.rundknopf.rot   { background: #E2001A; color: #fff; }
.rundknopf.gruen { background: #2E7D5B; color: #fff; }
.rundknopf:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ------------------------------------------------------- Eingehender Anruf */

.anruf-ruf {
  position: fixed;
  z-index: 3100;
  left: 50%;
  transform: translateX(-50%);
  top: 16px;
  width: min(440px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #241E1C;
  color: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  animation: anruf-rein .22s ease-out;
}
@keyframes anruf-rein {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .anruf-ruf { animation: none; }
}

.anruf-ruf .txt { flex: 1; min-width: 0; }
.anruf-ruf .nam { font-weight: 600; }
.anruf-ruf .unt { font-size: 13px; opacity: .75; }
.anruf-ruf .knoepfe { display: flex; gap: 10px; }
.anruf-ruf .rundknopf { width: 48px; height: 48px; font-size: 19px; }

/* Auf dem Telefon steht der Anruf unten, in Daumennähe. */
@media (max-width: 520px) {
  .anruf-ruf { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .anruf-schirm video.nah { width: 34vw; right: 12px; bottom: 12px; }
  .rundknopf { width: 54px; height: 54px; }
}
