/**
 * Familien-Bilderrahmen – Darstellung für das iPad
 * Ohne neuere CSS-Funktionen (kein inset, kein gap), damit iOS 13 alles kann.
 *
 * @version 1.1.3
 * @author  Marc Bauer - dieLichtBUILDER
 */

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

body {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.frame {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  background: #000;
}

/* Zwei Ebenen für weiches Überblenden */
.layer {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1;
  opacity: 0;
  -webkit-transition: opacity 1.2s ease-in-out;
  transition: opacity 1.2s ease-in-out;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.layer.visible { opacity: 1; }

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

/* Absender, Datum, Bildunterschrift */
.info {
  position: absolute;
  z-index: 2;
  left: 24px;
  left: calc(24px + env(safe-area-inset-left));
  bottom: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  max-width: 55%;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.32);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  line-height: 1.35;
}
.info-caption { display: block; font-size: 22px; font-weight: 500; }
.info-meta { display: block; margin-top: 2px; font-size: 16px; opacity: 0.8; }

/* Albumleiste: dezent, beim Antippen deutlich */
.albums {
  position: absolute;
  z-index: 3;
  top: 14px;
  top: calc(14px + env(safe-area-inset-top));
  left: 90px;
  right: 90px;
  text-align: center;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0.3;
  -webkit-transition: opacity 0.4s;
  transition: opacity 0.4s;
}
.controls .albums { opacity: 0.95; }
.albums button {
  display: inline-block;
  min-height: 48px;
  margin: 0 4px;
  padding: 0 22px;
  border: 0;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font: inherit;
  font-size: 18px;
}
.albums button.active { background: rgba(255, 255, 255, 0.92); color: #111; }

button svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Lautsprecher für Videos: nur nach Antippen sichtbar */
.sound-btn {
  position: absolute;
  z-index: 4;
  top: 14px;
  top: calc(14px + env(safe-area-inset-top));
  right: 18px;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  -webkit-transition: opacity 0.4s;
  transition: opacity 0.4s;
}
.controls .sound-btn { opacity: 0.95; pointer-events: auto; }
.sound-btn svg { width: 32px; height: 32px; }
.sound-btn .i-on { display: none; }
.sound-btn.on .i-on { display: inline; }
.sound-btn.on .i-off { display: none; }

/* Großer, pulsierender Knopf für Sprachnachrichten */
.audio-btn {
  position: absolute;
  z-index: 4;
  right: 36px;
  right: calc(36px + env(safe-area-inset-right));
  bottom: 36px;
  bottom: calc(36px + env(safe-area-inset-bottom));
  width: 120px;
  height: 120px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #1d1d1d;
  -webkit-animation: pulse 2.6s ease-out infinite;
  animation: pulse 2.6s ease-out infinite;
}
.audio-btn svg { width: 56px; height: 56px; fill: currentColor; stroke: none; }
.audio-btn .i-play { margin-left: 6px; }
.audio-btn .i-pause { display: none; }
.audio-btn.playing { background: rgba(255, 213, 140, 0.95); -webkit-animation: none; animation: none; }
.audio-btn.playing .i-play { display: none; }
.audio-btn.playing .i-pause { display: inline; }

@-webkit-keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
  70%  { box-shadow: 0 0 0 30px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
  70%  { box-shadow: 0 0 0 30px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.empty {
  position: absolute;
  z-index: 2;
  top: 0; right: 0; bottom: 0; left: 0;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  font-size: 28px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
}

/* Nachtmodus: schwarz, Berührung weckt für 5 Minuten */
.night {
  position: absolute;
  z-index: 5;
  top: 0; right: 0; bottom: 0; left: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  -webkit-transition: opacity 3s;
  transition: opacity 3s;
}
.night.on { opacity: 1; }

/* Kopplung */
.pair {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  width: 460px;
  max-width: 90%;
  padding: 36px;
  border-radius: 22px;
  background: #1c1c1e;
  text-align: center;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  -webkit-user-select: text;
  user-select: text;
}
.pair h1 { margin: 0 0 12px; font-size: 28px; }
.pair p { margin: 0 0 20px; font-size: 18px; color: #c7c7cc; }
.pair input {
  box-sizing: border-box;
  width: 100%;
  padding: 14px;
  border: 1px solid #48484a;
  border-radius: 12px;
  background: #000;
  color: #fff;
  font-size: 30px;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
}
.pair button {
  width: 100%;
  margin-top: 16px;
  padding: 16px;
  border: 0;
  border-radius: 12px;
  background: #ffd58c;
  color: #1d1d1d;
  font-size: 20px;
  font-weight: 600;
}
.pair .pair-status { margin: 16px 0 0; min-height: 24px; }

@media (prefers-reduced-motion: reduce) {
  .layer { -webkit-transition-duration: 0.01s; transition-duration: 0.01s; }
  .audio-btn { -webkit-animation: none; animation: none; }
}
