/* ============================================================
   Watch page — matte deep navy theme
   ============================================================ */

/* poster (video mounts in an iframe only after play) */
.player-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: #01040e;
  cursor: pointer;
  display: block;
}
.player-poster img.poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pp-big {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(10, 16, 30, 0.82);
  border: 1px solid rgba(76, 126, 203, 0.55);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.pp-big svg { width: 26px; height: 26px; fill: #dfe7f5; margin-left: 4px; }
.player-poster:hover .pp-big { transform: translate(-50%, -50%) scale(1.08); background: rgba(16, 26, 48, 0.9); }
.pp-hint {
  position: absolute;
  left: 50%;
  top: calc(50% + 52px);
  transform: translateX(-50%);
  font-family: "Sora", sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #c3ccdf;
  text-shadow: 0 2px 8px rgba(2, 4, 10, 0.9);
  white-space: nowrap;
}

.player-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ============================================================
   Title / meta / actions / rating / description
   ============================================================ */

.now-playing { margin-top: 18px; }

.now-playing h1 {
  font-family: "Syne", sans-serif;
  font-size: clamp(20px, 2.8vw, 30px);
  font-weight: 800;
  line-height: 1.2;
}

.np-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.np-chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.np-rating-inline { font-size: 12.5px; color: var(--muted); }
.np-rating-inline .star { color: #c9a35c; }
.np-rating-inline b { color: var(--ink); }

.np-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.np-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Sora", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: #0d1220;
  border: 1px solid var(--line-hi);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.np-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.np-btn:hover { color: var(--ink); border-color: rgba(76, 126, 203, 0.5); }
.np-btn.liked { color: #e88fb0; border-color: rgba(214, 106, 140, 0.55); }
.np-btn.liked svg { fill: rgba(214, 106, 140, 0.25); stroke: #d66a8c; }

/* rating widget */
.np-rate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  background: var(--core-hi);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
}
.rate-label {
  font-family: "Sora", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.stars { display: inline-flex; gap: 4px; }
.star-btn {
  font-size: 26px;
  line-height: 1;
  color: #2b3752;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 2px;
  transition: color 0.12s ease, transform 0.12s ease;
}
.star-btn:hover { transform: scale(1.15); color: #c9a35c; }
.star-btn.filled { color: #c9a35c; }
.rate-info { font-size: 12.5px; color: var(--faint); }

/* description */
.np-desc-title {
  font-family: "Sora", sans-serif;
  font-size: clamp(16px, 1.8vw, 19px);
  font-weight: 700;
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.np-desc-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: var(--grad);
  flex-shrink: 0;
}
.np-desc {
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--muted);
  margin-top: 18px;
}

.notice-watch { margin-top: 18px; padding: 14px 16px; }

/* related */
.related { margin-top: clamp(26px, 4vw, 44px); }
.related .vgrid { padding-top: 2px; }

/* toast */
.dx-toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px);
  background: #101a30;
  border: 1px solid var(--line-hi);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 300;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.dx-toast.show { opacity: 1; transform: translate(-50%, 0); }

.watch-wrap {
  max-width: 1520px;
  margin: 0 auto;
  padding: clamp(14px, 2.5vw, 28px) var(--pad-x) 20px;
}

.watch-layout {
  display: flex;
  gap: clamp(16px, 2vw, 26px);
  justify-content: center;
  align-items: flex-start;
}

.player-wrap {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 1000px;
}

/* the player is capped by both a max width and the viewport height,
   so it never dominates a big screen */
.player-shell {
  position: relative;
  width: min(100%, calc((100vh - 220px) * 16 / 9));
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  background: #02040a;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-hi);
}

.player-shell video {
  width: 100%;
  height: 100%;
  display: block;
  background: #02040a;
}

.now-playing {
  margin-top: 18px;
}

.now-playing h1 {
  font-family: "Syne", sans-serif;
  font-size: clamp(20px, 2.8vw, 30px);
  font-weight: 800;
  line-height: 1.2;
}

.np-back { margin-top: 6px; }
.np-back a {
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
}
.np-back a:hover { color: #b9cbe6; }

.notice-watch {
  margin-top: 18px;
  padding: 14px 16px;
}

/* episodes sidebar */

.episodes {
  width: clamp(280px, 26vw, 340px);
  flex-shrink: 0;
  background: var(--pane);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.episodes h2 {
  font-family: "Sora", sans-serif;
  font-size: clamp(15px, 1.6vw, 17px);
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.episodes h2::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: var(--grad);
}

.episode-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 6px;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.episode-item:hover {
  background: #101a30;
}

.episode-item.active {
  background: #101a30;
  border-color: rgba(76, 126, 203, 0.45);
}

.episode-item .ep-thumb {
  width: 104px;
  height: 58px;
  border-radius: 8px;
  background: var(--chip);
  flex-shrink: 0;
  overflow: hidden;
}

.episode-item .ep-thumb img.poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.episode-item .ep-name {
  font-size: clamp(12px, 1.3vw, 13.5px);
  font-weight: 500;
  line-height: 1.4;
}

/* loading / error overlays */

.player-loading,
.player-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(3, 5, 11, 0.9);
  z-index: 5;
  padding: 20px;
  text-align: center;
}

.player-error {
  color: #e3b8c8;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(76, 126, 203, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

/* stack the episodes under the player on narrower screens */
@media (max-width: 1080px) {
  .watch-layout {
    flex-direction: column;
    align-items: stretch;
  }
  /* contents => the sticky player is constrained by the full layout,
     so it stays pinned (mini-player style) while browsing episodes */
  .player-wrap {
    display: contents;
  }
  .player-shell {
    width: 100%;
    position: sticky;
    top: var(--head-h);
    z-index: 40;
  }
  .episodes {
    width: 100%;
    max-height: none;
  }
  .episode-item .ep-thumb {
    width: 120px;
    height: 68px;
  }
  .episode-item { padding: 10px 8px; }
  .ep-name { font-size: 14px; }
}

@media (max-width: 700px) {
  .watch-wrap {
    padding: 10px 0 14px;
  }
  .player-shell {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .now-playing {
    padding: 0 4px;
  }
  .notice-watch {
    border-radius: 12px;
  }
  .episode-item .ep-thumb {
    width: 104px;
    height: 58px;
  }
}