/**
 * 小云雀式全屏预览 + galleryCard
 * 原则：画幅跟媒体走（不强制 16:9）、标题不压控件、遮罩真沉浸
 */

/* ========== 全屏预览 ========== */
#xyq-preview[hidden],
.xyq-fullscreen-preview-modal-backdrop[hidden] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.xyq-fullscreen-preview-modal-backdrop {
  align-items: center;
  background: rgba(8, 9, 12, 0.92);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 400;
  padding: 0;
  box-sizing: border-box;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.xyq-fullscreen-preview-modal-stage {
  display: grid;
  height: 100%;
  width: 100%;
  overflow: hidden;
  place-items: center;
  position: relative;
  padding: 56px 48px 48px;
  box-sizing: border-box;
}

/* 顶栏：左标题 + 右关闭 */
.xyq-fullscreen-preview-modal-toolbar {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  position: absolute;
  left: 20px;
  right: 20px;
  top: 16px;
  z-index: 3;
  pointer-events: none;
}

.xyq-fullscreen-preview-modal-toolbar > * {
  pointer-events: auto;
}

.xyq-preview-titlebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: min(70vw, 520px);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid hsla(0, 0%, 100%, 0.12);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #fff;
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
}

.xyq-preview-titlebar[hidden] {
  display: none !important;
}

.xyq-preview-titlebar b {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xyq-preview-titlebar span {
  font-size: 11.5px;
  color: hsla(0, 0%, 100%, 0.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xyq-fullscreen-preview-modal-close {
  align-items: center;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid hsla(0, 0%, 100%, 0.18);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.26);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  height: 40px;
  width: 40px;
  padding: 0;
  flex-shrink: 0;
  margin-left: auto;
  -webkit-tap-highlight-color: transparent;
}

.xyq-fullscreen-preview-modal-close:hover {
  background: rgba(15, 23, 42, 0.95);
}

.xyq-fullscreen-preview-modal-close svg {
  height: 18px;
  width: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 媒体区：不强制比例 */
.xyq-fullscreen-preview-media {
  align-items: center;
  display: flex;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.xyq-fullscreen-preview-image {
  display: block;
  max-height: calc(100dvh - 120px);
  max-width: min(1200px, calc(100vw - 96px));
  width: auto;
  height: auto;
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(2, 6, 23, 0.45), 0 8px 24px rgba(2, 6, 23, 0.28);
}

/* 视频壳：跟真实画幅走 */
.xyq-fullscreen-preview-video-media {
  position: relative;
  background: #000;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(2, 6, 23, 0.45), 0 8px 24px rgba(2, 6, 23, 0.28);
  max-width: min(1280px, calc(100vw - 96px));
  max-height: calc(100dvh - 120px);
  line-height: 0;
}

.xyq-fullscreen-preview-video-media video {
  display: block;
  max-width: min(1280px, calc(100vw - 96px));
  max-height: calc(100dvh - 120px);
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

/* 自定义底栏控件：不与标题打架 */
.xyq-vctrl {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 36px 14px 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.72) 55%);
  color: #fff;
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  opacity: 1;
  transition: opacity 0.2s ease;
  z-index: 2;
}

/* 播放中默认藏控件；hover / 点按唤出（is-controls）/ 拖进度时常显 */
.xyq-fullscreen-preview-video-media.is-playing:not(:hover):not(.is-scrubbing):not(.is-controls)
  .xyq-vctrl {
  opacity: 0;
  pointer-events: none;
}

.xyq-fullscreen-preview-video-media.is-playing:hover .xyq-vctrl,
.xyq-fullscreen-preview-video-media.is-scrubbing .xyq-vctrl,
.xyq-fullscreen-preview-video-media.is-controls .xyq-vctrl,
.xyq-fullscreen-preview-video-media:not(.is-playing) .xyq-vctrl {
  opacity: 1;
  pointer-events: auto;
}

.xyq-vctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid hsla(0, 0%, 100%, 0.14);
  color: #fff;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.xyq-vctrl-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.xyq-vctrl-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: none;
}

.xyq-vctrl-btn.is-mute svg {
  opacity: 0.85;
}

.xyq-vctrl-track {
  flex: 1;
  min-width: 0;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.xyq-vctrl-track i {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  position: relative;
  overflow: hidden;
}

.xyq-vctrl-track i::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--p, 0%);
  background: #fff;
  border-radius: 99px;
}

.xyq-vctrl-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: hsla(0, 0%, 100%, 0.78);
  flex-shrink: 0;
  min-width: 72px;
  text-align: right;
  letter-spacing: 0.01em;
}

/* 大播放钮（暂停态居中） */
.xyq-vbig {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.xyq-fullscreen-preview-video-media:not(.is-playing) .xyq-vbig {
  opacity: 1;
}

.xyq-vbig i {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.48);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.28);
  position: relative;
  border: 1px solid hsla(0, 0%, 100%, 0.16);
}

.xyq-vbig i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-38%, -50%);
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #fff;
}

/* 底部 footer 仅图片用（视频标题已上顶栏） */
.xyq-fullscreen-preview-modal-footer {
  bottom: 18px;
  display: flex;
  justify-content: center;
  left: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  z-index: 2;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.xyq-fullscreen-preview-modal-footer > * {
  pointer-events: auto;
}

.xyq-preview-caption {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(640px, calc(100vw - 48px));
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid hsla(0, 0%, 100%, 0.18);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.26);
  color: #fff;
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
}

.xyq-preview-caption[hidden] {
  display: none !important;
}

.xyq-preview-caption b {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(420px, 60vw);
}

.xyq-preview-caption span {
  font-size: 12px;
  color: hsla(0, 0%, 100%, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(200px, 28vw);
}

/* 图片：关闭钮变白圆 */
.xyq-fullscreen-preview-modal-backdrop.is-image
  .xyq-fullscreen-preview-modal-close {
  background: hsla(0, 0%, 100%, 0.82);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.18);
  color: #111827;
}

.xyq-fullscreen-preview-modal-backdrop.is-image
  .xyq-fullscreen-preview-modal-close:hover {
  background: #fff;
}

.xyq-fullscreen-preview-modal-backdrop.is-image .xyq-preview-titlebar {
  background: hsla(0, 0%, 100%, 0.82);
  border: 0;
  color: #111;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.12);
}

.xyq-fullscreen-preview-modal-backdrop.is-image .xyq-preview-titlebar span {
  color: rgba(17, 24, 39, 0.55);
}

/* 预览打开：彻底藏底栏 */
body.xyq-preview-open .mobile-tabbar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.xyq-preview-open {
  overflow: hidden !important;
}

/* ========== 卡片 galleryCard ========== */
.xyq-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* Luma：深卡 + 细边，不白底 */
.xyq-gallery-card {
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-sizing: border-box;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  min-width: 0;
  overflow: hidden;
  position: relative;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
  text-align: left;
  width: 100%;
  padding: 0;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
}

.xyq-gallery-card:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: #1a1a1a;
  transform: translateY(-1px);
}

.xyq-gallery-card:active {
  transform: scale(0.995);
}

.xyq-gallery-visual {
  aspect-ratio: 16 / 10;
  background: #0a0a0a;
  overflow: hidden;
  position: relative;
  width: 100%;
  flex-shrink: 0;
}

.xyq-gallery-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.xyq-gallery-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  color: #737373;
  background: #111;
}

.xyq-gallery-card:hover .xyq-gallery-visual img {
  transform: scale(1.03);
}

.xyq-gallery-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: transparent;
}

.xyq-gallery-play i {
  display: block;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.48);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.2);
  border: 1px solid hsla(0, 0%, 100%, 0.14);
  position: relative;
}

.xyq-gallery-play i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-38%, -50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent #fff;
}

.xyq-gallery-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px 14px;
  background: transparent;
  min-width: 0;
}

.xyq-gallery-meta b {
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "PingFang SC", sans-serif;
}

.xyq-gallery-meta span {
  color: #737373;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "PingFang SC", sans-serif;
}

/* ========== 响应式 ========== */
@media (max-width: 1100px) {
  .xyq-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .xyq-fullscreen-preview-modal-stage {
    padding: 52px 0 0;
  }

  .xyq-fullscreen-preview-modal-toolbar {
    left: 12px;
    right: 12px;
    top: 10px;
  }

  .xyq-preview-titlebar {
    max-width: calc(100vw - 72px);
    padding: 7px 12px;
  }

  .xyq-preview-titlebar b {
    font-size: 12.5px;
  }

  .xyq-fullscreen-preview-modal-close {
    height: 36px;
    width: 36px;
    border-radius: 999px;
  }

  .xyq-fullscreen-preview-media {
    width: 100%;
    height: 100%;
  }

  .xyq-fullscreen-preview-video-media {
    max-width: 100vw;
    max-height: calc(100dvh - 52px);
    width: 100vw;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - 52px);
  }

  .xyq-fullscreen-preview-video-media video {
    max-width: 100vw;
    max-height: calc(100dvh - 52px);
    width: 100%;
    height: auto;
  }

  .xyq-fullscreen-preview-image {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 120px);
    border-radius: 8px;
  }

  .xyq-vctrl {
    padding: 40px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .xyq-vctrl-time {
    min-width: 64px;
    font-size: 10.5px;
  }

  .xyq-vbig i {
    width: 56px;
    height: 56px;
  }

  .xyq-fullscreen-preview-modal-footer {
    bottom: 14px;
  }

  .xyq-preview-caption span {
    display: none;
  }

  /* H5 作品：双列更紧凑，少「一条占满屏」的粗糙感 */
  .xyq-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .xyq-gallery-grid.is-feature {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .xyq-gallery-card {
    border-radius: 14px;
  }

  .xyq-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xyq-gallery-grid.is-feature {
    grid-template-columns: 1fr;
  }

  .xyq-gallery-visual {
    aspect-ratio: 4 / 3;
  }

  .xyq-gallery-grid.is-feature .xyq-gallery-visual {
    aspect-ratio: 16 / 10;
  }

  .xyq-gallery-play i {
    width: 40px;
    height: 40px;
  }

  .xyq-gallery-play i::after {
    border-width: 7px 0 7px 11px;
  }

  .xyq-gallery-meta {
    padding: 10px 11px 12px;
  }

  .xyq-gallery-meta b {
    font-size: 12.5px;
  }

  .xyq-gallery-meta span {
    font-size: 11px;
  }
}
