/* zp.css - 优化版本 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #fdf5f0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  color: #4a3f3a;
  line-height: 1.6;
  padding: 16px;
}

.page {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.back-btn {
  background: #f1e1d6;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  text-decoration: none;
  color: #764d36;
  transition: background-color 0.2s;
}

.back-btn:active {
  background: #e9b8a3;
  color: white;
}

h1 {
  font-size: 1.8rem;
  color: #593f31;
}

.photo-section {
  background: white;
  border-radius: 36px;
  padding: 28px 26px;
  box-shadow: 0 15px 30px rgba(170, 130, 100, 0.05);
  border: 1px solid #ffefe6;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.4rem;
  color: #4d3a2e;
  margin-bottom: 20px;
  border-left: 5px solid #ecc6b5;
  padding-left: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.photo-count {
  font-size: 0.9rem;
  color: #bca594;
  font-weight: normal;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.photo-item {
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(170, 130, 100, 0.1);
  cursor: pointer;
  transition: transform 0.2s;
  aspect-ratio: 1 / 1; /* 保持正方形比例 */
}

.photo-item:active {
  transform: scale(0.98);
}

.photo-image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
  background-color: #f5e8e0; /* 加载前的占位颜色 */
}

/* 懒加载相关样式 */
.photo-image.loaded {
  background-image: var(--bg-image);
}

.photo-image .loading-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #ecc6b5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.photo-image.loading .loading-spinner {
  display: block;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.photo-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 5px 15px;
  border-radius: 30px;
  font-size: 0.9rem;
  color: #764d36;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 2;
}

/* 加载状态 */
.loading-status {
  text-align: center;
  padding: 20px 0;
  display: none;
}

.loading-status.show {
  display: block;
}

.loading-text {
  display: inline-block;
  padding: 8px 24px;
  background: #f1e1d6;
  border-radius: 30px;
  color: #764d36;
  font-size: 0.9rem;
}

/* 骨架屏效果 */
.skeleton {
  background: linear-gradient(90deg, #f0e4dc 25%, #f8efe9 50%, #f0e4dc 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 页脚 */
.footer {
  text-align: center;
  color: #bca594;
  font-size: 0.9rem;
  padding: 20px 0;
}

.footer-note {
  font-size: 0.8rem;
}

/* 弹窗样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s;
}

.modal-content {
  max-width: 90%;
  max-height: 80%;
  border-radius: 24px;
  border: 4px solid white;
  animation: zoomIn 0.3s;
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 44px;
  cursor: pointer;
  z-index: 1001;
  padding: 10px;
  transition: color 0.2s;
}

.close-modal:hover {
  color: #ecc6b5;
}

.modal-caption {
  position: absolute;
  bottom: 30px;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  font-size: 1.2rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 12px 24px;
  margin: 0 auto;
  width: fit-content;
  border-radius: 60px;
}

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

@keyframes zoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 响应式调整 */
@media (min-width: 768px) {
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 图片加载失败样式 */
.photo-image.error {
  background-color: #f0e0d8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-image.error::after {
  content: "😢 加载失败";
  color: #bca594;
  font-size: 0.8rem;
}

/* 隐藏modal-caption（如果保留在HTML中） */
.modal-caption {
    display: none;
}
/* 在zp.css中添加或修改 */

.loading-status {
  text-align: center;
  padding: 20px 0;
  margin: 10px 0;
  display: none; /* 默认隐藏 */
  cursor: pointer;
  transition: all 0.3s ease;
}

.loading-status.show {
  display: block; /* 需要显示时显示 */
}

.loading-text {
  display: inline-block;
  padding: 12px 30px;
  background: #f1e1d6;
  border-radius: 30px;
  color: #764d36;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 4px 10px rgba(170, 130, 100, 0.1);
  transition: background-color 0.2s;
}

.loading-text:hover {
  background: #e9b8a3;
  color: white;
}

/* 图片加载失败样式 */
.photo-image.error {
  background-color: #f0e0d8;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.photo-image.error::after {
  content: "😢";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  color: #bca594;
}

/* 确保图片容器有正确的高度 */
.photo-image {
  width: 100%;
  height: 100%;
  min-height: 160px;
  background-size: cover;
  background-position: center;
  position: relative;
  background-color: #f5e8e0; /* 加载前的占位颜色 */
  transition: background-image 0.3s ease;
}