/* ===== PIP（左下ミニ動画） フェードイン対応 ===== */
.pip-video-shell {
  position: fixed;
  left: 2vw;
  bottom: 15vw;
  width: var(--pip-mini-w, 120px);
  aspect-ratio: var(--pip-ar, 9 / 16);
  height: auto;
  z-index: 1200;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  background: #000;

  /* フェードイン */
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;

  /* 既存のトランジションに opacity を追加 */
  transition:
    opacity .35s ease,
    transform .25s ease,
    width .25s ease,
    height .25s ease,
    left .25s ease,
    top .25s ease,
    bottom .25s ease;
}

.pip-video-shell.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.pip-video-shell.is-hidden {
  display: none;
}

.pip-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* 閉じるボタン・Backdropは前回のままでOK */
/* 拡大時のオーバーレイ */
.pip-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease;
  z-index: 1150;
}

.pip-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  cursor: pointer;
}

.pip-close svg {
  width: 16px;
  height: 16px;
  display: block;
}

.pip-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease;
  z-index: 1150;
}

.pip-backdrop.is-show {
  opacity: 1;
  visibility: visible;
}

/* 拡大時（サイズはJSで計算してinlineでwidth指定） */
.pip-video-shell.is-expanded {
  left: 50% !important;
  top: 50% !important;
  bottom: auto !important;
  transform: translate(-50%, -50%);
}

/* スクロール抑止 */
html.non-scroll,
body.non-scroll {
  overflow: hidden;
}

/* 二重再生防止 */
.fs-m-itempagevideo {
  display: none;
}

@media screen and (min-width:768px) {
.pip-video-shell {
  bottom: 2vw;
}
}

@media screen and (max-width:768px) {
  .is-expanded .pip-close {
  top: 10vw;
}
}

@media (prefers-reduced-motion: reduce) {
  .pip-video-shell,
  .pip-backdrop {
    transition: none !important;
  }
}
