body {
  margin: 0;
  font-family: system-ui, sans-serif;
}

#image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 16px;
}

/* 防止被列算法拆分 */
.material-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s;
}

.material-card:hover {
  transform: translateY(-4px);
}

.material-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #f2f2f2;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  width: 80vw;
  height: 80vh;
  border-radius: 12px;

  display: flex;
  flex-direction: column;
  padding: 16px;
  box-sizing: border-box;
}

/* 图片容器：只负责“限制高度” */
.modal-image-wrap {
  flex: 1; /* ⭐ 占据中间所有剩余空间 */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 图片本身：完整显示 */
#modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* 底部信息 + 按钮区域 */
.modal-info {
  margin-top: 12px;
}

#modal-title {
  margin: 0 0 4px 0;
  font-size: 16px;
}

#modal-meta {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #666;
}

#create-btn {
  display: inline-block;
  padding: 10px 16px;
  background: #1677ff;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
}
