/* =========================================================
   オーバーレイ全体
========================================================= */
#ml-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

#ml-overlay.ml-active {
  display: flex;
}

/* 背景（半透明黒）*/
#ml-overlay-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

/* =========================================================
   画像コンテナ
========================================================= */
#ml-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  animation: ml-fadeIn 0.25s ease;
}

@keyframes ml-fadeIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

/* =========================================================
   拡大画像
========================================================= */
#ml-img {
  display: block;
  max-width:  90vw;
  max-height: 80vh;
  width:  auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  cursor: default;
}

/* =========================================================
   キャプション
========================================================= */
#ml-caption {
  margin-top: 12px;
  color: #ddd;
  font-size: 0.9rem;
  text-align: center;
  max-width: 80vw;
  line-height: 1.5;
}

/* =========================================================
   閉じるボタン
========================================================= */
#ml-close {
  position: absolute;
  top: -44px;
  right: -4px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  transition: color 0.2s, transform 0.2s;
  z-index: 2;
}
#ml-close:hover {
  color: #f66;
  transform: scale(1.2);
}

/* =========================================================
   前後ボタン
========================================================= */
#ml-prev,
#ml-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 1.8rem;
  width:  48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  z-index: 2;
}
#ml-prev { left:  16px; }
#ml-next { right: 16px; }
#ml-prev:hover,
#ml-next:hover {
  background: rgba(255,255,255,0.28);
  transform: translateY(-50%) scale(1.1);
}

/* =========================================================
   レスポンシブ
========================================================= */
@media (max-width: 600px) {
  #ml-prev { left:  6px; }
  #ml-next { right: 6px; }
  #ml-close { top: -40px; right: 0; }
}
