:root {
  color-scheme: dark;
  --sp-accent: #ff0033;
  --sp-bg: #101010;
  --sp-text: #fff;
  --sp-control-size: 40px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
}
html[lang="fa"],
html[lang="fa"] body,
html[lang="fa"] button,
html[lang="fa"] input,
html[lang="fa"] .overlay-message,
html[lang="fa"] .player-custom-text,
html[lang="fa"] .demo-note,
html[lang="fa"] .time-display,
html[lang="fa"] .control-live-badge,
html[lang="fa"] .control-custom-text,
html[lang="fa"] .quality-option {
  font-family: "iranyekanFN", Tahoma, sans-serif;
}
.player-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border-radius: 12px;
  box-shadow: 0 18px 60px #0008;
}
.stream-player { display: block; width: 100%; height: 100%; background: #000; }
.player-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
}
.player-shell:fullscreen .stream-player,
.player-shell:fullscreen .media-surface { width: 100%; height: 100%; }
.media-surface {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000;
  color: #fff;
}
hlsjs-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  --media-object-fit: contain;
}
.player-poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #000;
  pointer-events: none;
}
.player-poster[hidden] { display: none !important; }

/* There is deliberately no Video.js skin imported or mounted. This is the only control bar. */
.custom-control-bar {
  position: absolute;
  z-index: 12;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  color: #fff;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(7px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.player-shell.controls-visible .custom-control-bar {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
@media (hover: hover) and (pointer: fine) {
  .player-shell:hover .custom-control-bar,
  .player-shell:focus-within .custom-control-bar {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }
}
.control-group {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.control-group-left { flex: 1 1 auto; justify-content: flex-start; }
.control-group-right { flex: 0 0 auto; justify-content: flex-end; margin-left: auto; }

.control-button {
  flex: 0 0 auto;
  min-width: var(--sp-control-size);
  min-height: var(--sp-control-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 7px;
  color: #fff;
  background: transparent;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.control-button:hover,
.control-button:active { color: var(--sp-accent); background: transparent; }
.control-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.control-button svg { width: 25px; height: 25px; display: block; fill: currentColor; stroke: none; }
#control-play-pause svg { color: var(--sp-accent); }
#control-mute svg,
#control-fullscreen svg,
#control-pip svg,
.quality-trigger svg,
.control-seek-button svg,
.speed-trigger svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.control-seek-button svg text { fill: currentColor; stroke: none; }
.volume-control { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.volume-slider { width: 76px; accent-color: var(--sp-accent); cursor: pointer; }
.progress-slider { flex: 1 1 150px; min-width: 45px; width: 100%; accent-color: var(--sp-accent); cursor: pointer; }
.time-display { flex: 0 0 auto; color: #eee; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.control-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 4px;
  color: #fff;
  background: var(--sp-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  white-space: nowrap;
}
.live-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #fff;
  animation: heartbeat 1.4s infinite;
}
@keyframes heartbeat {
  0% { box-shadow: 0 0 0 0 #fff9; transform: scale(1); }
  70% { box-shadow: 0 0 0 7px #fff0; transform: scale(1.15); }
  100% { box-shadow: 0 0 0 0 #fff0; transform: scale(1); }
}

/* Site-provided text rendered immediately to the right of the LIVE badge. */
.control-custom-text {
  display: inline-block;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(36vw, 360px);
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px #000;
  white-space: nowrap;
  vertical-align: middle;
}
.quality-control,
.speed-control { position: relative; display: flex; align-items: center; flex: 0 0 auto; }
.quality-trigger { white-space: nowrap; }
.speed-trigger { gap: 4px; white-space: nowrap; }
.speed-current-label { color: inherit; font-size: 11px; font-weight: 700; line-height: 1; }
.quality-menu {
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 135px;
  max-height: 50vh;
  overflow: auto;
  margin: 0;
  padding: 5px;
  border: 1px solid #ffffff20;
  border-radius: 8px;
  background: #161616f5;
  box-shadow: 0 5px 24px #0008;
}
.quality-menu[hidden], [hidden] { display: none !important; }
.quality-option {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 5px;
  padding: 9px 10px;
  color: #eee;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.quality-option:hover { background: #ffffff12; }
.quality-option[aria-checked="true"] { background: #383838; }
.quality-option[aria-checked="true"]::after { content: "✓"; color: var(--sp-accent); }
.speed-menu {
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 104px;
  max-height: 50vh;
  overflow: auto;
  margin: 0;
  padding: 5px;
  border: 1px solid #ffffff20;
  border-radius: 8px;
  background: #161616f5;
  box-shadow: 0 5px 24px #0008;
}
.speed-menu[hidden] { display: none !important; }
.speed-option {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 5px;
  padding: 9px 10px;
  color: #eee;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.speed-option:hover:not(:disabled) { background: #ffffff12; }
.speed-option:disabled { opacity: .4; cursor: not-allowed; }
.speed-option[aria-checked="true"] { background: #383838; }
.speed-option[aria-checked="true"]::after { content: "✓"; color: var(--sp-accent); }
.player-custom-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #eee;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 4px #000;
  pointer-events: none;
}
.player-custom-text:not(.in-control-bar) {
  position: absolute;
  z-index: 11;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  max-width: 60%;
}

.touch-playback-indicator {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 50%;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, .48);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(.88);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.touch-playback-indicator.is-visible,
.touch-playback-indicator.is-paused-state {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
.touch-playback-indicator.is-paused-state {
  display: grid;
  width: 104px;
  height: 104px;
  background: rgba(0, 0, 0, .58);
  box-shadow: 0 4px 24px rgba(0, 0, 0, .22);
}
.touch-playback-indicator:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.touch-playback-indicator svg { width: 38px; height: 38px; fill: currentColor; }
.touch-playback-indicator.is-paused-state svg { width: 48px; height: 48px; }
@media (hover: hover) and (pointer: fine) {
  .touch-playback-indicator:not(.is-paused-state) { display: none; }
}

/* Active only while the initial autoplay-unmute prompt is displayed. */
.overlay-unmute-hotspot {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: transparent;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}
.overlay-unmute-hotspot[hidden] { display: none !important; }
.overlay-unmute-hotspot:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }

.player-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: #0005;
  transition: opacity .2s ease;
}
.player-overlay.is-hidden { opacity: 0; pointer-events: none; }
.player-overlay.has-unmute-prompt { background: transparent; pointer-events: none; }
.player-overlay.has-unmute-prompt .overlay-unmute { pointer-events: auto; }
.overlay-action {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #ff0033f2;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 28px #0006;
}
.overlay-action svg { width: 34px; height: 34px; fill: currentColor; margin-left: 4px; }
.overlay-message {
  max-width: 82%;
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  text-shadow: 0 1px 4px #000;
}
.overlay-unmute {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: calc(100% - 24px);
  min-height: 48px;
  height: auto;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  padding: 10px 16px;
  color: #fff;
  background: rgba(20, 20, 20, .82);
  cursor: pointer;
  box-shadow: 0 3px 14px #0005;
}
#overlay-unmute-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  height: auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}
.overlay-unmute-label { display: inline; }
.overlay-unmute svg { display: block; flex: 0 0 auto; width: 25px; height: 25px; fill: currentColor; }
.overlay-unmute:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.demo-note { color: #aaa; font-size: 13px; line-height: 1.5; }
.demo-note code { color: #eee; }
.player-shell.is-live, .media-surface.is-live { --sp-accent: #ff0033; }

@media (max-width: 650px) {
  .demo { width: calc(100% - 12px); margin: 12px auto; }
  .player-shell { border-radius: 6px; }
  .custom-control-bar { min-height: 48px; gap: 6px; padding: 5px 7px; }
  .control-group { gap: 3px; }
  .control-button { min-width: 34px; min-height: 34px; padding: 5px; }
  .control-button svg { width: 23px; height: 23px; }
  .touch-playback-indicator { width: 76px; height: 76px; }
  .volume-slider { width: 48px; }
  .player-shell.is-vod .custom-control-bar { flex-wrap: wrap; align-content: flex-end; row-gap: 2px; }
  .player-shell.is-vod .control-group-left { flex: 1 1 100%; width: 100%; flex-wrap: nowrap; }
  .player-shell.is-vod .control-group-right { flex: 1 1 100%; width: 100%; justify-content: flex-end; margin-left: 0; }
  .player-shell.is-vod .volume-slider { width: 36px; }
  .player-shell.is-vod .time-display { display: none; }
  .player-shell.is-vod .progress-slider { flex: 1 1 45px; min-width: 28px; width: auto; }
  .overlay-unmute { min-height: 46px; padding: 9px 13px; }
  #overlay-unmute-text { gap: 8px; font-size: 13px; }
  .overlay-unmute svg { width: 23px; height: 23px; }
  .time-display { font-size: 10px; }
  .speed-current-label { font-size: 10px; }
  .speed-trigger { gap: 2px; }
  .control-live-badge { font-size: 9px; padding: 3px 9px; }
  .control-custom-text { max-width: 32vw; font-size: 10px; }
  .player-custom-text:not(.in-control-bar) { max-width: 75%; }
}
