/* ==========================================================================
   随机图库 /tools/randimg.php 的样式
   配色全部用站点 CSS 变量，深浅色自动跟随（html[data-theme]）
   ========================================================================== */

.rp-wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 40px; }

/* ---------------- 顶部标题 ---------------- */
.rp-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.rp-title {
  margin: 0; font-size: 22px; font-weight: 800;
  color: var(--text); letter-spacing: -.2px;
}
.rp-desc { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

/* ---------------- 分类切换（吸顶） ---------------- */
.rp-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px;
  position: sticky; top: calc(var(--header-height, 60px) + 8px); z-index: 20;
  padding: 8px 0;
  background: linear-gradient(to bottom, var(--bg) 62%, transparent);
}
.rp-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; text-decoration: none;
  color: var(--text-secondary); background: var(--card-bg-solid);
  border: 1px solid var(--border-light);
  transition: color .18s, border-color .18s, transform .18s;
  white-space: nowrap;
}
.rp-tab:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-1px); }
.rp-tab.is-on {
  background: var(--primary-gradient); color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(91, 108, 255, .28);
}

/* ---------------- 工具条 ---------------- */
.rp-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.rp-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; text-decoration: none;
  color: var(--text-secondary); background: var(--card-bg-solid);
  border: 1px solid var(--border-light);
  transition: color .18s, border-color .18s, background .18s, filter .18s;
}
.rp-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-bg); }
.rp-btn.is-primary {
  background: var(--primary-gradient); color: #fff; border-color: transparent;
  box-shadow: 0 3px 12px rgba(91, 108, 255, .26);
}
.rp-btn.is-primary:hover { color: #fff; filter: brightness(1.06); background: var(--primary-gradient); }
.rp-count { font-size: 12.5px; color: var(--muted-light); margin-left: auto; }

/* ---------------- 瀑布流网格 ---------------- */
.rp-grid { column-count: 4; column-gap: 14px; }
.rp-card {
  break-inside: avoid; -webkit-column-break-inside: avoid;
  margin: 0 0 14px; position: relative;
  border-radius: 14px; overflow: hidden; cursor: zoom-in;
  background: var(--card-bg-solid);
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 10px rgba(30, 41, 80, .05);
  transition: transform .22s, box-shadow .22s;
}
.rp-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(30, 41, 80, .14); }
/* min-height 占位：图片还在加载时卡片就有稳定高度，不会整页跳动 */
.rp-card img {
  display: block; width: 100%; height: auto; min-height: 120px;
  background: var(--bg-deep); transition: opacity .25s;
}
.rp-card.is-loading img { opacity: 0; }
/* 图片加载完成后去掉 min-height，让它按真实比例显示 */
.rp-card:not(.is-loading) img { min-height: 0; }
.rp-cap {
  padding: 8px 10px; font-size: 12.5px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.rp-cap b { font-weight: 700; }
.rp-cap a { color: var(--muted-light); text-decoration: none; font-size: 12px; }
.rp-cap a:hover { color: var(--primary); }

/* ---------------- 空态 ---------------- */
.rp-empty {
  text-align: center; padding: 56px 20px; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 14px;
}
.rp-empty .rp-e-ico { font-size: 34px; margin-bottom: 10px; opacity: .55; }
.rp-empty a { color: var(--primary); font-weight: 600; }

.rp-tip {
  margin: 22px 0 0; font-size: 12.5px; color: var(--muted-light);
  text-align: center; line-height: 1.7;
}

/* ---------------- 灯箱 ---------------- */
.rp-lb {
  position: fixed; inset: 0; z-index: 99999;
  display: none; align-items: center; justify-content: center;
  background: rgba(12, 16, 30, .9); backdrop-filter: blur(3px);
  padding: 24px;
}
.rp-lb.is-on { display: flex; }
.rp-lb img {
  max-width: 92vw; max-height: 86vh; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); background: #111;
}
.rp-lb-x {
  position: absolute; top: 16px; right: 18px;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: none; background: rgba(255, 255, 255, .16); color: #fff; font-size: 19px;
  display: flex; align-items: center; justify-content: center; transition: background .18s;
}
.rp-lb-x:hover { background: rgba(255, 255, 255, .3); }
.rp-lb-tip {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: rgba(255, 255, 255, .72); font-size: 12.5px; white-space: nowrap;
}
.rp-lb-tip a { color: #8b94ff; text-decoration: none; font-weight: 600; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) { .rp-grid { column-count: 3; } }
@media (max-width: 900px)  { .rp-grid { column-count: 3; } }
@media (max-width: 680px) {
  .rp-wrap { padding: 14px 12px 32px; }
  .rp-title { font-size: 19px; }
  .rp-grid { column-count: 2; column-gap: 10px; }
  .rp-card { margin-bottom: 10px; border-radius: 12px; }
  .rp-cap { padding: 6px 8px; font-size: 11.5px; }
  .rp-tabs { gap: 6px; }
  .rp-tab { padding: 6px 12px; font-size: 12.5px; }
  .rp-count { width: 100%; margin-left: 0; margin-top: 2px; }
  .rp-lb-tip { font-size: 11.5px; bottom: 12px; }
}

/* ---------------- 异步取图的骨架占位 ----------------
   txt 模式（买家秀 / 随机艿子）首屏只出骨架，接口慢也不会白屏或卡住页面。 */
.rp-skelbox{
  height: 190px;
  background: linear-gradient(100deg, var(--bg-deep) 30%, var(--card-bg-solid) 50%, var(--bg-deep) 70%);
  background-size: 200% 100%;
  animation: rpShimmer 1.3s infinite;
}
.rp-card.is-skel{ cursor: default; }
.rp-card.is-skel:hover{ transform: none; box-shadow: 0 2px 10px rgba(30, 41, 80, .05); }
@keyframes rpShimmer{
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce){
  .rp-skelbox{ animation: none; }
}
