html, body {
  height: 100%;
}

.video-body-wrapper {
  height: 100vh;
  height: 100dvh;
}

.stage {
  width: 100%;
  height: 100%;
}

.player {
  backface-visibility: hidden;
  will-change: transform;
  transform: translate3d(0,0,0);

}

.player.active {
  transform: translate3d(0,0,0);

}

.player.next {
  transform: translate3d(0,100%,0);
}

.player.prev {
  transform: translate3d(0,-100%,0);
}

.video-body-wrapper {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 9999999;
  background: #000;
  overflow: hidden;

  display: flex;
  justify-content: center;
  align-items: center;
}

/* mobile full */
.stage {
  position: relative;
  overflow: hidden;
  background: #000;

  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* desktop */
@media (min-width: 1024px) {

  .stage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: min(420px, 90vh * 9 / 16);
    height: 90vh;
    max-height: 800px;
    aspect-ratio: 9 / 16;
  }
}

/* ---------- SLIDE LAYER ---------- */
#layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* video + ad 공통 */
.player {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;
}

.player video,
video.player {
  width: 100%;
  height: 100%;
  object-fit: cover;

  display: block;
}

/* snap 애니메이션 전용 클래스 */
.player.snap {
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 기존 active/next/prev는 최소화 */
.player.active {
  transform: translate3d(0, 0%, 0);
}
.player.next {
  transform: translate3d(0, 100%, 0);
}
.player.prev {
  transform: translate3d(0, -100%, 0);
}

.player.next2 {
  transform: translateY(200%);

}

/* video */
.player video,
video.player {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* ad */
.ad-player {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

/* ---------- UI ---------- */
.ui-layer,
.ui {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.ui * {
  pointer-events: auto;
}

/* progress */
.progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.15);
  z-index: 120;
}

.progress .bar {
  width: 0%;
  height: 100%;
  background: red;
  transition: width 0.05s linear;
}

.progress.ad .bar {
  background: #FFD400;
}

/* title */
.title {
  position: absolute;
  bottom: 14px;
  left: 10px;
  right: 10px;

  z-index: 120;

  color: #fff;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;

  padding: 8px 12px;
  border-radius: 10px;

  background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  text-shadow: 0 2px 10px rgba(0,0,0,.8);

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;

  pointer-events: none;
}

/* controls */
.nav-btn,
.sound-btn,
.close-btn {
  position: absolute;
  width: 44px;
  height: 44px;

  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.3);

  background: rgba(0,0,0,.45);
  color: #fff;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  z-index: 150;
  backdrop-filter: blur(8px);
}

.nav-btn.up {
  right: 20px;
  top: calc(50% - 35px);
}

.nav-btn.down {
  right: 20px;
  top: calc(50% + 35px);
}

.sound-btn {
  right: 20px;
  top: calc(50% + 105px);
}

.close-btn {
  right: 20px;
  top: 20px;
}

/* play overlay */
.play-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 160;

  font-size: 60px;
  color: #fff;
  background: none;
  border: none;

  display: none;
}

/* loading */
.loading-cover {
  position: absolute;
  inset: 0;
  z-index: 170;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #000;
  color: #fff;
}

.loading-cover.hide {
  display: none;
}

/* native controls hide */
video::-webkit-media-controls,
video::-webkit-media-controls-panel,
video::-webkit-media-controls-play-button,
video::-webkit-media-controls-start-playback-button {
  display: none !important;
  opacity: 0 !important;
  -webkit-appearance: none !important;
}
.ad-player {
  position: absolute;
  inset: 0;
  background: #000 !important;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
}

.ui-layer,
.ui {
  position: absolute;
  inset: 0;
  z-index: 100; /* ad보다 위 */
  pointer-events: none;
}


.ad-player > div,
.ad-player iframe,
.ad-player ins {
  display: block;
  margin: auto !important;
  max-width: 100%;
  max-height: 100%;
}
#layer.ad-mode .player:not(.active) {
  opacity: 0 !important;
  visibility: hidden !important;
}

.player {
  display: none !important;
}

.player.active,
.player.prev,
.player.next,
.player.next2 {
  display: block !important;
}

.player.ad-player {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  transform: none !important;
}

.player.prev { z-index:1; }
.player.next2 { z-index:2; }
.player.next { z-index:3; }
.player.active { z-index:4; }