#view-player {
  z-index: 60;
  background: transparent;
  pointer-events: none;
}

#view-player * {
  pointer-events: auto;
}

.player-osd {
  position: absolute;
  bottom: 20px;
  left: 40px;
  right: 40px;
  background: rgba(30, 30, 50, 0.75);
  border-radius: var(--radius-art);
  padding: 16px 32px;
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  z-index: 60;
}

.osd-channel {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.osd-channel-number {
  font-size: 40px;
  font-weight: 700;
  color: var(--accent-text);
  min-width: 60px;
}

.osd-channel-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.osd-channel-name {
  font-size: 36px;
  font-weight: 600;
}

.osd-programme {
  margin-top: 4px;
}

.osd-now-label {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.osd-programme-detail {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.osd-programme-icon {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.osd-programme-info {
  flex: 1;
  min-width: 0;
}

.osd-programme-title {
  font-size: 32px;
  font-weight: 500;
  margin-bottom: 2px;
}

.osd-programme-time {
  font-size: 24px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 16px;
}

.osd-remaining {
  color: var(--text-muted);
  font-size: 22px;
}

.osd-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.osd-time-current,
.osd-time-end {
  font-size: 22px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.osd-time-current {
  color: var(--accent-text);
  font-weight: 600;
}

.osd-progress {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex: 1;
}

.osd-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dim));
  border-radius: var(--radius-sm);
  transition: width 1s linear;
}

/* VOD transport controls (play/pause, ±10s) */
.osd-transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}

.osd-btn {
  min-width: 72px;
  height: 56px;
  padding: 0 18px;
  font-size: 24px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.osd-btn:hover,
.osd-btn:focus {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: #fff;
  outline: none;
}

.osd-btn-play {
  min-width: 88px;
  font-size: 26px;
}

/* Back/exit button in the OSD header (clickable on desktop; OK/Back on the TV). */
.osd-back {
  min-width: 56px;
  height: 56px;
  padding: 0;
  font-size: 32px;
  margin-right: 8px;
  flex-shrink: 0;
}

/* Fullscreen toggle sits at the far right of the channel row. */
.osd-fullscreen {
  min-width: 56px;
  height: 56px;
  padding: 0;
  font-size: 26px;
  margin-left: auto;
  flex-shrink: 0;
}

.osd-progress[data-seekbar] {
  cursor: pointer;
  height: 36px;
  padding: 15px 0;
  background-clip: content-box;
  overflow: visible;
}

.osd-progress[data-seekbar] .osd-progress-bar {
  position: relative;
  overflow: visible;
  transition: width 0.12s linear;
}

.osd-progress[data-seekbar] .osd-progress-bar::after {
  content: '';
  position: absolute;
  right: -9px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.osd-description {
  font-size: 24px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.osd-next {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 24px;
  color: var(--text-secondary);
}

.osd-next-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.osd-next-title {
  flex: 1;
}

.osd-next-time {
  color: var(--text-muted);
  margin-left: 8px;
}

.osd-message {
  font-size: 26px;
  color: var(--warning);
  text-align: center;
  padding: 20px;
}

/* Buffering / loading spinner over the video */
.player-spinner {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 65;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.35);
}

/* Player sidebar overlay (Magic Remote / left key) */
.player-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  width: 420px;
  height: 100%;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  border-right: 1px solid var(--border);
}

.player-sidebar.visible {
  transform: translateX(0);
}

.player-sidebar .sidebar-title {
  padding: 20px 24px;
  font-size: 24px;
  font-weight: 600;
  color: var(--accent-text);
  border-bottom: 1px solid var(--border);
}

.player-sidebar .sidebar-search-input {
  margin: 12px;
  padding: 18px 16px;
  font-size: 26px;
  background: var(--surface-a);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  flex-shrink: 0;
}

.player-sidebar .sidebar-search-input::placeholder {
  color: var(--text-muted);
}

.player-sidebar .sidebar-search-input.focused,
.player-sidebar .sidebar-search-input:focus {
  border-color: var(--accent);
  background: var(--surface-b);
}

.player-sidebar .sidebar-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.player-sidebar .sidebar-tab {
  padding: 8px 14px;
  font-size: 18px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}

.player-sidebar .sidebar-tab.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
  background: var(--surface-a);
}

.player-sidebar .sidebar-tab:hover {
  background: var(--surface-b);
}

.player-sidebar .sidebar-channel-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  flex: 1;
  overflow-y: auto;
}

.player-sidebar .sidebar-ch-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  gap: 14px;
  height: 90px;
  flex-shrink: 0;
}

.player-sidebar .sidebar-ch-item.playing {
  background: rgba(228, 32, 47, 0.16);
  border-color: var(--accent-dim);
}

.player-sidebar .sidebar-ch-item.focused {
  background: var(--surface-c);
  border-color: var(--text-primary);
}

.player-sidebar .sidebar-ch-item.playing.focused {
  background: rgba(228, 32, 47, 0.26);
  border-color: var(--focus-ring);
}

.player-sidebar .sidebar-ch-item .ch-num {
  font-size: 18px;
  color: var(--text-muted);
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.player-sidebar .sidebar-ch-item .ch-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.player-sidebar .sidebar-ch-item .ch-logo-placeholder {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  /* Muted, matching .channel-logo-placeholder and .poster-fallback: a letter
     stands in for missing artwork, it is not a signal worth the accent. */
  color: var(--text-muted);
  flex-shrink: 0;
}

.player-sidebar .sidebar-ch-item .ch-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-sidebar .sidebar-ch-item .ch-name {
  font-size: 24px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-sidebar .sidebar-ch-item .ch-now {
  font-size: 20px;
  line-height: 1.25;
  color: var(--text-secondary);
  overflow: hidden;
  white-space: nowrap;
}

.player-sidebar .sidebar-ch-item .ch-now .ch-now-text {
  display: inline-block;
  white-space: nowrap;
}

.player-sidebar .sidebar-ch-item .ch-now .ch-now-text.scrolling {
  animation: marquee-bounce 6s ease-in-out infinite;
}

@keyframes marquee-bounce {
  0%, 15% { transform: translateX(0); }
  45%, 55% { transform: translateX(var(--scroll-dist)); }
  85%, 100% { transform: translateX(0); }
}

/* Player right menu (Magic Remote / right key) */
.player-menu {
  position: absolute;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  padding: 24px;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  border-left: 1px solid var(--border);
}

.player-menu.visible {
  transform: translateX(0);
}

.player-menu .menu-header {
  margin-bottom: 32px;
}

.player-menu .menu-header h2 {
  font-size: 26px;
  color: var(--accent-text);
}

.player-menu .menu-header .menu-subtitle {
  font-size: 18px;
  color: var(--text-muted);
  margin-top: 4px;
}

.player-menu .menu-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-size: 22px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap; /* keep a row's label on one line; the value chip ellipsizes instead */
}

.player-menu .menu-item.focused {
  background: var(--surface-c);
  border-color: var(--text-primary);
}

.player-menu .menu-item:hover {
  background: var(--surface-b);
  border-color: var(--text-muted);
}

.menu-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.menu-dot.red { background: #e74c3c; }
.menu-dot.green { background: #2ecc71; }
.menu-dot.yellow { background: #f1c40f; }
.menu-dot.blue { background: #3498db; }

/* Glyph in the colour-dot slot */
.menu-icon {
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  font-size: 18px;
  line-height: 1;
}
.menu-icon.audio { color: #9b59b6; }

/* Current audio track shown on the "Audio Track" row */
.player-menu .menu-item-value {
  margin-left: auto;
  padding-left: 12px;
  font-size: 18px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0; /* allow the chip to shrink (and ellipsize) so the label keeps its line */
  max-width: 140px;
}

/* Fixed check / chevron column in the audio sub-menu so labels align */
.player-menu .menu-check {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  color: #2ecc71;
  font-weight: 700;
}

.player-menu .menu-check.menu-back {
  color: var(--text-primary);
  font-size: 26px;
  line-height: 1;
}

.player-menu .menu-track-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-menu .menu-item.unavailable {
  opacity: 0.4;
}
.player-menu .menu-item.unavailable.focused {
  opacity: 0.6;
}

/* "Próximo episódio em Ns" card (autoplay-next countdown), bottom-right. */
.next-ep-overlay {
  position: absolute;
  right: 40px;
  bottom: 40px;
  z-index: 75;
  max-width: 560px;
}

.next-ep-card {
  display: flex;
  gap: 18px;
  padding: 18px;
  background: rgba(20, 20, 32, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  backdrop-filter: blur(16px);
  box-shadow: var(--elev-2);
}

.next-ep-thumb {
  width: 160px;
  height: 90px;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-tertiary);
}

.next-ep-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.next-ep-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.next-ep-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-text);
}

.next-ep-title {
  font-size: 26px;
  font-weight: 600;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-ep-sub {
  font-size: 20px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.next-ep-actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.next-ep-play,
.next-ep-cancel {
  border: 2px solid transparent;
  cursor: pointer;
}

.next-ep-play.focused,
.next-ep-cancel.focused,
.next-ep-play:hover,
.next-ep-cancel:hover {
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
