.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.modal.active {
  display: flex;
  opacity: 1;
  background: rgba(0, 0, 0, 0.9);
}

.modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 4px;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal.active img {
  transform: scale(1);
  opacity: 1;
}

.modal-close {
  position: fixed;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
  background: none;
  border: none;
  transition: opacity 0.2s;
  z-index: 10001;
}

.modal-close:hover {
  opacity: 0.7;
}

/* スマホではスクロール可能に */
@media (max-width: 768px) {
  .modal {
    padding: 10px;
    overflow-y: auto;
    align-items: flex-start;
  }
  
  .modal img {
    max-width: 100%;
    max-height: none;
    margin-top: 60px;
  }
}