/* =========================================================
   Watch page — 3-column layout (episodes | player | info)
   Load AFTER your main stylesheet. Everything is scoped
   under .wp so it overrides the old .watch-page rules.
   ========================================================= */

.wp {
  --wp-bg: #1f1f26;
  --wp-panel: #181824;
  --wp-panel-2: #1c1b29;
  --wp-tile: #34343d;
  --wp-tile-text: #b3b3bd;
  --wp-purple: #8a2be2;
  --wp-text: #e6e6ee;
  --wp-muted: #a9a9b6;
  --wp-red: #ff3b30;
  --wp-green: #b4f0b0;
  --wp-pink: #f7b2d6;

  position: relative;
  isolation: isolate;
  background: var(--wp-bg);
  color: var(--wp-text);
  padding: 0 1.25rem 2rem;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: block;
  max-width: none;
}

/* blurred cover behind everything */
.wp .wp-backdrop {
  position: absolute; inset: 0; z-index: -1;
  background-size: cover; background-position: center;
  filter: blur(38px) saturate(.8); transform: scale(1.15);
  opacity: .28;
}

.wp .wp-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* breadcrumb */
.wp .wp-crumb,
.wp .wp-crumb.watch-breadcrumb {
  max-width: 1500px; margin: 0 auto;
  display: flex; flex-wrap: nowrap; align-items: center; gap: .4rem;
  padding: 1rem 0 .75rem; font-size: .78rem; color: var(--wp-muted);
  overflow: hidden; white-space: nowrap;
}
.wp .wp-crumb > * { flex: 0 0 auto; white-space: nowrap; }
/* long titles shrink with an ellipsis so the crumb stays on one line */
.wp .wp-crumb > a:nth-of-type(2) { flex: 0 1 auto; min-width: 0; max-width: 35%; overflow: hidden; text-overflow: ellipsis; }
.wp .wp-crumb > [aria-current] { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.wp .wp-crumb a { color: #d7d7e2; text-decoration: none; }
.wp .wp-crumb a:hover { color: #fff; }
.wp .wp-crumb [aria-current] { color: #8b8b99; }

.wp .wp-admin-link {
  display: inline-block; margin-bottom: .5rem;
  font-size: .75rem; font-weight: 600; color: #c9a8ff;
}

/* ---------- grid ---------- */
.wp .wp-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 290px;
  gap: 1.25rem;
  align-items: start;
  max-width: 1500px;
  margin: 0 auto;
}
.wp .wp-center { min-width: 0; width: auto; max-width: none; padding: 0; }

/* ---------- left: episodes ---------- */
.wp .wp-eps {
  background: var(--wp-panel);
  border-radius: 4px;
  overflow: visible;
  width: auto; height: auto; max-height: none; margin: 0; padding: 0;
}
.wp .wp-eps-head { padding: .9rem .9rem .7rem; }
.wp .wp-eps-title { margin: 0 0 .6rem; font-size: .78rem; font-weight: 600; color: #fff; }
.wp .wp-eps-tools { display: flex; gap: .6rem; align-items: center; }

.wp .wp-range { position: relative; display: flex; align-items: center; gap: .5rem; color: #d9d9e3; flex: 0 0 auto; }
.wp .wp-range-btn {
  display: inline-flex; align-items: center; gap: .55rem;
  background: transparent; border: 0; border-radius: 4px; padding: .35rem .4rem;
  color: #e6e6ee; font: 600 .75rem/1 inherit; font-family: inherit; cursor: pointer;
}
.wp .wp-range-btn:hover, .wp .wp-range.is-open .wp-range-btn { background: #272736; }
.wp .wp-range-btn svg { transition: transform .15s; }
.wp .wp-range.is-open .wp-range-btn svg { transform: rotate(180deg); }
.wp .wp-range-btn:focus-visible { outline: 2px solid var(--wp-purple); }
.wp .wp-range-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  min-width: 170px; max-height: 250px; overflow-y: auto;
  margin: 0; padding: .3rem; list-style: none;
  background: #242433; border: 1px solid #36364a; border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .55);
  scrollbar-width: thin; scrollbar-color: #4a4a5e transparent;
}
.wp .wp-range-menu[hidden] { display: none; }
.wp .wp-range-menu li {
  padding: .6rem .8rem; border-radius: 5px; cursor: pointer;
  font-size: .78rem; font-weight: 500; color: #d9d9e3; outline: 0;
}
.wp .wp-range-menu li:hover, .wp .wp-range-menu li:focus { background: #33334a; color: #fff; }
.wp .wp-range-menu li[aria-selected="true"] { background: var(--wp-purple); color: #fff; font-weight: 600; }

.wp .wp-epsearch {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem;
  background: #0f0f18; border-radius: 4px; padding: 0 .55rem; color: #cfcfdb;
}
.wp .wp-epsearch input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  color: #fff; font: 500 .72rem/1 inherit; font-family: inherit; padding: .6rem 0;
}
.wp .wp-epsearch input::placeholder { color: #8e8e9c; }
.wp .wp-epsearch:focus-within { outline: 2px solid var(--wp-purple); outline-offset: 0; }

.wp .wp-eps-body {
  position: relative;
  background: #1b1b27;
  padding: .75rem .9rem 1rem;
  max-height: none; overflow: visible; height: auto;
}
.wp .sidebar-ep-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem;
  padding: 0; margin: 0;
  max-height: none; height: auto; overflow: visible;
}
.wp .sidebar-ep-pill {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  height: 32px; padding: 0; margin: 0;
  background: var(--wp-tile); color: var(--wp-tile-text);
  border: 0; border-radius: 2px;
  font-size: .72rem; font-weight: 600; text-decoration: none;
  transition: background-color .15s, color .15s;
}
.wp .sidebar-ep-pill:hover { background: #45454f; color: #fff; }
.wp .sidebar-ep-pill.active,
.wp .sidebar-ep-pill[aria-current] { background: var(--wp-purple); color: #fff; }
.wp .sidebar-ep-pill.hidden { display: none; }
.wp .sidebar-ep-pill:focus-visible,
.wp .wp-ctl:focus-visible,
.wp .server-btn:focus-visible,
.wp .wp-rate-opts button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- center: player ---------- */
.wp .video-outer { background: #000; margin: 0; padding: 0; border-radius: 0; }
.wp .video-wrapper {
  position: relative; width: 100%; height: auto; padding: 0;
  aspect-ratio: 16 / 9; max-height: min(540px, 68vh); background: #000; overflow: hidden;
}
.wp .video-frame {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
}


/* controls bar */
.wp .wp-controls {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: .4rem 1rem;
  background: #15151f; padding: .65rem .8rem;
  font-size: .75rem;
}
.wp .wp-ctl-group { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem 1.1rem; }
.wp .wp-ctl {
  display: inline-flex; align-items: center; gap: .35rem;
  background: none; border: 0; padding: .2rem 0; margin: 0;
  color: #e6e6ee; font: 500 .75rem/1.2 inherit; font-family: inherit;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.wp .wp-ctl:hover { color: #fff; }
.wp .wp-ctl.is-disabled { opacity: .4; pointer-events: none; }
.wp .wp-state { font-weight: 600; }
.wp .wp-state.wp-on { color: #a35cf0; }
.wp .wp-state.wp-off { color: var(--wp-red); }
.wp .wp-w2g svg { color: #b06cf5; }
.wp .wp-w2g:disabled { opacity: .5; cursor: wait; }

/* servers */
.wp .wp-servers {
  display: flex; gap: 1rem; align-items: stretch;
  background: var(--wp-panel-2);
  margin-top: .6rem; padding: .55rem .7rem;
  border-radius: 4px;
}
.wp .wp-watching {
  flex: 0 0 170px; text-align: center;
  background: var(--wp-purple); color: #fff;
  padding: .5rem .6rem; border-radius: 2px;
  font-size: .68rem; line-height: 1.4;
  display: flex; flex-direction: column; justify-content: center;
}
.wp .wp-watching strong { font-weight: 600; }
.wp .wp-watching p { margin: .25rem 0 0; }

.wp .server-switcher {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .4rem;
  justify-content: center; margin: 0; padding: 0; background: none; border: 0;
}
.wp .server-language-group { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.wp .server-label {
  display: inline-flex; align-items: center; gap: .4rem;
  min-width: 46px; font-size: .68rem; font-weight: 700; color: #cfcfdb;
}
.wp .server-label .server-language-icon { color: #9a9aa8; width: 12px; height: 12px; }
.wp .server-btn {
  background: #3a3a45; color: #e6e6ee; border: 0; border-radius: 3px;
  padding: .32rem .7rem; font: 500 .68rem/1 inherit; font-family: inherit;
  cursor: pointer; transition: background-color .15s;
}
.wp .server-btn:hover { background: #4a4a57; }
.wp .server-btn.active { background: var(--wp-purple); color: #fff; }

/* ---------- right: info ---------- */
.wp .wp-info { width: auto; margin: 0; padding: 0; background: none; position: static; }
.wp .wp-cover {
  display: block; width: 107px; height: auto; aspect-ratio: 3 / 4.4; object-fit: cover;
  border-radius: 2px; margin-bottom: 1.1rem;
}
.wp .wp-info-title { margin: 0 0 .75rem; font-size: 1.35rem; font-weight: 600; line-height: 1.25; color: #fff; }

.wp .wp-badges { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: .75rem; margin-bottom: 1rem; }
.wp .wp-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  height: 20px; padding: 0 .4rem; border-radius: 3px;
  font-size: .7rem; font-weight: 700; color: #222;
}
.wp .wp-badge-sub { background: var(--wp-green); }
.wp .wp-badge-dub { background: var(--wp-pink); }
.wp .wp-badge-all { background: #8b8b95; color: #fff; }
.wp .wp-meta { display: inline-flex; align-items: center; gap: .4rem; color: #d3d3de; }
.wp .wp-meta i { width: 3px; height: 3px; border-radius: 50%; background: #8b8b99; }

.wp .wp-desc { margin: 0 0 .75rem; font-size: .75rem; line-height: 1.65; color: #dcdce6; }
.wp .wp-detail {
  display: inline-block; background: #fff; color: #111;
  font-size: .62rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px;
  text-decoration: none;
}

.wp .wp-rate {
  margin-top: 1.4rem; background: #2a2a34; border-radius: 6px; overflow: hidden; color: #fff;
}
.wp .wp-rate-head { display: flex; justify-content: space-between; align-items: center; padding: .85rem 1rem .3rem; font-size: .85rem; }
.wp .wp-score { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.wp .wp-rate-q { margin: 0; padding: 0 1rem .8rem; font-size: .75rem; color: #d8d8e2; }
.wp .wp-rate-opts { display: grid; grid-template-columns: repeat(3, 1fr); background: #e5e5ea; }
.wp .wp-rate-opts button {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: .6rem .3rem; border: 0; background: transparent; cursor: pointer;
  color: #333; font: 500 .72rem/1.2 inherit; font-family: inherit;
}
.wp .wp-rate-opts button span { font-size: 1rem; }
.wp .wp-rate-opts button:hover { background: #d6d6dd; }
.wp .wp-rate-opts button.is-picked { background: var(--wp-purple); color: #fff; }

.wp .wp-comments {
  position: relative; display: flex; align-items: center; gap: .7rem;
  margin-top: .75rem; padding: .9rem 1rem; min-height: 48px;
  background: #3a3a45; border-radius: 6px;
  color: #e6e6ee; font-size: .8rem; text-decoration: none;
}
.wp .wp-comments svg { color: var(--wp-purple); }

/* ---------- Light off: spotlight the player ---------- */
#bulbOverlay { display: none !important; }   /* replaced by the spotlight below */
.wp .video-outer { position: relative; z-index: 1; transition: box-shadow .25s; }
.wp.bulb-mode .video-outer {
  z-index: 50;
  box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .88), 0 0 28px 2px rgba(138, 43, 226, .45);
}
.wp.bulb-mode { cursor: pointer; }
.wp.bulb-mode .video-outer { cursor: auto; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .wp .wp-grid { grid-template-columns: minmax(0, 1fr) 290px; }
  .wp .wp-eps { grid-column: 1 / -1; grid-row: 2; }
  .wp .wp-center { grid-column: 1; grid-row: 1; }
  .wp .wp-info { grid-column: 2; grid-row: 1; }
  .wp .wp-eps-body { max-height: none; }
  .wp .sidebar-ep-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
}
@media (max-width: 820px) {
  .wp { padding: 0 0 1.5rem; }
  .wp .wp-crumb { display: none; }
  .wp .wp-grid { grid-template-columns: 1fr; gap: 0; }
  .wp .wp-center, .wp .wp-eps, .wp .wp-info { grid-column: 1; }
  .wp .wp-center { grid-row: 1; }
  .wp .wp-eps { grid-row: 2; }
  .wp .wp-info { grid-row: 3; }

  /* player edge to edge */
  .wp .video-wrapper { max-height: none; }

  /* controls: one line = Expand | Prev | Next | Download | + | Watch2gether */
  .wp .wp-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start;
    gap: .55rem .9rem; background: #15151f; padding: .8rem 1rem; }
  .wp .wp-controls .wp-ctl-group { display: contents; }
  .wp .wp-controls .wp-ctl { font-size: .8rem; flex: 0 0 auto; }
  .wp .wp-controls #expandBtn,
  .wp .wp-controls #bulbBtn,
  .wp .wp-controls #prevEpBtn,
  .wp .wp-controls #nextEpBtn,
  .wp .wp-controls .is-disabled,
  .wp .wp-controls .vc-download-btn,
  .wp .wp-controls #addListBtn,
  .wp .wp-controls .wp-w2g { order: 3; display: inline-flex; padding: .35rem 0; }
  .wp .wp-controls .is-disabled { opacity: .4; }
  .wp .wp-controls #expandBtn, .wp .wp-controls #bulbBtn { font-size: 0; }
  .wp .wp-controls #bulbBtn { margin-right: auto; }
  .wp .wp-controls #bulbBtn svg { width: 22px; height: 22px; }
  .wp .wp-controls #bulbBtn.bulb-on { color: #ffd54a; }
  .wp .wp-controls #bulbBtn .wp-state { display: none; }
  .wp .wp-controls #expandBtn svg { width: 22px; height: 22px; }
  .wp .wp-controls .vc-download-btn { font-size: 0; }
  .wp .wp-controls .vc-download-btn svg { width: 22px; height: 22px; }
  .wp .wp-controls #addListBtn span, .wp .wp-controls .wp-w2g { font-size: 0; }
  .wp .wp-controls #addListBtn svg { width: 24px; height: 24px; color: #fff; }
  .wp .wp-controls .wp-w2g svg { width: 26px; height: 26px; color: var(--wp-purple); }
  .wp .wp-controls #prevEpBtn svg, .wp .wp-controls #nextEpBtn svg,
  .wp .wp-controls .is-disabled svg { width: 14px; height: 14px; }

  /* "You are watching" block */
  .wp .wp-servers {
    flex-direction: column; gap: .6rem; margin: 0; border-radius: 0;
    background: #1d1c2b; padding: .8rem 1.25rem 1rem;
  }
  .wp .wp-watching { flex-basis: auto; background: transparent; padding: 0; font-size: .82rem; line-height: 1.4; }
  .wp .wp-watching span { color: #e6e6ee; }
  .wp .wp-watching strong { display: block; color: #a35cf0; font-weight: 500; }
  .wp .wp-watching p { color: #e6e6ee; margin-top: .35rem; }
  .wp .server-switcher { background: #2a2a3d; border-radius: 6px; padding: .6rem .7rem; }
  .wp .server-btn { padding: .38rem .8rem; font-size: .75rem; }

  /* episodes */
  .wp .wp-eps { background: #181824; border-radius: 0; padding: 0; }
  .wp .wp-eps-head { padding: 1.1rem 1.25rem .6rem; }
  .wp .wp-eps-title { font-size: .9rem; margin-bottom: .8rem; }
  .wp .wp-eps-tools { justify-content: space-between; }
  .wp .wp-epsearch { flex: 0 1 220px; border: 1px solid #5b3fa8; background: transparent; padding: 0 .7rem; }
  .wp .wp-epsearch input { padding: .65rem 0; font-size: .8rem; }
  .wp .wp-eps-body { background: transparent; padding: .6rem 1rem 1rem; max-height: 440px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #4a4a5e transparent; }
  .wp .sidebar-ep-grid { grid-template-columns: repeat(6, 1fr); gap: .4rem; }
  .wp .sidebar-ep-pill { height: 38px; font-size: .85rem; }
  .wp .wp-range-menu { min-width: 190px; }

  /* info: rating first, then cover + text side by side */
  .wp .wp-info { display: flex; flex-direction: column; padding: 1rem 1.25rem 0; }
  .wp .wp-rate { order: -1; margin-top: 0; }
  .wp .wp-info-top { display: grid; grid-template-columns: 82px minmax(0, 1fr); column-gap: .9rem; margin-top: 1rem; }
  .wp .wp-cover { grid-row: 1 / span 4; width: 82px; margin: 0; }
  .wp .wp-info-top > :not(.wp-cover) { grid-column: 2; }
  .wp .wp-info-title { font-size: 1.15rem; margin-bottom: .6rem; }
  .wp .wp-detail { justify-self: start; }
  .wp .wp-comments { background: #fff; color: #111; margin: .9rem 0 0; width: 78%; }
}
@media (prefers-reduced-motion: reduce) {
  .wp * { transition: none !important; }
}
