*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000000;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000000;
}

/* Fixed 2-slot double-buffered image crossfade (GPU opacity only) */
.slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transition: opacity 600ms ease;
  will-change: opacity;
  pointer-events: none;
}

.slide-img.is-active {
  opacity: 1;
}

/* Readable caption & sender badge designed for viewing across a room */
.caption-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3.5rem 2rem 1.5rem;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.82) 0%,
    rgba(0, 0, 0, 0.45) 60%,
    rgba(0, 0, 0, 0) 100%
  );
  display: flex;
  align-items: center;
  gap: 1rem;
  pointer-events: none;
}

.caption-bar[hidden] {
  display: none;
}

.sender-avatar-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  background: #b85027;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sender-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sender-avatar[hidden] {
  display: none;
}

.sender-initials {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.03em;
}

.sender-initials[hidden] {
  display: none;
}

.caption-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.caption-text {
  margin: 0;
  font-size: clamp(1.2rem, 2.3vw, 1.85rem);
  font-weight: 600;
  line-height: 1.25;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.caption-text:empty {
  display: none;
}

.sender-meta {
  margin: 0;
  font-size: clamp(0.95rem, 1.55vw, 1.25rem);
  font-weight: 500;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.pause-badge {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.status-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: #12100e;
  text-align: center;
}

.status-screen[hidden] {
  display: none;
}

.status-card {
  max-width: 560px;
}

.status-card h1 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  font-weight: 700;
}

.status-card p {
  margin: 0;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.5;
}

.sleep-overlay {
  position: absolute;
  inset: 0;
  background: #000000;
  z-index: 20;
}

.sleep-overlay[hidden] {
  display: none;
}

@media (orientation: portrait) {
  .caption-bar {
    padding: 3rem 1.35rem 1.35rem;
    gap: 0.85rem;
  }

  .sender-avatar-wrap {
    width: 52px;
    height: 52px;
  }
}
