/* ==========================================================================
   Remux Series & Detail Page Layout Overhaul
   ========================================================================== */

/* Completely hide React-managed cast buttons cleanly via CSS */
.headerCastButton,
.remux-player-osd-cast-btn,
.btnCast,
button[data-action="cast"],
button[aria-controls="app-remote-play-menu"],
button[aria-controls="app-remote-play-active-menu"] {
  display: none !important;
}

/* Completely hide duplicate floating logo */
#itemDetailPage .detailLogo {
  display: none !important;
}

#itemDetailPage .detailPageWrapperContainer {
  position: relative !important;
  z-index: 2 !important;
  width: 100% !important;
  min-height: auto !important;
}

/* Primary Container: 2-Column CSS Grid (Poster on left, Title + Synopsis on right) */
#itemDetailPage .detailPagePrimaryContainer,
.layout-desktop #itemDetailPage .detailPagePrimaryContainer,
.layout-tv #itemDetailPage .detailPagePrimaryContainer,
#itemDetailPage:not(.noBackdrop) .detailPagePrimaryContainer,
.layout-desktop #itemDetailPage:not(.noBackdrop) .detailPagePrimaryContainer,
.layout-tv #itemDetailPage:not(.noBackdrop) .detailPagePrimaryContainer {
  display: grid !important;
  grid-template-columns: 240px 1fr !important;
  grid-template-rows: auto auto !important;
  column-gap: 2.5rem !important;
  row-gap: 0.4rem !important;
  padding: 3rem 3.3% 1rem 3.3% !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  position: relative !important;
  margin-top: 0 !important;
  background: linear-gradient(180deg, rgba(16, 16, 16, 0.4) 0%, rgba(16, 16, 16, 0.96) 100%) !important;
  box-sizing: border-box !important;
  align-items: start !important;
  z-index: 2 !important;
}

/* Left Column: Poster Card */
#itemDetailPage .detailImageContainer.hide-mobile {
  grid-column: 1 !important;
  grid-row: 1 / span 2 !important;
  display: block !important;
  width: 240px !important;
  max-width: 28vw !important;
  position: relative !important;
  top: 0 !important;
  left: 0 !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

#itemDetailPage .detailImageContainer .card,
#itemDetailPage .detailImageContainer .cardBox,
#itemDetailPage .detailImageContainer .cardScalable {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  width: 100% !important;
}

#itemDetailPage .detailImageContainer .card {
  border-radius: 8px !important;
  overflow: hidden !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#itemDetailPage .detailImageContainer .cardImageContainer {
  aspect-ratio: 2 / 3 !important;
  background-size: cover !important;
  background-position: center !important;
}

/* Right Column, Row 1: Ribbon (Title, Rating, Buttons) */
#itemDetailPage .detailRibbon,
.layout-desktop #itemDetailPage .detailRibbon {
  grid-column: 2 !important;
  grid-row: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  position: relative !important;
  z-index: 3 !important;
}

#itemDetailPage .detailRibbon .infoWrapper {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

#itemDetailPage .nameContainer {
  margin: 0 0 0.4rem 0 !important;
}

#itemDetailPage .itemName {
  font-size: 2.6rem !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  margin: 0 !important;
  color: #ffffff !important;
  letter-spacing: -0.02em !important;
}

#itemDetailPage .itemMiscInfo {
  font-size: 0.95rem !important;
  color: rgba(255, 255, 255, 0.65) !important;
  margin: 0.35rem 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
}

#itemDetailPage .mainDetailButtons {
  display: flex !important;
  align-items: center !important;
  gap: 1rem !important;
  margin: 1.2rem 0 0.4rem 0 !important;
}

/* Primary Play Button Upgrade */
#itemDetailPage .mainDetailButtons .btnPlay {
  background: #e50914 !important;
  color: #ffffff !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
  padding: 0.75rem 1.8rem !important;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.6rem !important;
  text-transform: none !important;
  box-shadow: 0 4px 14px rgba(229, 9, 20, 0.4) !important;
}

#itemDetailPage .mainDetailButtons .btnPlay:hover {
  background: #f40612 !important;
  transform: scale(1.03) !important;
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.6) !important;
}

#itemDetailPage .mainDetailButtons .btnPlay .detailButton-icon {
  margin: 0 !important;
  font-size: 1.4rem !important;
  color: #ffffff !important;
}

#itemDetailPage .mainDetailButtons .btnPlay .detailButton-text {
  font-size: 0.98rem !important;
  font-weight: 600 !important;
  margin: 0 !important;
  color: #ffffff !important;
}

/* Right Column, Row 2: Primary Content (Overview/Synopsis, Genres) */
#itemDetailPage .detailPagePrimaryContent {
  grid-column: 2 !important;
  grid-row: 2 !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: 900px !important;
}

#itemDetailPage .detailSectionContent {
  margin: 0 !important;
  padding: 0 !important;
}

#itemDetailPage .itemGenres {
  font-size: 0.9rem !important;
  color: rgba(255, 255, 255, 0.55) !important;
  margin: 0 0 0.5rem 0 !important;
}

#itemDetailPage .overview {
  font-size: 1.05rem !important;
  line-height: 1.6 !important;
  color: rgba(255, 255, 255, 0.85) !important;
  margin: 0.4rem 0 1rem 0 !important;
  max-width: 850px !important;
}

/* Secondary Container: clean positioning right under primary container */
#itemDetailPage .detailPageSecondaryContainer {
  position: relative !important;
  clear: both !important;
  margin-top: 1rem !important;
  padding-top: 0 !important;
  z-index: 2 !important;
}

/* Delete/hide native Seasons carousel, list, and headers on Series pages */
#itemDetailPage #childrenCollapsible,
#itemDetailPage #listChildrenCollapsible,
/* Only hide seasons and schedule inside the series detail page itself */
body.remux-series-active #itemDetailPage #childrenCollapsible,
body.remux-series-active #itemDetailPage #listChildrenCollapsible,
body.remux-series-active #itemDetailPage .nextUpSection,
body.remux-series-active #itemDetailPage .seasonsSection,
body.remux-series-active #itemDetailPage #seasonsCollapsible,
body.remux-series-active #itemDetailPage [data-type="Season"],
body.remux-series-active #itemDetailPage .childrenSection,
body.remux-series-active #itemDetailPage .seriesScheduleSection,
body.remux-series-active #itemDetailPage #seriesScheduleList {
  display: none !important;
}

/* Guard: Episodes section should ONLY be visible when a TV series is actively viewed */
body:not(.remux-series-active) .remux-episodes-section {
  display: none !important;
}

/* ==========================================================================
   Proprietary Netflix-Style Episodes Section
   ========================================================================== */

.remux-episodes-section {
  margin: 1.5rem 0 3.5rem 0;
  padding: 0 3.3%;
  box-sizing: border-box;
}

.remux-episodes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 1rem;
}

.remux-episodes-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.02em;
}

.remux-season-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.remux-season-label {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
}

.remux-season-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #242424;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  padding: 0.6rem 2.6rem 0.6rem 1.2rem;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.3rem;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.remux-season-select:hover {
  background-color: #2e2e2e;
  border-color: rgba(255, 255, 255, 0.55);
}

.remux-season-select:focus {
  outline: none;
  border-color: #e50914;
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.4);
}

/* Episodes List */
.remux-episode-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.remux-episode-row {
  display: flex;
  align-items: center;
  padding: 1.1rem 1.4rem;
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  gap: 1.4rem;
  position: relative;
}

.remux-episode-row:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.remux-episode-row:active {
  transform: scale(0.996);
}

.remux-episode-index {
  font-size: 1.45rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  min-width: 2.2rem;
  text-align: center;
  flex-shrink: 0;
}

.remux-episode-thumb-container {
  position: relative;
  width: 180px;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #141414;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}

.remux-episode-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.remux-episode-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.remux-episode-row:hover .remux-episode-play-overlay {
  opacity: 1;
}

.remux-episode-play-icon {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.remux-episode-play-icon svg {
  width: 18px;
  height: 18px;
  fill: #111111;
  margin-left: 2px;
}

.remux-episode-duration-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.remux-episode-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: #e50914;
}

.remux-episode-played-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #46d369;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
}

.remux-episode-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.remux-episode-title-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.remux-episode-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.remux-episode-airdate {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.5);
}

.remux-episode-overview {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.remux-episode-row:hover .remux-episode-overview {
  color: rgba(255, 255, 255, 0.88);
}

/* ==========================================================================
   Stream / Torrent Selector & Popover
   ========================================================================== */

.remux-stream-picker-btn {
  background: rgba(255, 255, 255, 0.06) !important;
  color: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 6px !important;
  padding: 0.35rem 0.75rem !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-transform: none !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
}

.remux-stream-picker-btn:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

.remux-stream-picker-btn .material-icons {
  font-size: 1rem !important;
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Minimalist Stream Popover (Jellyflix aesthetic) */
.remux-stream-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 1.4rem;
  background: rgba(20, 20, 20, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
  z-index: 10000;
  width: 520px;
  max-width: 92vw;
  max-height: 480px;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  animation: remuxFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.remux-stream-popover-header {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.2rem 0.2rem 0.5rem 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 0.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.remux-stream-item {
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: #ffffff;
  transition: all 0.18s ease;
  gap: 0.35rem;
  position: relative;
}

.remux-stream-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  border-left-color: rgba(255, 255, 255, 0.4);
}

.remux-stream-item.is-selected {
  border-color: rgba(229, 9, 20, 0.35) !important;
  border-left-color: #e50914 !important;
  background: rgba(229, 9, 20, 0.08) !important;
}

.remux-stream-line1 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.remux-stream-line2 {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.remux-stream-item:hover .remux-stream-line2 {
  color: rgba(255, 255, 255, 0.75);
}

/* Minimalist Refined Badges (Subdued translucent styling) */
.remux-pill-rd {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0.02em;
}

.remux-pill-res {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.remux-pill-res-4k {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  letter-spacing: 0.04em;
}

.remux-pill-codec {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 1px 4px;
}

.remux-pill-audio {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}

.remux-pill-seeders {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.72rem;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.remux-pill-size {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.72rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.remux-pill-rec {
  background: rgba(229, 9, 20, 0.12);
  color: #ff6b6b;
  border: 1px solid rgba(229, 9, 20, 0.28);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.remux-pill-selected {
  color: #ff6b6b;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
}

/* Toast feedback when playback is initiated */
.remux-playback-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(18, 18, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85);
  z-index: 10000;
  color: #ffffff;
  font-size: 0.95rem;
  animation: remuxFadeIn 0.2s ease;
}

@keyframes remuxFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.remux-spinner-icon {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #e50914;
  border-radius: 50%;
  animation: remuxSpin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ==========================================================================
   Player OSD Stream Identifier & Floating Playback HUD
   ========================================================================== */

/* Player OSD Stream Badge */
.remux-player-stream-hud {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  margin-top: 0.35rem !important;
  background: rgba(0, 0, 0, 0.65) !important;
  padding: 0.25rem 0.65rem !important;
  border-radius: 6px !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  max-width: 90vw !important;
  overflow: hidden !important;
  flex-wrap: wrap !important;
  backdrop-filter: blur(8px) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6) !important;
}

.remux-hud-release {
  font-size: 0.75rem !important;
  color: rgba(255, 255, 255, 0.75) !important;
  margin-left: 0.25rem !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  max-width: 340px !important;
}

/* Floating HUD on playback start */
.remux-playback-start-hud {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 18, 18, 0.94);
  border: 1px solid rgba(70, 211, 105, 0.5);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.9);
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  animation: remuxFadeDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  backdrop-filter: blur(10px);
}

@keyframes remuxFadeDown {
  from { opacity: 0; transform: translate(-50%, -15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.remux-hud-badge-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.remux-hud-title {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Episode row active stream badge */
.remux-row-active-badge {
  background: rgba(70, 211, 105, 0.18);
  color: #46d369;
  border: 1px solid rgba(70, 211, 105, 0.4);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  animation: remuxFadeIn 0.2s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #itemDetailPage .detailPagePrimaryContainer,
  .layout-desktop #itemDetailPage .detailPagePrimaryContainer {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto !important;
    text-align: center !important;
    padding: 1.5rem 1rem !important;
  }
  #itemDetailPage .detailImageContainer.hide-mobile {
    grid-column: 1 !important;
    grid-row: 1 !important;
    margin: 0 auto !important;
    width: 180px !important;
  }
  #itemDetailPage .detailRibbon {
    grid-column: 1 !important;
    grid-row: 2 !important;
    align-items: center !important;
  }
  #itemDetailPage .detailPagePrimaryContent {
    grid-column: 1 !important;
    grid-row: 3 !important;
  }
  #itemDetailPage .mainDetailButtons {
    justify-content: center !important;
  }
  .remux-episode-row {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  .remux-episode-thumb-container {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
  }
  .remux-stream-popover {
    width: calc(100vw - 2rem);
    right: 0.5rem;
  }
}


/* ==========================================================================
   Movie Streams & Active Badge
   ========================================================================== */
.remux-movie-stream-btn {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 6px !important;
  padding: 0.72rem 1.4rem !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  cursor: pointer !important;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease !important;
}

.remux-movie-stream-btn:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  transform: scale(1.03) !important;
}

.remux-movie-active-badge {
  background: rgba(70, 211, 105, 0.2);
  color: #46d369;
  border: 1px solid rgba(70, 211, 105, 0.45);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  display: inline-flex;
  align-items: center;
}

/* ==========================================================================
   Continue Watching Card Info (Circled i) Button
   ========================================================================== */
.remux-card-info-btn {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: rgba(16, 16, 16, 0.78) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  z-index: 20 !important;
  padding: 0 !important;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6) !important;
}

.remux-card-info-btn:hover {
  transform: scale(1.15) !important;
  background: #e50914 !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 14px rgba(229, 9, 20, 0.75) !important;
}

.remux-card-info-btn .material-icons {
  font-size: 19px !important;
  line-height: 19px !important;
  color: #ffffff !important;
}

/* ==========================================================================
   Target Episode Highlight & Smooth Pulse
   ========================================================================== */
@keyframes remuxGlowPulse {
  0% {
    box-shadow: 0 0 0 rgba(229, 9, 20, 0);
    background: rgba(229, 9, 20, 0.05);
    border-color: rgba(229, 9, 20, 0.5);
  }
  30% {
    box-shadow: 0 0 28px rgba(229, 9, 20, 0.85);
    background: rgba(229, 9, 20, 0.25);
    border-color: #e50914;
  }
  65% {
    box-shadow: 0 0 16px rgba(229, 9, 20, 0.5);
    background: rgba(229, 9, 20, 0.15);
    border-color: rgba(229, 9, 20, 0.7);
  }
  100% {
    box-shadow: 0 0 0 rgba(229, 9, 20, 0);
    background: transparent;
    border-color: transparent;
  }
}

.remux-episode-row.remux-episode-target-glow {
  animation: remuxGlowPulse 3.5s ease-out forwards !important;
  border: 1px solid #e50914 !important;
}

/* ==========================================================================
   Hide Native Movie / Episode "Versions" & Redundant Track Menus
   ========================================================================== */
#itemDetailPage .selectSourceContainer,
#itemDetailPage .trackSelections,
#itemDetailPage .btnSplitVersions,
.selectSourceContainer,
.btnSplitVersions {
  display: none !important;
}

/* ==========================================================================
   Player Subtitle & Audio ActionSheet Scrollability Fix
   ========================================================================== */
.actionSheet,
.actionSheetScroller,
.actionSheetContent,
.actionsheetList,
.formDialog,
.formDialogContent {
  max-height: 80vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.actionsheetList {
  display: flex !important;
  flex-direction: column !important;
}

/* ==========================================================================
   In-Player Video OSD Stream Switcher
   ========================================================================== */
.remux-player-osd-stream-btn {
  margin: 0 4px !important;
  color: rgba(255, 255, 255, 0.85) !important;
  cursor: pointer !important;
  transition: color 0.15s ease, transform 0.15s ease !important;
}

.remux-player-osd-stream-btn:hover {
  color: #e50914 !important;
  transform: scale(1.12) !important;
}

.remux-player-osd-stream-btn .material-icons {
  font-size: 1.4rem !important;
}

/* ==========================================================================
   Chromecast Ultra Cast UI Purged
   ========================================================================== */
.headerCastButton,
.headerButton.headerCastButton,
.osdHeader .headerCastButton,
.btnCast,
button[data-action="cast"],
button[aria-controls="app-remote-play-menu"],
button[aria-controls="app-remote-play-active-menu"],
.remux-player-osd-cast-btn,
.remux-cast-picker-backdrop,
.remux-cast-picker-popover {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ==========================================================================
   Watch Together (SyncPlay) Integration
   ========================================================================== */
.headerSyncButton,
.headerButton.headerSyncButton,
.osdHeader .headerSyncButton {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  transition: color 0.15s ease, transform 0.15s ease !important;
}

.headerSyncButton.hide {
  display: inline-flex !important;
}

.headerSyncButton:hover {
  color: #00a4dc !important;
  transform: scale(1.08) !important;
}

.headerSyncButton .material-icons,
.btnSyncPlay .material-icons {
  font-size: 1.45rem !important;
}

.headerSyncButton .material-icons::before {
  content: 'groups';
}

/* ==========================================================================
   Minimalist Cast System (Jellyflix Theme)
   ========================================================================== */

.remux-cast-active {
  color: #e50914 !important;
  filter: drop-shadow(0 0 8px rgba(229, 9, 20, 0.6)) !important;
}

/* 1. Device Picker Popover */
.remux-cast-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.remux-cast-picker-popover {
  background: rgba(20, 20, 20, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  padding: 18px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  animation: remuxFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.remux-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.remux-picker-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.9);
}

.remux-picker-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.remux-picker-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.remux-device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.remux-device-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.remux-device-row:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.remux-device-row.is-active {
  background: rgba(229, 9, 20, 0.08);
  border-color: rgba(229, 9, 20, 0.3);
}

.remux-device-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

.remux-device-row.is-active .remux-device-icon {
  background: rgba(229, 9, 20, 0.2);
  color: #ff4d4d;
}

.remux-device-info {
  flex: 1;
  min-width: 0;
}

.remux-device-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
}

.remux-device-desc {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remux-device-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.02em;
}

.remux-device-badge.active {
  background: rgba(229, 9, 20, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(229, 9, 20, 0.3);
}

.remux-device-action {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.15s ease;
}

.remux-device-row:hover .remux-device-action {
  background: #e50914;
  color: #ffffff;
}

/* Remote / Other Wi-Fi Guidance Card */
.remux-cast-hint-card {
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.remux-hint-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}

.remux-hint-body {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.35;
}

.remux-btn-browser-cast {
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.remux-btn-browser-cast:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* 2. In-Player "Now Casting" HUD Overlay */
.remux-player-cast-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(18, 18, 18, 0.88) 0%, rgba(10, 10, 10, 0.98) 100%);
  pointer-events: auto;
  color: #ffffff;
  padding: 24px;
  box-sizing: border-box;
  text-align: center;
  animation: remuxFadeIn 0.25s ease;
}

.remux-player-cast-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 440px;
}

.remux-cast-pulse-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(229, 9, 20, 0.12);
  border: 1px solid rgba(229, 9, 20, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff4d4d;
  animation: remuxPulseCast 2.5s infinite ease-in-out;
}

.remux-cast-pulse-icon .material-icons {
  font-size: 1.8rem;
}

@keyframes remuxPulseCast {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(229, 9, 20, 0.35);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 24px 6px rgba(229, 9, 20, 0.25);
  }
}

.remux-cast-media-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.remux-cast-device-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.remux-cast-device-pill .remux-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e50914;
  box-shadow: 0 0 6px #e50914;
}

.remux-cast-subtext {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
  max-width: 320px;
  line-height: 1.4;
}

.remux-btn-stop-cast {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.remux-btn-stop-cast:hover {
  background: rgba(229, 9, 20, 0.2);
  border-color: rgba(229, 9, 20, 0.5);
  color: #ff6b6b;
}

/* In-Player Subtitle Sync Button in OSD */
.remux-player-osd-subsync-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.82) !important;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  padding: 0 6px !important;
  vertical-align: middle;
}

.remux-player-osd-subsync-btn:hover {
  color: #ffffff !important;
  transform: scale(1.06);
}

.remux-player-osd-subsync-btn.has-offset {
  color: #e50914 !important;
}

.remux-player-osd-subsync-btn.has-offset .remux-sync-tag {
  background: rgba(229, 9, 20, 0.2);
  border: 1px solid rgba(229, 9, 20, 0.4);
  border-radius: 4px;
  padding: 1px 4px;
  color: #ff6b6b;
}

/* 3. In-Player Subtitle Offset & Auto-Sync Popover */
.remux-subsync-popover {
  position: fixed;
  background: rgba(20, 20, 20, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
  z-index: 9999999;
  width: 320px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: remuxFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.remux-subsync-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.remux-subsync-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.remux-btn-offset {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 6px 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.remux-btn-offset:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.remux-btn-offset.reset {
  background: rgba(229, 9, 20, 0.12);
  border-color: rgba(229, 9, 20, 0.3);
  color: #ff6b6b;
}

.remux-btn-neural-sync {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.remux-btn-neural-sync:hover {
  background: #e50914;
  border-color: #e50914;
  color: #ffffff;
}


