:root {
  color-scheme: dark;
  --page-bg: #8d9095;
  --card-bg: #0e0e0e;
  --accent: #fe2c55;
  --phone-width: 430px;
  --gap: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--page-bg);
}

body {
  overflow-x: hidden;
  color: #fff;
  overscroll-behavior-y: contain;
  background: var(--page-bg);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.video-feed {
  width: min(calc(100% - 20px), var(--phone-width));
  margin: 0 auto;
  padding: var(--gap) 0 max(var(--gap), env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  scroll-snap-type: y mandatory;
}

.video-card {
  position: relative;
  width: 100%;
  height: calc(100svh - (var(--gap) * 2));
  min-height: 520px;
  max-height: 920px;
  flex: 0 0 auto;
  overflow: hidden;
  isolation: isolate;
  background: #000;
  border: 2px solid #2f3134;
  border-radius: 24px;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.18);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  outline: none;
}

.video-card:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
}

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

.video-poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  opacity: 1;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms;
}

.has-started .video-poster {
  opacity: 0;
  visibility: hidden;
}

.video-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.52) 0, rgba(0, 0, 0, 0.08) 20%, transparent 42%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.82) 0, rgba(0, 0, 0, 0.1) 32%, transparent 52%);
  opacity: 0;
  transition: opacity 220ms ease;
}

.video-ui {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.video-title,
.video-footer,
.play-button {
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, transform 220ms ease, visibility 220ms;
}

.video-title {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: 18px;
  right: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.88);
  transform: translateY(-6px);
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 62px;
  height: 62px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(8, 8, 8, 0.52);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  transform: translate(-50%, -50%) scale(0.92);
  cursor: pointer;
}

.play-button:hover {
  background: rgba(20, 20, 20, 0.68);
}

.play-button:active {
  transform: translate(-50%, -50%) scale(0.86);
}

.icon {
  width: 27px;
  height: 27px;
  fill: currentColor;
}

.icon-play {
  margin-left: 4px;
}

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

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

.video-footer {
  position: absolute;
  left: 16px;
  right: 12px;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateY(8px);
}

.video-description {
  width: calc(100% - 8px);
  max-width: 370px;
  min-height: 1.45em;
  margin: 0 0 14px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  font-size: 14px;
  line-height: 1.48;
  text-shadow: 0 2px 8px #000, 0 1px 2px #000;
  overflow-wrap: anywhere;
}

.control-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 36px 36px;
  align-items: center;
  gap: 8px;
}

.time-current,
.time-duration {
  min-width: 35px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

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

.progress {
  --progress: 0%;
  width: 100%;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.progress::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) var(--progress), rgba(255, 255, 255, 0.38) var(--progress));
}

.progress::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border: 2px solid #fff;
  border-radius: 50%;
  appearance: none;
  background: var(--accent);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
}

.progress::-moz-range-track {
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.38);
}

.progress::-moz-range-progress {
  height: 3px;
  border-radius: 99px;
  background: var(--accent);
}

.progress::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
}

.small-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.small-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.small-button .icon {
  width: 22px;
  height: 22px;
}

.icon-expand,
.icon-collapse {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-collapse {
  display: none;
}

.is-fullscreen .icon-expand {
  display: none;
}

.is-fullscreen .icon-collapse {
  display: block;
}

.mute-mark {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.3;
  stroke-linecap: round;
}

.has-sound .mute-mark {
  display: none;
}

.controls-visible .video-shade,
.controls-visible .video-title,
.controls-visible .video-footer,
.controls-visible .play-button {
  opacity: 1;
  visibility: visible;
}

.controls-visible .video-title,
.controls-visible .video-footer {
  transform: translateY(0);
}

.controls-visible .play-button {
  transform: translate(-50%, -50%) scale(1);
}

.controls-visible .video-title,
.controls-visible .video-footer,
.controls-visible .play-button,
.controls-visible .video-ui button,
.controls-visible .video-ui input {
  pointer-events: auto;
}

.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: spin 0.8s linear infinite;
}

.is-loading .loading-indicator {
  opacity: 1;
}

.video-error::after {
  content: "视频暂时无法播放，请检查浏览器格式支持";
  position: absolute;
  top: 50%;
  left: 24px;
  right: 24px;
  z-index: 4;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  transform: translateY(-50%);
}

.video-card:fullscreen,
.video-card:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
}

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

@media (min-width: 431px) {
  .video-card {
    height: calc(100svh - (var(--gap) * 2));
    min-height: 560px;
    border-radius: 26px;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .video-card {
    min-height: calc(100svh - var(--gap));
  }

  .video-description {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
