.watch-page { padding-bottom: 40px; }
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.player [hidden] { display: none !important; }

.player-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 12px 12px 0;
}
.player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  color: var(--color-foreground);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: none;
}
.player video::cue {
  /* Native cues stay invisible; custom overlay handles styled Persian text. */
  color: transparent;
  background: transparent;
  text-shadow: none;
}
.cue-overlay {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 72px;
  z-index: 4;
  text-align: center;
  pointer-events: none;
  font-family: var(--cue-font, "Vazirmatn", Tahoma, sans-serif);
  font-size: var(--cue-size, 1.15rem);
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
  text-shadow:
    0 0 4px rgba(0, 0, 0, 0.95),
    0 2px 8px rgba(0, 0, 0, 0.75);
}
.cue-overlay:not([hidden]) {
  display: block;
}
.cue-overlay .cue-line {
  display: inline-block;
  max-width: 100%;
  padding: 4px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  white-space: pre-wrap;
}
.player.is-active .cue-overlay {
  bottom: 88px;
}
@media (max-width: 720px) {
  .cue-overlay {
    bottom: 64px;
    left: 3%;
    right: 3%;
  }
  .player.is-active .cue-overlay {
    bottom: 78px;
  }
  .opts-panel {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    width: min(320px, calc(100vw - 24px));
  }
}
.ph {
  width: 22px;
  height: 22px;
  fill: currentColor;
  display: block;
  flex-shrink: 0;
}
.ph-lg { width: 34px; height: 34px; }
.ph-spin { animation: player-spin 0.75s linear infinite; }
@keyframes player-spin { to { transform: rotate(360deg); } }

.player-shade {
  position: absolute;
  inset: auto 0 0;
  height: 48%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.86));
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms var(--ease);
}
.player.is-active .player-shade { opacity: 1; }

.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  z-index: 5;
}
.player-loading .ph { color: var(--color-accent); }

.big-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(145deg, #f472b6, #fb923c);
  color: white;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 0 #db2777, 0 12px 28px rgba(236, 72, 153, 0.35);
  z-index: 3;
  cursor: pointer;
}
.player.is-playing .big-play,
.player.is-loading .big-play { display: none; }

/* Episode prev/next — player bar only */
a.ctrl.ctrl-ep {
  text-decoration: none;
  color: #fff;
}
a.ctrl.ctrl-ep:hover,
a.ctrl.ctrl-ep:visited {
  color: #fff;
}
a.ctrl.ctrl-ep .ph {
  color: #fff;
  fill: currentColor;
}
.ep-nav-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 14px 0 4px;
}
.ep-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: #fff;
  color: #1e3a8a;
  font-weight: 700;
  border: 3px solid #93c5fd;
  box-shadow: 0 4px 0 #60a5fa;
  text-decoration: none;
  transition: transform 160ms var(--ease);
}
.ep-chip:hover { transform: translateY(-2px); }
.ep-chip-mid {
  background: linear-gradient(135deg, #f472b6, #fb923c);
  color: #fff;
  border-color: #f9a8d4;
  box-shadow: 0 4px 0 #db2777;
}
.ep-chip.is-disabled {
  opacity: 0.4;
  box-shadow: none;
  cursor: not-allowed;
}
.watch-episodes {
  padding: 8px 0 28px;
}
.watch-episodes-head {
  margin-bottom: 14px;
}
.watch-episodes-lead {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}
.episode-link.is-current {
  background: linear-gradient(135deg, #dbeafe, #fce7f3);
  border-color: #f9a8d4;
  box-shadow: 0 4px 0 #ec4899;
  cursor: default;
}
.episode-link.is-current .episode-play {
  opacity: 1;
  color: #db2777;
  font-weight: 800;
  font-size: 13px;
}
.episode-link.is-current .episode-thumb {
  border-color: #f9a8d4;
  box-shadow: 0 2px 0 #ec4899;
}
#current-episode {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.skip-flash {
  position: absolute;
  top: 50%;
  left: 8%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 72px;
  padding: 14px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  z-index: 4;
}
.skip-flash.is-fwd {
  left: auto;
  right: 8%;
}

.player-bar {
  position: absolute;
  inset: auto 0 0;
  padding: 0 12px 10px;
  z-index: 6;
  direction: ltr;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
  pointer-events: none;
}
.player.is-active .player-bar {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.seek {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.seek-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  overflow: hidden;
}
.seek.is-scrubbing .seek-track { height: 6px; }
.seek-buffer,
.seek-played {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
}
.seek-buffer { background: rgba(255, 255, 255, 0.4); }
.seek-played { background: var(--color-accent); }
.seek-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: none;
  border: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.player.is-active .seek-thumb { transform: translate(-50%, -50%); }
.seek.is-scrubbing .seek-thumb {
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
}

.bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 44px;
}
.bar-left,
.bar-right {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}
.ctrl {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
}
.ctrl:hover { background: rgba(255, 255, 255, 0.1); }
.ctrl:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.ctrl.is-on { color: var(--color-accent); }
.ctrl.is-disabled,
.ctrl:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
#playBtn .i-pause { display: none !important; }
.player.is-playing #playBtn .i-play { display: none !important; }
.player.is-playing #playBtn .i-pause { display: block !important; }

.vol-wrap .i-vol-low,
.vol-wrap .i-vol-mute { display: none !important; }
.vol-wrap[data-vol="low"] .i-vol-high,
.vol-wrap[data-vol="mute"] .i-vol-high { display: none !important; }
.vol-wrap[data-vol="low"] .i-vol-low { display: block !important; }
.vol-wrap[data-vol="mute"] .i-vol-mute { display: block !important; }

.vol-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
}
.vol {
  --vol: 100%;
  width: 84px;
  height: 24px;
  margin: 0 4px 0 0;
  padding: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.vol:focus { outline: none; }
.vol::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--color-accent) var(--vol),
    rgba(255, 255, 255, 0.28) var(--vol)
  );
}
.vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.vol::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}
.vol::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--color-accent);
}
.vol::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.time {
  margin-inline-start: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #e4e4e7;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ctrl-menu { position: relative; }
.menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 132px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(18, 18, 26, 0.96);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  z-index: 8;
}
.menu button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: start;
  padding: 0 10px;
}
.menu button:hover,
.menu button.is-on { background: rgba(233, 30, 99, 0.18); color: white; }

.opts-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(300px, calc(100vw - 32px));
  max-height: min(70vh, 420px);
  overflow: auto;
  padding: 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 9;
  display: grid;
  gap: 12px;
  text-align: start;
}
.opts-panel[hidden] { display: none !important; }
.opts-section { display: grid; gap: 8px; }
.opts-label {
  font-size: 12px;
  font-weight: 700;
  color: #93c5fd;
}
.opts-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.opts-chips button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.opts-chips button:hover {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.35);
}
.opts-chips button.is-on {
  border-color: #f9a8d4;
  background: linear-gradient(135deg, #db2777, #ea580c);
  color: #fff;
}

.paywall {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 6;
  background:
    linear-gradient(180deg, rgba(30, 58, 138, 0.45), rgba(15, 23, 42, 0.78));
}
.paywall-card {
  width: min(460px, calc(100% - 32px));
  background: #ffffff;
  border: 3px solid #93c5fd;
  border-radius: 24px;
  padding: 24px;
  text-align: center;
  font-family: inherit;
  color: #0f172a;
  box-shadow: 0 6px 0 #93c5fd, 0 18px 40px rgba(37, 99, 235, 0.28);
}
.paywall-card h2 {
  margin: 0 0 10px;
  color: #1e3a8a;
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 800;
}
.paywall-card p {
  margin: 0 0 18px;
  color: #475569;
  font-size: 15px;
  line-height: 1.7;
}
.paywall-card .hero-actions {
  justify-content: center;
}
.paywall-card .btn-ghost {
  background: #eff6ff;
  color: #1e3a8a;
  border-color: #93c5fd;
}
.paywall-card .btn-ghost:hover {
  background: #dbeafe;
}
.player-error {
  position: absolute;
  inset-inline: 12px;
  bottom: 88px;
  background: rgba(0, 0, 0, 0.78);
  color: #fda4af;
  padding: 10px 14px;
  border-radius: 12px;
  z-index: 7;
  font-size: 13px;
  font-weight: 500;
}
.watch-meta { margin-top: 18px; }
.watch-meta h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
}

.player:fullscreen,
.player:-webkit-full-screen {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}
.player:fullscreen .player-bar,
.player:-webkit-full-screen .player-bar {
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

@media (hover: hover) and (pointer: fine) {
  .player:hover .player-shade,
  .player:hover .player-bar {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .player:hover .seek-thumb {
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 768px) {
  .player-shell {
    width: 100%;
    padding: 0;
  }
  .player {
    border-radius: 0;
    box-shadow: none;
    width: 100%;
  }
  .player-bar {
    padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .seek { height: 28px; }
  .seek-track { height: 3px; }
  .seek.is-scrubbing .seek-track { height: 5px; }
  .seek-thumb {
    width: 9px;
    height: 9px;
    transform: translate(-50%, -50%);
  }
  .ctrl { width: 44px; height: 44px; }
  .ctrl-skip { display: none; }
  .vol-wrap {
    gap: 4px;
  }
  .vol {
    display: block;
    width: 72px;
    min-width: 72px;
  }
  .vol-wrap.is-open .vol,
  .player.is-active .vol {
    display: block;
  }
  .time { font-size: 12px; margin-inline-start: 2px; }
  .big-play { width: 56px; height: 56px; }
  .watch-page { padding-bottom: 24px; }
  .watch-meta {
    margin-top: 14px;
    padding-inline: 16px;
  }
  .watch-meta h1 { font-size: 20px; }
}

@media (max-width: 420px) {
  .bar-right .ctrl:not(#fsBtn):not(#optsBtn) { width: 40px; }
  .time-sep { display: none; }
  #timeDur { display: none; }
}
