/* Controles persistentes y separados de las zonas de navegación. */
#detailDialog[open] > #closeDetail {
  position: sticky !important;
  z-index: 10030 !important;
  top: max(12px, env(safe-area-inset-top)) !important;
  right: auto !important;
  grid-column: 1 / -1;
  grid-row: 1;
  align-self: start;
  justify-self: end;
  display: grid;
  margin: 12px 12px -52px auto;
  place-items: center;
  box-shadow: 0 8px 24px #000c;
  backdrop-filter: blur(12px);
}

#detailDialog[open] > .detail-poster { grid-column: 1; grid-row: 1; }
#detailDialog[open] > .detail-content { grid-column: 2; grid-row: 1; }

/* La X permanece a la derecha, apenas debajo del volumen nativo. */
#playerDialog[open] > #closePlayer {
  position: absolute !important;
  z-index: 10030 !important;
  top: calc(env(safe-area-inset-top) + 54px) !important;
  right: max(12px, env(safe-area-inset-right)) !important;
  left: auto !important;
  margin: 0 !important;
  box-shadow: 0 8px 24px #000c;
  backdrop-filter: blur(12px);
}

.live-folder.has-adult-art .live-folder-art,
.content-card.is-adult-content .poster {
  background: #080808;
}

.live-folder.has-adult-art .live-folder-art > img,
.content-card.is-adult-content .poster > img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  object-position: center !important;
}

/* Tipo, año, clasificación y duración comparten una sola línea compacta. */
#detailDialog .detail-heading h2 {
  margin-top: 0;
  margin-bottom: 9px;
}

#detailDialog .detail-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 18px;
}

#detailDialog .detail-meta-row .detail-type-inline {
  display: inline-flex;
  align-items: center;
  margin: 0;
  color: #d6b35b;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 1.1px;
}

#detailDialog .detail-meta-row .detail-type-inline:not(:empty)::after {
  content: "·";
  margin-left: 5px;
  color: #8f8262;
}

#detailDialog .detail-meta-row .detail-meta {
  min-width: 0;
  margin: 0;
  line-height: 1.3;
}

/* La productora y la leyenda técnica no forman parte de la ficha pública. */
#detailDialog #detailTmdbCompanies,
#detailDialog #detailTmdbFacts > small {
  display: none !important;
}

/* Acciones compactas alineadas con el ajuste que acompañan. */
#detailDialog .detail-setting-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 14px 0 0;
}

#detailDialog .detail-setting-row .detail-inline-action {
  width: 132px;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 9px 10px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
}

#detailDialog .detail-setting-row .subtitle-control {
  width: auto;
  min-width: 0;
  margin: 0;
}

#detailDialog .detail-subtitle-row {
  margin-top: 10px;
}

@media (max-width: 560px) {
  #detailDialog .detail-heading h2 {
    margin-bottom: 6px;
  }

  #detailDialog .detail-meta-row {
    gap: 4px;
  }

  #detailDialog .detail-meta-row .detail-type-inline {
    font-size: 9px;
  }

  #detailDialog .detail-setting-row {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 7px;
  }

  #detailDialog .detail-setting-row .detail-inline-action {
    width: 104px;
    padding-inline: 6px;
    font-size: 9px;
  }

  #detailDialog .detail-setting-row .subtitle-control {
    padding: 10px;
    gap: 8px;
  }

  #detailDialog .detail-setting-row .subtitle-control small {
    display: none;
  }
}

@media (max-width: 760px),
       (orientation: landscape) and (max-height: 610px) {
  body.theme-blackeye .sidebar,
  body.theme-blackeye .app.sidebar-collapsed .sidebar {
    z-index: 10000 !important;
  }

  .home-curation-card { isolation: isolate; }
  .home-curation-dismiss,
  .home-curation-card.is-selected .home-curation-dismiss {
    z-index: 40 !important;
    top: 7px !important;
    right: 7px !important;
    left: auto !important;
    width: 30px;
    height: 30px;
  }

  #detailDialog[open] > #closeDetail {
    top: calc(env(safe-area-inset-top) + 9px) !important;
    margin: 9px max(9px, env(safe-area-inset-right)) -49px auto;
  }

  #detailDialog[open] > .detail-poster,
  #detailDialog[open] > .detail-content {
    grid-column: auto;
    grid-row: auto;
  }

  #playerDialog[open] > #closePlayer {
    top: calc(env(safe-area-inset-top) + 50px) !important;
    right: calc(env(safe-area-inset-right) + 9px) !important;
    left: auto !important;
  }

  #adultPinDialog[open] {
    position: fixed !important;
    inset: max(14px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left)) !important;
    width: min(430px, calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 20px)) !important;
    max-width: 430px !important;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 28px) !important;
    margin: auto !important;
    overflow: auto;
  }
}
.home-curation-arrows [data-curation-all] {
  width: auto;
  min-width: 72px;
  padding: 0 10px;
  font-size: 7px;
  font-weight: 950;
  letter-spacing: .65px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .home-curation-arrows {
    display: flex !important;
  }

  .home-curation-arrows [data-direction] {
    display: grid !important;
  }

  .home-curation-arrows [data-curation-all] {
    display: grid;
    min-width: 68px;
    height: 30px;
  }
}

/* Navegación explícita de carruseles en el portal normal. El touchpad y el
   gesto táctil siguen funcionando, pero ya no son la única forma de avanzar. */
html:not(.blackeye-lite-mode) .home-curation-rail > header,
html:not(.blackeye-lite-mode) .movie-genre-rail > header {
  min-width: 0;
  align-items: center;
}

html:not(.blackeye-lite-mode) .home-curation-rail > header > div:first-child,
html:not(.blackeye-lite-mode) .movie-genre-rail > header > div:first-child {
  min-width: 0;
}

html:not(.blackeye-lite-mode) .home-curation-arrows,
html:not(.blackeye-lite-mode) .movie-genre-actions {
  display: flex !important;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

html:not(.blackeye-lite-mode) .home-curation-arrows button:not([hidden]),
html:not(.blackeye-lite-mode) .movie-genre-actions button:not([hidden]) {
  display: grid !important;
  place-items: center;
}

html:not(.blackeye-lite-mode) .home-curation-arrows [data-curation-all]:not([hidden]),
html:not(.blackeye-lite-mode) .movie-genre-actions [data-genre-all]:not([hidden]) {
  width: auto;
  min-width: 68px;
  padding-inline: 9px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  html:not(.blackeye-lite-mode) .home-curation-rail > header,
  html:not(.blackeye-lite-mode) .movie-genre-rail > header {
    gap: 8px;
  }

  html:not(.blackeye-lite-mode) .home-curation-arrows [data-direction]:not([hidden]),
  html:not(.blackeye-lite-mode) .movie-genre-actions [data-genre-direction]:not([hidden]) {
    display: grid !important;
    min-width: 30px;
    width: 30px;
    height: 30px;
    padding: 0;
  }

  html:not(.blackeye-lite-mode) .home-curation-rail > header h3,
  html:not(.blackeye-lite-mode) .movie-genre-rail > header h3 {
    overflow: hidden;
    font-size: 15px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

@media (max-width: 390px) {
  html:not(.blackeye-lite-mode) .home-curation-arrows,
  html:not(.blackeye-lite-mode) .movie-genre-actions {
    gap: 3px;
  }

  html:not(.blackeye-lite-mode) .home-curation-arrows [data-direction]:not([hidden]),
  html:not(.blackeye-lite-mode) .movie-genre-actions [data-genre-direction]:not([hidden]) {
    min-width: 28px;
    width: 28px;
    height: 28px;
  }

  html:not(.blackeye-lite-mode) .home-curation-arrows [data-curation-all]:not([hidden]),
  html:not(.blackeye-lite-mode) .movie-genre-actions [data-genre-all]:not([hidden]) {
    min-width: 57px;
    padding-inline: 5px;
    font-size: 6px;
  }
}

/* En canales en vivo el corazón sustituye al adorno de reproducción y es una
   acción independiente: el resto de la tarjeta conserva la apertura del canal. */
.content-card.is-live-card .poster::after {
  content: none !important;
  display: none !important;
}

.live-card-favorite {
  position: absolute;
  z-index: 12;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #e6c46f99;
  border-radius: 50%;
  background: #080706e6;
  color: #f0cf76;
  font: 900 23px/1 system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 7px 20px #000b;
  transition: transform .16s ease, color .16s ease, background .16s ease;
}

.live-card-favorite:hover,
.live-card-favorite:focus-visible {
  transform: scale(1.08);
  outline: 2px solid #f1d88d;
  outline-offset: 2px;
}

.live-card-favorite.is-favorite {
  border-color: #ff91bdcc;
  background: #1b0815ed;
  color: #ff78af;
}

.search-result-card .live-card-favorite {
  right: 4px;
  bottom: 4px;
  width: 23px;
  height: 23px;
  font-size: 14px;
}

/* Whole station logos, shared by web, Kids and Lite. Movie/series art is untouched.
   Search uses the same cards outside #app, so do not restrict this to that node. */
html body .content-card.is-live-card .poster { background: #0b0d10 !important; }
html body .content-card.is-live-card .poster > img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
  box-sizing: border-box !important;
  padding: 8px !important;
  transform: none !important;
}
html body .channel-guide-channel > img,
html body .us-open-channel-thumb > img {
  object-fit: contain !important;
  object-position: center !important;
  box-sizing: border-box !important;
  padding: 4px !important;
  transform: none !important;
}

/* Device-local header clock. */
.top-actions > .device-local-time {
  display: inline-block;
  flex: 0 0 auto;
  align-self: center;
  min-width: 5ch;
  color: #f0dfb0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: .02em;
  text-align: center;
  white-space: nowrap;
}
@media (max-width: 760px), (max-width: 960px) and (max-height: 520px) {
  .top-actions > .device-local-time { font-size: 13px; }
}
html.blackeye-fire-tv .top-actions > .device-local-time { font-size: 17px; }
@media (min-width: 761px) and (max-width: 1100px) and (min-height: 611px) {
  html:not(.blackeye-fire-tv) .topbar { flex-wrap: wrap; gap: 12px; }
  html:not(.blackeye-fire-tv) .topbar-copy { flex: 1 1 100%; }
  html:not(.blackeye-fire-tv) .top-actions { flex: 1 1 100%; width: 100%; }
  html:not(.blackeye-fire-tv) .top-actions .search { flex: 1 1 auto; width: auto; }
}

/* Continue Watching: same positions on web, touch and old/new APK shells. */
.multiview-choice-dialog {
  width: min(480px, calc(100vw - 32px)); max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px); box-sizing: border-box; overflow: auto;
  padding: 24px; border: 1px solid #d5b15b; border-radius: 16px;
  background: #111317; color: #fff; text-align: center;
}
.multiview-choice-dialog::backdrop { background: #000c; }
.multiview-choice-dialog h2 { margin: 0 0 8px; font-size: 26px; }
.multiview-choice-dialog p { margin: 0 0 20px; }
.multiview-choice-options { display: flex; gap: 14px; }
.multiview-choice-dialog button {
  min-height: 48px; padding: 12px; border: 1px solid #d5b15b;
  border-radius: 9px; background: #24221c; color: #f5d878; font-weight: 700;
}
.multiview-choice-options button { flex: 1; min-width: 0; }
.multiview-choice-dialog .multiview-choice-cancel { margin-top: 18px; }

html #app .home-curation-card[data-curation-key="continueWatching"] .home-curation-dismiss {
  left: auto !important; right: 7px !important;
}
html #app .home-curation-card[data-curation-key="continueWatching"] .home-curation-type {
  left: 7px !important; right: auto !important;
  max-width: calc(100% - 46px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#homeBrand, #mobileHomeBrand {cursor:default!important;pointer-events:none!important;}
