.article {

  &>* {
    margin-bottom: 12px;
  }

  img {
    cursor: zoom-in;
    /*aspect-ratio: 7 / 5;*/
  }

  img[data-src] {
    padding: 20px;
  }
}


#preview_modal {
  --color-dialog-background: transparent;
  --swiper-pagination-top: 16px;
  --swiper-pagination-bottom: auto;
  --swiper-pagination-fraction-color: #fff;

  .modal-dialog {
    top: 50% !important;
    box-shadow: none;
    border: 0;
    margin: auto;
    transform: translateY(-50%);
    width: unset;
  }

  .modal-content {
    max-height: 90vh;
    padding: 0;
    width: 600px;
    margin: auto;
    max-width: 90vw;
  }

  .modal-body {
    padding: 0;
    width: 100%;
    height: 100%;
  }

  .swiper-slide {
    background-color: transparent;
    display: flex;
    align-items: center;
  }

  .swiper {
    height: 100%;

    img {
      object-fit: unset;
      cursor: grabbing;
      height: auto;
    }
  }

  .modal-close {
    width: 32px;
    height: 32px;
    position: absolute;
    right: 24px;
    top: 24px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;

    svg {
      color: #fff;
    }
  }
}

.comments {
  .avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-radius: 50%;
  }
}


.btn-like,
.btn-follow {
  &.is-active {

    .bg-white {
      background-color: var(--color-primary);
    }

    svg {
      color: #fff;
    }
  }
}

.btn-rec-refresh {
  &.is-refreshing {
    svg {
      animation: spin 1s ease-in-out;
    }
  }
}

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

/*
 * Keep a stable player box before the API/player modules are ready.
 * The old layout got its height from the video created by XGPlayer, so an
 * off-screen lazy player or any bootstrap failure collapsed to 0px.
 */
.dplayer {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Safari/old WebView fallback for devices without aspect-ratio support. */
@supports not (aspect-ratio: 16 / 9) {
  .dplayer {
    height: 0;
    padding-bottom: 56.25%;
  }
}

.dplayer > .xgplayer,
.dplayer .xgplayer {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
}

.dplayer .xgplayer video {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  background: #000;
}

/* Native controls remain usable if XGPlayer or the media resource fails. */
.dplayer .player-native-fallback,
.dplayer .dplayer-fallback,
.dplayer [data-player-fallback] {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  background: #000;
}

/* Respect the lifecycle script when it explicitly retires the fallback. */
.dplayer .player-native-fallback[hidden],
.dplayer .dplayer-fallback[hidden],
.dplayer [data-player-fallback][hidden] {
  display: none;
}

/* XGPlayer owns the surface after a successful hand-off. */
.dplayer[data-player-state='ready'] .player-native-fallback,
.dplayer[data-player-state='ready'] .dplayer-fallback,
.dplayer[data-player-state='ready'] [data-player-fallback] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Bootstrap/config failures use the native shell. A live XGPlayer media error
 * keeps its own retry UI visible because HLS may also recover in place. */
.dplayer[data-player-state='error']:not([data-player-error='media-load-failed']) .xgplayer {
  visibility: hidden;
  pointer-events: none;
}

.dplayer[data-player-state='error'] .player-native-fallback,
.dplayer[data-player-state='error'] .dplayer-fallback,
.dplayer[data-player-state='error'] [data-player-fallback] {
  z-index: 2;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.dplayer[data-player-error='media-load-failed'] .player-native-fallback,
.dplayer[data-player-error='media-load-failed'] .dplayer-fallback,
.dplayer[data-player-error='media-load-failed'] [data-player-fallback] {
  z-index: 1;
  pointer-events: none;
}

.dplayer[data-player-error='media-load-failed'] .player-shell-status[data-player-status] {
  visibility: hidden;
  opacity: 0;
}

/* Lightweight status UI that does not depend on either player library. */
.dplayer::before,
.dplayer::after {
  position: absolute;
  z-index: 3;
  left: 50%;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.dplayer::before {
  content: '';
  top: calc(50% - 25px);
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #f7a93a;
  border-radius: 50%;
  animation: dplayer-shell-spin 800ms linear infinite;
}

.dplayer::after {
  content: '视频加载中…';
  top: calc(50% + 13px);
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  white-space: nowrap;
}

/* New server-rendered shells expose a real status node for accessibility. */
.dplayer.player-shell::after {
  content: none;
}

.dplayer .player-shell-status[data-player-status] {
  position: absolute;
  z-index: 3;
  top: calc(50% + 13px);
  left: 50%;
  box-sizing: border-box;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.dplayer[data-player-state='ready']::before,
.dplayer[data-player-state='ready']::after,
.dplayer[data-player-state='destroyed']::before,
.dplayer[data-player-state='destroyed']::after {
  visibility: hidden;
  opacity: 0;
  animation: none;
}

.dplayer[data-player-state='ready'] .player-shell-status[data-player-status],
.dplayer[data-player-state='destroyed'] .player-shell-status[data-player-status] {
  visibility: hidden;
  opacity: 0;
}

.dplayer[data-player-state='error']::before {
  display: none;
}

.dplayer:not(.player-shell)[data-player-state='error']::after {
  content: '视频暂时无法加载，请稍后重试';
  top: 50%;
  padding: 7px 12px;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  white-space: normal;
}

.dplayer[data-player-state='error'] .player-shell-status[data-player-status] {
  top: 50%;
  padding: 7px 12px;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  white-space: normal;
}

.dplayer .xgplayer-error {
  box-sizing: border-box;
  padding: 16px;
}

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

@media (prefers-reduced-motion: reduce) {
  .dplayer::before {
    animation: none;
  }
}

.collect-modal .modal-header {
  padding: 16px 44px 12px 20px;
  border-bottom: 0;
}

.collect-modal .modal-body {
  padding: 0 20px 12px;
}

.collect-modal .modal-footer {
  padding: 0 20px 20px;
  border-top: 0;
}

.collect-modal .modal-close {
  position: absolute;
  right: 16px;
  top: 14px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text, #fff);
}

.collect-modal__title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
}

.collect-modal__panel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
}

.collect-modal__option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
}

.collect-modal__option + .collect-modal__option {
  margin-top: 10px;
}

.collect-modal__option input[type='radio'],
.collect-modal__option input[type='checkbox'] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #f7a93a;
}

.collect-modal__input {
  height: 40px;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.collect-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.collect-modal__footer .btn-new-folder {
  background: transparent;
  border: 0;
  color: var(--color-blue, #f7a93a);
  min-width: auto;
  padding: 0;
  height: auto;
  font-size: 14px;
}

.collect-modal__footer .btn-primary {
  min-width: 112px;
  height: 40px;
  padding: 0 24px;
  border-radius: 20px;
  font-size: 14px;
}

.collect-modal__footer .btn:not(.btn-primary) {
  min-width: 96px;
  height: 40px;
  padding: 0 20px;
  border-radius: 20px;
  font-size: 14px;
}
