/* MovieLinkBD TV / D-pad navigation V76.51 */
:root {
  --mlbd-tv-focus: #39b9ff;
  --mlbd-tv-focus-soft: rgba(57, 185, 255, .28);
  --mlbd-tv-focus-bg: rgba(57, 185, 255, .10);
}

/* Keep native mouse/touch UI unchanged until a remote or keyboard is used. */
body.mlbd-tv-input {
  scroll-behavior: auto !important;
}

body.mlbd-tv-input a,
body.mlbd-tv-input button,
body.mlbd-tv-input input,
body.mlbd-tv-input select,
body.mlbd-tv-input textarea,
body.mlbd-tv-input [role="button"],
body.mlbd-tv-input [tabindex] {
  scroll-margin: 14vh 5vw;
}

body.mlbd-tv-input :focus {
  outline: 3px solid var(--mlbd-tv-focus) !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 5px var(--mlbd-tv-focus-soft), 0 10px 28px rgba(0,0,0,.38) !important;
  position: relative;
  z-index: 120 !important;
}

body.mlbd-tv-input :focus:not(:focus-visible) {
  outline: 3px solid var(--mlbd-tv-focus) !important;
}

body.mlbd-tv-input .movie-card:focus-within,
body.mlbd-tv-input .movie-card-view:focus-within,
body.mlbd-tv-input .ep-card:focus-within,
body.mlbd-tv-input [data-file-card]:focus-within {
  transform: translateY(-4px) scale(1.035);
  box-shadow: 0 0 0 3px var(--mlbd-tv-focus), 0 14px 34px rgba(0,0,0,.5) !important;
  z-index: 110;
}

body.mlbd-tv-input .movie-card,
body.mlbd-tv-input .movie-card-view,
body.mlbd-tv-input .ep-card,
body.mlbd-tv-input [data-file-card] {
  transition: transform .13s ease, box-shadow .13s ease;
}

body.mlbd-tv-input .movie-card a[data-mlbd-tv-primary="1"],
body.mlbd-tv-input .movie-card-view a[data-mlbd-tv-primary="1"] {
  border-radius: inherit;
}

body.mlbd-tv-input .cat-box,
body.mlbd-tv-input .cta-strip,
body.mlbd-tv-input .mlbd-search-quick-actions,
body.mlbd-tv-input .mlbd-inline-player__selectors,
body.mlbd-tv-input .pagination,
body.mlbd-tv-input .gdl-actions {
  scroll-behavior: auto !important;
}

body.mlbd-tv-input .cat-btn:focus,
body.mlbd-tv-input .cta-btn:focus,
body.mlbd-tv-input .mlbd-search-quick-btn:focus,
body.mlbd-tv-input .page-link:focus,
body.mlbd-tv-input .btn:focus,
body.mlbd-tv-input .gdl-action:focus {
  transform: scale(1.055);
  filter: brightness(1.12);
}

body.mlbd-tv-input input:focus,
body.mlbd-tv-input textarea:focus,
body.mlbd-tv-input select:focus {
  background: #08111f !important;
  color: #fff !important;
}

/* ArtPlayer and MovieLinkBD custom player controls. */
body.mlbd-tv-input .mlbd-inline-player__art:focus,
body.mlbd-tv-input .artplayer-app:focus {
  outline-offset: 1px !important;
}

body.mlbd-tv-input .mlbd-inline-selector:focus,
body.mlbd-tv-input .mlbd-inline-flyout button:focus,
body.mlbd-tv-input .art-control:focus,
body.mlbd-tv-input .art-setting-item:focus,
body.mlbd-tv-input .art-selector-item:focus {
  background: #15283a !important;
  color: #fff !important;
  transform: none !important;
}

/* Remote help appears only after TV/keyboard navigation is activated. */
.mlbd-tv-help {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 18px);
  z-index: 2147483000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 30px);
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(4, 10, 18, .96);
  color: #f8fafc;
  font: 700 13px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.mlbd-tv-help.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.mlbd-tv-help kbd {
  min-width: 28px;
  padding: 4px 7px;
  border: 1px solid #526176;
  border-bottom-width: 3px;
  border-radius: 5px;
  background: #182334;
  color: #fff;
  text-align: center;
  font: inherit;
}

/* Large-screen readability without changing the origin card grid. */
@media (min-width: 1100px) {
  body.mlbd-tv-input :focus {
    outline-width: 4px !important;
    outline-offset: 5px !important;
  }
  .mlbd-tv-help { font-size: 15px; padding: 12px 17px; }
}

@media (prefers-reduced-motion: reduce) {
  body.mlbd-tv-input *,
  .mlbd-tv-help { transition: none !important; animation: none !important; }
}

/* TV-only quick navigation ribbon. It is injected by JS and remains invisible
   for normal mouse/touch users. */
.mlbd-tv-quicknav { display: none; }
body.mlbd-tv-input .mlbd-tv-quicknav {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 1050;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(3, 8, 15, .97);
  scrollbar-width: none;
}
body.mlbd-tv-input .mlbd-tv-quicknav::-webkit-scrollbar { display: none; }
body.mlbd-tv-input .mlbd-tv-quicknav a,
body.mlbd-tv-input .mlbd-tv-quicknav button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid #334155;
  border-radius: 7px;
  background: #111827;
  color: #f8fafc;
  text-decoration: none;
  font-weight: 800;
  line-height: 1;
}
body.mlbd-tv-input .mlbd-tv-quicknav a[aria-current="page"] {
  background: #17314a;
  border-color: #4a7195;
}
