/* =========================================
   MZ Modal (dialog) - YouTube
   ========================================= */

/* dialog base（全画面センタリング） */
.mzModal{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;           /* ←UAスタイル対策 */
  border: 0;
  padding: 0;
  background: transparent;
  overflow: visible;

  /* display: flex; */
  display: none;
  align-items: center;
  justify-content: center;
}

.mzModal[open]{
  display: flex;
}

/* backdrop = full screen mask */
.mzModal::backdrop{
  background: rgba(0,0,0,.68);
  animation: mzBackdropIn .22s ease forwards;
}

@keyframes mzBackdropIn{
  from{opacity:0;}
  to{opacity:1;}
}

@keyframes mzBackdropOut{
  from{opacity:1;}
  to{opacity:0;}
}

/* panel（ここにサイズを持たせる） */
.mzModal__panel{
  position: relative;
  width: min(980px, calc(100vw - 24px));  /* ←元の幅指定はここへ */
  border-radius: 16px;
  overflow: hidden;
  background: #0b0b0b;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  transform-origin: center;
}
/* close button */
.mzModal__close{
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  color: #fff;
  background: rgba(255,255,255,.10);
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}



.mzModal__close:hover{
  background: rgba(255,255,255,.16);
}

.mzModal__close:focus{
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* 16:9 */
.mzModal__ratio{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.mzModal__ratio iframe{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* open animation */
.mzModal[open] .mzModal__panel{
  animation: mzModalIn .22s ease forwards;
}

@keyframes mzModalIn{
  from{
    opacity: 0;
    transform: translateY(14px) scale(.985);
  }
  to{
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* close animation (JS adds .is-closing) */
.mzModal.is-closing .mzModal__panel{
  animation: mzModalOut .18s ease forwards;
}

.mzModal.is-closing::backdrop{
  animation: mzBackdropOut .18s ease forwards;
}

@keyframes mzModalOut{
  from{
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to{
    opacity: 0;
    transform: translateY(10px) scale(.99);
  }
}

/* small screens */
@media (max-width: 600px){
  .mzModal__panel{
    width: calc(100vw - 16px);
  }
  .mzModal__close{
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }
}