* {
  box-sizing: border-box;
}

html,
body,
button,
input {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "SimHei", sans-serif;
}

:root {
  --player-radius: 12px;
}

html.os-mac {
  --player-radius: 12px;
}

html.os-win11 {
  --player-radius: 8px;
}

html.os-win10,
html.os-mobile {
  --player-radius: 0px;
}

html,
body {
  margin: 0;
  background: #fff;
  color: #111;
  max-width: 100%;
  overflow-x: hidden;
}

a {
  color: inherit;
}

.watch-header {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
}

.back {
  text-decoration: none;
  font-size: 14px;
  color: #333;
}

.back:hover {
  color: #000;
}

.watch-main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* 播放器：外层裁切圆角，视频本身不再单独圆角 */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  background: transparent;
  overflow: hidden;
  border-radius: var(--player-radius);
  transform: translateZ(0);
  isolation: isolate;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

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

.stage:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  aspect-ratio: auto !important;
  background: #000;
  border-radius: 0;
  transform: none;
}

.stage:fullscreen video {
  height: 100vh;
}

/* 进度条：左右时间 + 中间轨道 */
.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.time {
  flex: 0 0 auto;
  min-width: 40px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.time.current {
  text-align: left;
}

.time.duration {
  text-align: right;
}

.progress {
  position: relative;
  z-index: 5;
  flex: 1;
  height: 14px;
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  touch-action: none;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 4.5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.22);
}

.buffered,
.played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
}

.buffered {
  width: 0;
  background: rgba(255, 255, 255, 0.5);
}

.played {
  width: 0;
  border-radius: 3px;
  background: rgba(76, 194, 255, 0.9);
}

.thumb {
  position: absolute;
  top: 2px;
  left: 0;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.progress:hover .thumb,
.progress.dragging .thumb {
  opacity: 1;
}

/* 控制栏：统一半透明 */
.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 12px 0 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  opacity: 1;
  transition: opacity 0.12s ease;
}

.stage.controls-hidden .controls {
  opacity: 0;
  pointer-events: none;
}

.control-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 4px 14px 0;
}

.control-left {
  flex: 1;
}

.control-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.control-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.9;
}

.control-btn:hover {
  opacity: 1;
}

.play-toggle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.1);
}

.play-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
}

.play-icon,
.pause-icon {
  width: 20px;
  height: 20px;
}

.pause-icon {
  display: none;
}

.stage.is-playing .play-icon {
  display: none;
}

.stage.is-playing .pause-icon {
  display: inline-block;
}

.text-btn {
  width: auto;
  min-width: 42px;
  padding: 0 6px;
  font-size: 13px;
  white-space: nowrap;
}

.text-btn.is-open {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(45, 45, 45, 0.86);
}

.control-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control-btn .fill {
  fill: currentColor;
  stroke: none;
}

.control-btn .wave,
.control-btn .mute-x {
  display: none;
}

.control-btn.vol-1 .wave-1,
.control-btn.vol-2 .wave-1,
.control-btn.vol-2 .wave-2,
.control-btn.vol-3 .wave {
  display: block;
}

.control-btn.is-muted .wave {
  display: none;
}

.control-btn.is-muted .mute-x {
  display: block;
}

/* 音量：点击展开竖向滑杆 */
.volume-wrap {
  position: relative;
}

.volume-popover {
  position: absolute;
  right: -8px;
  bottom: calc(100% + 10px);
  z-index: 8;
  display: flex;
  justify-content: center;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(45, 45, 45, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.volume-popover[hidden] {
  display: none;
}

.volume-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 24px;
  height: 96px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.volume-slider::-webkit-slider-runnable-track {
  width: 4px;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(
    to top,
    #fff 0%,
    #fff var(--vol, 70%),
    rgba(255, 255, 255, 0.28) var(--vol, 70%),
    rgba(255, 255, 255, 0.28) 100%
  );
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-left: -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.volume-slider::-moz-range-track {
  width: 4px;
  height: 100%;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
}

.volume-slider::-moz-range-progress {
  width: 4px;
  border-radius: 2px;
  background: #fff;
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

/* 画质 / 速度菜单 */
.control-menu {
  position: absolute;
  left: 0;
  right: auto;
  bottom: 100px;
  z-index: 7;
  width: 122px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  color: #fff;
  background: rgba(45, 45, 45, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  opacity: 1;
  transition: opacity 1s ease;
}

.control-menu.is-speed {
  width: 102px;
}

.control-menu.is-fading {
  opacity: 0;
}

.control-menu[hidden] {
  display: none;
}

.menu-section[hidden] {
  display: none;
}

.menu-title {
  margin: 0 0 4px;
  padding: 0 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.48);
}

.menu-options {
  display: flex;
  flex-direction: column;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.52);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.menu-item.is-selected {
  color: rgba(255, 255, 255, 0.95);
}

.menu-item .check {
  color: #4cc2ff;
  opacity: 0;
}

.menu-item.is-selected .check {
  opacity: 1;
}

.meta {
  margin-top: 24px;
}

.meta h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.3;
}

.notice {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 8;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.68);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.notice.is-visible {
  opacity: 1;
}

.player-error {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: var(--player-radius);
  color: #fff;
  background: rgba(0, 0, 0, 0.92);
  font-size: 14px;
  text-align: center;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.player-error[hidden] {
  display: none;
}

.stage.has-error .controls,
.stage.has-error .control-menu {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 700px) {
  .watch-header {
    padding: 16px;
  }

  .watch-main {
    padding: 0 12px 50px;
  }

  .controls {
    padding: 10px 0 8px;
  }

  .progress-row {
    gap: 8px;
    padding: 0 10px;
  }

  .time {
    min-width: 36px;
    font-size: 10px;
  }

  .control-row {
    padding: 4px 10px 0;
  }

  .control-right {
    gap: 4px;
  }

  .text-btn {
    min-width: 36px;
    padding: 0 4px;
    font-size: 12px;
  }

  .play-toggle {
    width: 38px;
    height: 38px;
  }

  .meta h1 {
    font-size: 26px;
  }
}
