/* ==========================================================================
   NX Player · 自研播放器样式（MP4 / HLS 通用）
   ========================================================================== */

.nx-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #050607;
  color: #fff;
  overflow: hidden;
  border-radius: 4px 4px 0 0;
  outline: none;
  user-select: none;
  font-family: inherit;
  isolation: isolate;
}

.nx-player.is-fullscreen,
.nx-player:fullscreen {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.nx-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

/* 海报层：铺满整个画面（建议 16:9 封面），开始播放后由 JS 收起 */
.nx-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  pointer-events: none;
  background: #050607;
}

.nx-poster[hidden] {
  display: none;
}

/* 顶部信息条 */
.nx-top {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 30px;
  background: linear-gradient(180deg, rgba(4, 5, 7, 0.72) 0%, rgba(4, 5, 7, 0) 100%);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.22s, transform 0.22s;
  pointer-events: none;
  z-index: 3;
}

.nx-player.ui-active .nx-top {
  opacity: 1;
  transform: translateY(0);
}

.nx-top-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-badge {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: 0.04em;
  background: rgba(216, 64, 44, 0.92);
  color: #fff;
}

/* 中央按钮 / 状态层 */
.nx-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  pointer-events: none;
}

.nx-bigplay {
  pointer-events: auto;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #0d0e10;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.22s, opacity 0.22s;
}

.nx-bigplay svg {
  width: 22px;
  height: 22px;
}

.nx-bigplay:hover {
  transform: scale(1.06);
}

.nx-player.is-started:not(.is-paused) .nx-bigplay {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.nx-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
  z-index: 4;
  pointer-events: none;
}

.nx-spinner.is-show {
  opacity: 1;
  visibility: visible;
  animation: nx-spin 0.86s linear infinite;
}

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

.nx-toast {
  position: absolute;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 3px;
  background: rgba(10, 11, 13, 0.84);
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.92);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

.nx-toast.is-show {
  opacity: 1;
}

/* 错误层 */
.nx-error {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  background: rgba(6, 7, 9, 0.92);
  text-align: center;
  z-index: 6;
}

.nx-error.is-show {
  display: flex;
}

.nx-error-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
}

.nx-error-title {
  font-size: 15px;
  font-weight: 500;
}

.nx-error-desc {
  max-width: 420px;
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.55);
}

.nx-error-retry {
  margin-top: 4px;
  padding: 7px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  font-size: 13px;
  color: #fff;
  transition: background 0.18s, border-color 0.18s;
}

.nx-error-retry:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}

/* 控制条 */
.nx-bar {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0 14px 10px;
  background: linear-gradient(180deg, rgba(5, 6, 8, 0) 0%, rgba(5, 6, 8, 0.82) 52%, rgba(5, 6, 8, 0.96) 100%);
  z-index: 5;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.24s, transform 0.24s;
}

/* 播放中且鼠标静止时隐藏控制条；暂停 / 未开始时始终可见 */
.nx-player.is-started:not(.ui-active) .nx-bar {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.nx-player.is-started.ui-active .nx-bar {
  opacity: 1;
  transform: translateY(0);
}

/* 进度条 */
.nx-progress {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.nx-progress-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  overflow: visible;
  transition: height 0.16s;
}

.nx-progress:hover .nx-progress-track,
.nx-progress.is-drag .nx-progress-track {
  height: 6px;
}

.nx-progress-buffer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.nx-progress-played {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--accent, #d8402c);
  border-radius: 2px;
}

.nx-progress-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(216, 64, 44, 0.22);
  transform: scale(0.6);
  opacity: 0;
  transition: transform 0.16s, opacity 0.16s;
  pointer-events: none;
}

.nx-progress:hover .nx-progress-thumb,
.nx-progress.is-drag .nx-progress-thumb {
  transform: scale(1);
  opacity: 1;
}

.nx-tip {
  position: absolute;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.78);
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.9);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.14s;
  pointer-events: none;
}

.nx-progress.is-drag .nx-tip {
  opacity: 1;
}

/* 按钮行 */
.nx-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  margin-top: 2px;
}

.nx-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.86);
  transition: background 0.16s, color 0.16s;
  flex: 0 0 auto;
}

.nx-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nx-btn svg {
  width: 19px;
  height: 19px;
}

.nx-btn.is-text {
  width: auto;
  padding: 0 9px;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.nx-time {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.74);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 0 6px;
  white-space: nowrap;
}

.nx-time .sep {
  margin: 0 4px;
  color: rgba(255, 255, 255, 0.32);
}

.nx-spacer {
  flex: 1 1 auto;
}

/* 音量 */
.nx-vol {
  display: flex;
  align-items: center;
}

.nx-vol-slider {
  width: 0;
  overflow: hidden;
  transition: width 0.2s ease, margin 0.2s;
  display: flex;
  align-items: center;
}

.nx-vol:hover .nx-vol-slider,
.nx-vol:focus-within .nx-vol-slider {
  width: 62px;
  margin-left: 2px;
}

.nx-vol-slider input {
  -webkit-appearance: none;
  appearance: none;
  width: 62px;
  height: 4px;
  border-radius: 2px;
  outline: none;
  background: linear-gradient(90deg, var(--accent, #d8402c) 0%, var(--accent, #d8402c) var(--val, 60%), rgba(255, 255, 255, 0.22) var(--val, 60%));
  cursor: pointer;
}

.nx-vol-slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 0;
}

.nx-vol-slider input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

/* 菜单 */
.nx-menu {
  position: absolute;
  right: 14px;
  bottom: 58px;
  min-width: 128px;
  padding: 5px;
  border-radius: 4px;
  background: rgba(16, 17, 19, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 7;
}

.nx-menu.is-open {
  display: block;
}

.nx-menu[data-menu="quality"] {
  right: 60px;
}

.nx-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 3px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  white-space: nowrap;
}

.nx-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nx-menu-item.is-active {
  color: #fff;
}

.nx-menu-item.is-active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #d8402c);
}

/* 内嵌字幕按钮状态 */
.nx-btn.is-on {
  color: #fff;
}

/* 小屏优化 */
@media (max-width: 600px) {
  .nx-top {
    padding: 12px 12px 24px;
  }

  .nx-top-title {
    font-size: 13.5px;
  }

  .nx-bigplay {
    width: 56px;
    height: 56px;
  }

  .nx-bigplay svg {
    width: 18px;
    height: 18px;
  }

  .nx-bar {
    padding: 0 8px 6px;
  }

  .nx-actions {
    gap: 0;
    height: 32px;
  }

  .nx-btn {
    width: 32px;
    height: 32px;
  }

  .nx-btn svg {
    width: 17px;
    height: 17px;
  }

  .nx-time {
    font-size: 11.5px;
    padding: 0 4px;
  }

  .nx-vol-slider {
    display: none;
  }

  .nx-menu {
    right: 8px;
    bottom: 50px;
  }

  .nx-menu[data-menu="quality"] {
    right: 42px;
  }
}
