:root{
  --bg:#ffffff;
  --text:#111111;
  --muted:#6b7280;
  --line:#e5e7eb;
  --chip:#f3f4f6;
  --shadow:0 8px 24px rgba(0,0,0,.08);
}

*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
  font:14px/1.4 system-ui,"PingFang SC","Microsoft YaHei",Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}

/* 兜底：别再出现蓝色默认链接 */
a{color:inherit;text-decoration:none}
a:hover{text-decoration:none}

/* =========================
   兼容布局 A：p-body / sidebar / main / content（我们项目里常用）
========================= */
.p-body{display:flex;min-height:100vh}

/* 左侧栏（兼容 sidebar 结构） */
.sidebar{
  position:fixed;
  left:0; top:0; bottom:0;
  width:84px;
  background:#fff;
  border-right:1px solid var(--line);
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:14px 8px;
  gap:14px;
  z-index:30;
}
.sb-logo{
  width:44px;height:44px;border-radius:999px;
  display:flex;align-items:center;justify-content:center;
  background:#e60023;color:#fff;
  font-weight:800;
  box-shadow:var(--shadow);
}
.sb-nav{display:flex;flex-direction:column;gap:8px;width:100%;align-items:center}
.sb-bottom{margin-top:auto;display:flex;flex-direction:column;gap:8px;width:100%;align-items:center}
.sb-item{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  padding:10px 6px;
  border-radius:14px;
}
.sb-item:hover{background:var(--chip)}
.sb-item.active{background:var(--chip);font-weight:700}
.sb-ico{font-size:18px;line-height:1}
.sb-text{font-size:12px}

/* 右侧主区 */
.main{
  margin-left:84px;
  width:calc(100% - 84px);
  min-height:100vh;
  display:flex;
  flex-direction:column;
}
.content{padding:18px 16px 40px}

/* 顶部栏（兼容 topbar + topbar-inner） */
.topbar{
  position:sticky;
  top:0;
  width:100%;
  background:#fff;
  z-index:20;
  border-bottom:1px solid var(--line);
}
.topbar-inner{
  height:64px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 16px;
  max-width:1600px;
  margin:0 auto;
}

/* 顶部搜索栏（兼容 topbar-search + search-scope） */
.topbar-search{
  flex:1;
  display:flex;
  align-items:center;
  gap:8px;
  background:#f1f2f4;
  border:1px solid #eef0f3;
  border-radius:999px;
  padding:6px 10px;
}
.search-scope{
  border:0;
  background:transparent;
  font-size:13px;
  color:#374151;
  padding:4px 6px;
  outline:none;
  cursor:pointer;
}
.topbar-search input{
  flex:1;
  border:0;
  outline:none;
  background:transparent;
  font-size:14px;
}

/* 顶部右侧按钮 */
.topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
}
.tb-btn{
  padding:8px 12px;
  border-radius:999px;
  background:#f3f4f6;
  border:1px solid #eef0f3;
  white-space:nowrap;
  color:#111;
}
.tb-btn:hover{filter:brightness(.98)}

/* 头像 */
.avatar-link{display:inline-flex;align-items:center;justify-content:center}
.avatar{
  width:34px;height:34px;border-radius:999px;
  display:flex;align-items:center;justify-content:center;
  background:#2563eb;color:#fff;
  font-weight:700;
}

/* 全站通用搜索提示条 */
.search-summary-bar{
  max-width:1600px;
  margin:0 auto 14px;
  padding:10px 12px;
  border:1px solid #eef0f3;
  background:#fafafa;
  border-radius:14px;
  color:#374151;
}
.search-summary-bar strong{font-weight:800;color:#111}

/* =========================
   兼容布局 B：container / nav / search-box（你上次 CSS 用的那套）
========================= */
.container{padding:16px}
.nav{display:flex;gap:14px}
.nav a{font-weight:600}
.nav a:hover{text-decoration:underline}

/* 顶部栏简化结构兼容 */
.logo{
  width:36px;height:36px;border-radius:999px;
  display:flex;align-items:center;justify-content:center;
  background:#e60023;color:#fff;font-weight:800;
}
.search-box{
  flex:1;
  display:flex;
  gap:8px;
  max-width:900px;
}
.search-box select,
.search-box input{
  height:36px;
  padding:0 10px;
  border-radius:18px;
  border:1px solid #ddd;
  font-size:14px;
  outline:none;
}
.search-box input{flex:1}
.user-area{display:flex;align-items:center;gap:12px}
.user-avatar{
  width:36px;height:36px;border-radius:999px;
  display:flex;align-items:center;justify-content:center;
  background:#111;color:#fff;font-weight:800;
}

/* =========================
   素材瀑布流：兼容两套 class
   1) .feed + .pin
   2) .masonry + .masonry-item
========================= */

/* feed 版本（我们项目里常用） */
.feed{
  width:100%;
  column-gap:18px;
  column-count:6;
}
@media (max-width: 1600px){ .feed{column-count:5} }
@media (max-width: 1300px){ .feed{column-count:4} }
@media (max-width: 980px) { .feed{column-count:3} }
@media (max-width: 640px) { .feed{column-count:2} }
@media (max-width: 420px) { .feed{column-count:1} }

.pin{
  break-inside:avoid;
  -webkit-column-break-inside:avoid;
  display:inline-block;
  width:100%;
  margin:0 0 18px;
  vertical-align:top;
}
.pin-img{
  width:100%;
  border-radius:18px;
  overflow:hidden;
  background:#f3f4f6;
}
.pin-img img{width:100%;height:auto;display:block}
.pin-click{cursor:zoom-in}
.pin-img:hover{filter:brightness(.98)}

/* masonry 版本（你 earlier 的 materials.php 可能用这个） */
.masonry{
  column-count:5;
  column-gap:16px;
}
@media (max-width:1600px){ .masonry{column-count:4} }
@media (max-width:1200px){ .masonry{column-count:3} }
@media (max-width:800px) { .masonry{column-count:2} }
@media (max-width:480px) { .masonry{column-count:1} }

.masonry-item{
  break-inside:avoid;
  margin-bottom:16px;
  cursor:zoom-in;
}
.masonry-item img{
  width:100%;
  display:block;
  border-radius:12px;
  background:#f2f2f2;
}

/* =========================
   Lightbox（大图）
========================= */
.lightbox{
  position:fixed; inset:0;
  background:rgba(0,0,0,.86);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
}
.lightbox.show{display:flex}
.lightbox img{
  max-width:92vw;
  max-height:92vh;
  display:block;
  border-radius:10px;
}

/* 手机端 sidebar 缩窄 */
@media (max-width: 720px){
  .sidebar{width:64px}
  .main{margin-left:64px;width:calc(100% - 64px)}
  .sb-text{display:none}
}

/* ===== 横向顺序瀑布流：用“列容器”代替 column-count（避免坠落） ===== */
.feed, .masonry{
  display:flex;
  gap:18px;
  align-items:flex-start;
  column-count: initial !important;
  column-gap: initial !important;
}

/* 每一列 */
.feed-col{
  flex:1 1 0;
  display:flex;
  flex-direction:column;
  gap:18px;
  min-width:0;
}

/* 卡片样式兼容：不再需要 break-inside/inline-block */
.pin, .masonry-item{
  width:100% !important;
  margin:0 !important;
  display:block !important;
  break-inside:auto !important;
}
