* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }

body {
  background: linear-gradient(-30deg, #FFD1D1 25%, #EADBFF 55%, #AFDEFF 100%);/* f7f8fc */
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8px;/* 16 */
}

#app { width: 100%; max-width: 1400px; margin: 0 auto; }
.view { display: none; width: 100%; }
.view.active { display: block; }

/* ===== 首页格子 ===== */
#home-view h1 { font-size: 1.5rem; margin: 20px 0 24px; color: #1e293b; font-weight: 600; text-align: center; }

/* ===== 首页排序按钮 ===== */
.sort-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}
.sort-btn {
  display: inline-block;
  padding: 8px 22px;
  border-radius: 40px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.sort-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.sort-btn.active {
  background: #1e293b;
  border-color: #1e293b;
  color: #ffffff;
}

.collection-grid {
  display: grid;
  /* PC端列数：可自定义 */
  grid-template-columns: repeat(8, 1fr);
  gap: 20px;
  padding: 0 8px;
}

.collection-card {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(0,0,0,.33), 0 2px 6px rgba(0,0,0,.45);
  padding: 24px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  aspect-ratio: 1 / 1;
}
.collection-card:hover { transform: translateY(-4px); box-shadow: 0 12px 16px rgba(0,0,0,.5); }
.card-icon { font-size: 3rem; margin-bottom: 8px; }
.card-name { font-size: 1.2rem; font-weight: 500; color: #0f172a; letter-spacing: .5px; }

/* ===== 浏览页 ===== */
.browse-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  margin: 8px 0 24px; gap: 12px;
}
.btn-secondary {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 60px;
  padding: 10px 20px; font-weight: 500; color: #1e293b; text-decoration: none;
  transition: all .2s; box-shadow: 0 2px 6px rgba(0,0,0,.02); font-size: .95rem;
}
.btn-secondary:hover { background: #f1f5f9; border-color: #cbd5e1; }

#browse-title { font-size: 1.25rem; font-weight: 600; color: #0f172a; margin: 0; }
.page-info {
  color: #475569; background: #fff; padding: 8px 16px; border-radius: 40px;
  font-size: .9rem; box-shadow: 0 2px 6px rgba(0,0,0,.02); border: 1px solid #eef2f6;
}

/* ===== 图片网格：PC端 5列 = 每页20张恰好4行 ===== */
.image-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);   /* ← PC端列数自定义点 */
  gap: 16px;
  margin-bottom: 32px;
  padding: 0 4px;
}

.image-card {
  background: #fff; border-radius: 6px; overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.03), 0 1px 3px rgba(0,0,0,.05);
  transition: transform .15s, box-shadow .2s;
  position: relative; aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9;
}
.image-card:hover { transform: scale(1.02); box-shadow: 0 6px 12px rgba(0,0,0,.8); }
.image-card img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.image-card img:hover { opacity: .92; }

.copy-btn {
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px); color: #fff; border: none;
  border-radius: 4px; padding: 6px 12px; font-size: .8rem; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.2);
  font-weight: 500; display: flex; align-items: center; gap: 4px;
}
.copy-btn:hover { background: rgba(0,120,0, 1); }
.small-copy { position: absolute; bottom: 4px; right: 4px; padding: 6px 10px; font-size: .75rem; }

/* 小图左下角显示 URL 尾段 */
.url-tail {
  position: absolute;
  left: 0px;
  bottom: 0px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 0px;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  /*opacity: 0;*/
  /*transition: opacity 0.2s;*/
  z-index: 2;
}
.image-card:hover .url-tail {
  /*opacity: 1;*/
}


/* 灯箱图片上方显示 URL 尾段 */
/* 灯箱容器：垂直排列，尾段在图片上方外部 */
.lightbox-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90%;
  max-height: 90%;
  gap: 12px;
}

/* 灯箱图片上方（外部）显示 URL 尾段 */
.lightbox-url-tail {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 2rem;
  padding: 6px 14px;
  border-radius: 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  flex-shrink: 0;
}



/* ===== 分页 ===== */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 20px 0 40px; }
.page-btn {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 14px;
  font-size: .9rem; font-weight: 500; color: #1e293b; cursor: pointer;
  transition: all .15s; min-width: 40px; text-align: center;
}
.page-btn:hover:not(:disabled) { background: #B9D8EA; border-color: #cbd5e1; } /* f1f5f9 */
.page-btn.active { background: #1e293b; border-color: #1e293b; color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.jump-container { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
#jump-input {
  width: 70px; padding: 8px; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: .9rem; text-align: center; outline: none;
}

/* ===== 灯箱 ===== */
.lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.8); backdrop-filter: blur(8px);
  z-index: 1000; align-items: center; justify-content: center;
}
.lightbox-content { position: relative; width: 90vw; max-width: 1100px; height: 90vh; display: flex; align-items: center; justify-content: center; }
.lightbox-img-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /*box-shadow: 0 20px 50px rgba(250, 250, 250, 0.75);*/
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  max-width: 100%;
  max-height: 100%;
}
.lightbox-img-wrapper img { display: block; max-width: 100%; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.lightbox-close {
  position: absolute; top: -20px; right: -20px; background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 2.4rem;
  width: 48px; height: 48px; border-radius: 5%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(4px); line-height: 1;
}

/*
.lightbox-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px); color: #fff;
  border: 1px solid rgba(255,255,255,.15); font-size: 2.8rem;
  width: 56px; height: 56px; border-radius: 5%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; line-height: 1; user-select: none;
}
.lightbox-arrow:hover { background: rgba(255,255,255,.2); }
.lightbox-arrow.left { left: 10px; }
.lightbox-arrow.right { right: 10px; }
*/

/* 灯箱图片下方的导航按钮（左下角 / 右下角） */
.lightbox-nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}
.lightbox-arrow {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 2.4rem;
  width: 8em;
  height: 1em;
  border-radius: 5%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  user-select: none;
  transition: background 0.2s;
}
.lightbox-arrow:hover { background: rgba(255, 255, 255, 0.2); }


.lightbox-copy { position: absolute; bottom: 4px; right: 4px; padding: 10px 16px; border-radius: 4px; font-size: .75rem; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1e293b; color: #fff; padding: 12px 24px; border-radius: 60px;
  font-size: .95rem; box-shadow: 0 12px 30px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  z-index: 2000; font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 响应式：移动端列数自定义点 ===== */
@media (max-width: 1024px) {
  .image-grid { grid-template-columns: repeat(4, 1fr); }  /* 平板：4列 */
  .collection-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .image-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; } /* 手机：3列 */
  .collection-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .browse-header { flex-direction: column; align-items: flex-start; }
  .lightbox-arrow { width: 44px; height: 44px; font-size: 2rem; }
  .lightbox-close { top: -10px; right: -10px; width: 40px; height: 40px; }
}
@media (max-width: 480px) {
  .image-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } /* 小屏：2列 */
  .collection-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  body { padding: 8px; }
  #browse-title { font-size: 1.2rem; }
}