/* ── Reset ──────────────────────────────────────────────────────────────────── */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Google Sans', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Cast media player ───────────────────────────────────────────────────────
   Required by CAF for video rendering. Positioned to fill the screen.
   CSS variables suppress the default watermark/logo so our custom UI is clean.
   ────────────────────────────────────────────────────────────────────────── */

cast-media-player {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  --watermark: none;
  --logo-image: none;
  --splash-image: none;
}

/* ── Buffering spinner ───────────────────────────────────────────────────────
   Centered in the viewport. The `hidden` attribute is toggled by receiver.js.
   Override default display:none from `hidden` to use flex when visible.
   ────────────────────────────────────────────────────────────────────────── */

#buffering {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
}

#buffering[hidden] {
  display: none;
}

.spinner {
  width: 72px;
  height: 72px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Info overlay ────────────────────────────────────────────────────────────
   Bottom-anchored gradient panel.
   Fades in/out via the `.visible` class toggled by receiver.js.
   ────────────────────────────────────────────────────────────────────────── */

#overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;

  /* Dark gradient from bottom — lets video show above, info readable below */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.55) 22%,
    transparent 55%
  );

  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

#overlay.visible {
  opacity: 1;
}

/* ── Metadata row ────────────────────────────────────────────────────────────
   Poster thumbnail (if available) + title/subtitle text.
   80px horizontal padding keeps content inside TV safe zones.
   ────────────────────────────────────────────────────────────────────────── */

#metadata {
  display: flex;
  align-items: flex-end;
  gap: 28px;
  padding: 0 80px 20px;
}

#poster {
  width: 110px;
  height: 165px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
}

#poster[hidden] {
  display: none;
}

#text-info {
  flex: 1;
  min-width: 0;
  padding-bottom: 4px;
}

/* Subtitle: "Series · Season 1 · Episode 3" */
#subtitle {
  font-size: 30px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

#subtitle:empty {
  display: none;
}

/* Title: movie/episode name */
#title {
  font-size: 54px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* ── Progress row ────────────────────────────────────────────────────────────
   Current time — progress bar — total duration.
   48px bottom padding accounts for TV safe zone.
   ────────────────────────────────────────────────────────────────────────── */

#progress-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 80px 52px;
}

.time {
  font-size: 28px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 64px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

#time-total {
  text-align: right;
}

#progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
  transition: width 0.25s linear;
}
