.mstv-hls {
  --mstv-accent: #0071e3;
  --mstv-bg: #000;
  --mstv-fg: #f5f5f7;
  --mstv-muted: rgba(245, 245, 247, 0.72);
  --mstv-glass: rgba(22, 22, 24, 0.55);
  --mstv-bar: 44px;
  position: relative;
  width: 100%;
  max-width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  color: var(--mstv-fg);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.mstv-hls *,
.mstv-hls *::before,
.mstv-hls *::after {
  box-sizing: border-box;
}

.mstv-hls__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--mstv-bg);
  border-radius: 18px;
  overflow: hidden;
  isolation: isolate;
}

.mstv-hls__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.mstv-hls__poster {
  position: absolute;
  inset: 0;
  background: #0b0b0d center / cover no-repeat;
  opacity: 1;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.mstv-hls.is-playing .mstv-hls__poster,
.mstv-hls.has-frame .mstv-hls__poster {
  opacity: 0;
}

.mstv-hls.is-audio .mstv-hls__poster {
  opacity: 1;
  filter: blur(18px) saturate(1.1);
  transform: scale(1.08);
}

.mstv-hls__audio-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: none;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mstv-hls.is-audio .mstv-hls__audio-label {
  display: block;
}

.mstv-hls__bigplay {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 72px;
  height: 72px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.mstv-hls__bigplay:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.mstv-hls.is-playing .mstv-hls__bigplay {
  opacity: 0;
  pointer-events: none;
}

.mstv-hls__spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: mstv-spin 0.7s linear infinite;
}

.mstv-hls.is-waiting .mstv-hls__spinner {
  display: block;
}

.mstv-hls__error {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  text-align: center;
  padding: 24px;
  gap: 12px;
}

.mstv-hls.has-error .mstv-hls__error {
  display: grid;
}

.mstv-hls__error button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--mstv-accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.mstv-hls__live {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  color: #fff;
}

.mstv-hls__live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.22);
}

.mstv-hls__live.is-behind {
  background: var(--mstv-accent);
}

.mstv-hls__live.is-behind::before {
  background: #fff;
  box-shadow: none;
}

.mstv-hls__controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: var(--mstv-bar);
  padding: 8px 10px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
  opacity: 1;
  transition: opacity 0.25s ease;
}

.mstv-hls.is-playing.is-idle:not(.is-menu) .mstv-hls__controls,
.mstv-hls.is-playing.is-idle:not(.is-menu) .mstv-hls__live {
  opacity: 0;
  pointer-events: none;
}

.mstv-hls__btn,
.mstv-hls__bigplay,
.mstv-hls__live {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.mstv-hls__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 10px;
  flex: 0 0 auto;
}

.mstv-hls__btn:hover,
.mstv-hls__btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.1);
}

.mstv-hls__btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.mstv-hls__spacer {
  flex: 1 1 auto;
}

.mstv-hls__vol {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 6px;
}

.mstv-hls__vol input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 88px;
  height: 4px;
  margin: 0 8px 0 2px;
  opacity: 1;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  accent-color: #fff;
}

.mstv-hls__vol input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.mstv-hls__vol input[type="range"]::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.28);
  border: 0;
  border-radius: 999px;
}

.mstv-hls__vol input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.mstv-hls__quality-wrap {
  position: relative;
}

.mstv-hls__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 148px;
  padding: 6px;
  border-radius: 14px;
  background: var(--mstv-glass);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: none;
}

.mstv-hls.is-menu .mstv-hls__menu {
  display: grid;
  gap: 2px;
}

.mstv-hls__menu button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--mstv-fg);
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.mstv-hls__menu button:hover,
.mstv-hls__menu button.is-active {
  background: rgba(255, 255, 255, 0.12);
}

.mstv-hls__menu button.is-active {
  color: var(--mstv-accent);
}

.mstv-hls:focus-within .mstv-hls__btn:focus-visible,
.mstv-hls__menu button:focus-visible,
.mstv-hls__live:focus-visible,
.mstv-hls__bigplay:focus-visible {
  outline: 2px solid var(--mstv-accent);
  outline-offset: 2px;
}

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

@media (max-width: 640px) {
  .mstv-hls__vol input[type="range"] {
    width: 64px;
  }

  .mstv-hls__stage {
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mstv-hls__spinner,
  .mstv-hls__poster,
  .mstv-hls__controls,
  .mstv-hls__bigplay {
    animation: none;
    transition: none;
  }
}
