/* ===== 朋友圈素材库 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f2f2f2;
  color: #1a1a1a;
  font-size: 16px;
}
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; font-size: 15px; }

/* ---- 顶栏 ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #fff; border-bottom: 1px solid #e6e6e6;
}
.topbar-inner {
  max-width: 680px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand {
  font-size: 17px; font-weight: 600; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #07c160; display: inline-block;
}
.admin-badge {
  font-size: 11px; font-weight: 500; color: #07c160;
  border: 1px solid #07c160; border-radius: 4px; padding: 1px 5px;
}
.user-chip { font-size: 14px; color: #333; white-space: nowrap; }
.user-chip em {
  font-style: normal; font-size: 11px; color: #07c160;
  border: 1px solid #07c160; border-radius: 4px; padding: 0 4px; margin-left: 2px;
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-tabs button {
  flex: 1; padding: 8px 0; font-size: 15px; color: #999;
  background: none; border: none; border-bottom: 2px solid #eee;
}
.auth-tabs button.active { color: #07c160; border-bottom-color: #07c160; font-weight: 600; }
.search {
  flex: 1; min-width: 0; padding: 7px 12px;
  border: 1px solid #e0e0e0; border-radius: 16px;
  background: #f7f7f7; outline: none;
}
.search:focus { border-color: #07c160; background: #fff; }
.topbar-actions { display: flex; gap: 8px; white-space: nowrap; }

.tags-row {
  max-width: 680px; margin: 0 auto; padding: 0 16px 10px;
  display: flex; gap: 8px; overflow-x: auto;
}
.tags-row:empty { display: none; }
.tag-chip {
  flex: none; padding: 4px 12px; font-size: 13px;
  border: 1px solid #e0e0e0; border-radius: 14px;
  background: #fff; color: #666;
}
.tag-chip.active { background: #07c160; border-color: #07c160; color: #fff; }

/* ---- 按钮 ---- */
.btn {
  padding: 7px 14px; font-size: 14px;
  border: 1px solid #e0e0e0; border-radius: 6px;
  background: #fff; color: #333;
}
.btn:hover { background: #f5f5f5; }
.btn-primary { background: #07c160; border-color: #07c160; color: #fff; }
.btn-primary:hover { background: #06ad56; }
.btn-ghost { border-color: transparent; color: #999; background: transparent; }

/* ---- 时间线 ---- */
.feed-wrap { max-width: 680px; margin: 14px auto 40px; }
.feed {
  background: #fff; border-radius: 8px; overflow: hidden;
  border: 1px solid #e8e8e8;
}
.day-divider {
  padding: 10px 16px 6px; font-size: 13px; color: #999;
  background: #fafafa; border-bottom: 1px solid #f0f0f0;
}
.post {
  display: flex; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid #ebebeb;
}
.post:last-child { border-bottom: none; }
.avatar {
  flex: none; width: 42px; height: 42px; border-radius: 5px;
  color: #fff; font-size: 18px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 8px; }
.author { color: #576b95; font-weight: 600; font-size: 15px; }
.tag {
  font-size: 11px; color: #576b95; background: #eef2f9;
  border-radius: 3px; padding: 1px 6px;
}
.content {
  margin-top: 4px; font-size: 16px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
.content.clamped {
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical;
  overflow: hidden;
}
.expand-toggle {
  color: #576b95; font-size: 14px; background: none; border: none;
  padding: 2px 0; display: inline-block;
}

/* ---- 图片九宫格 ---- */
.grid { display: grid; gap: 4px; margin-top: 8px; }
.grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 4px; cursor: zoom-in; background: #f0f0f0;
}
.grid.n1 { max-width: 240px; }
.grid.n1 img { aspect-ratio: auto; max-height: 300px; }
.grid.n2, .grid.n4 { grid-template-columns: repeat(2, 1fr); max-width: 320px; }
.grid.n3, .grid.n5, .grid.n6, .grid.n7, .grid.n8, .grid.n9 {
  grid-template-columns: repeat(3, 1fr); max-width: 360px;
}

/* ---- 元信息 & 操作 ---- */
.meta {
  margin-top: 8px; display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #999;
}
.meta .admin-actions { margin-left: auto; display: flex; gap: 4px; }
.meta .admin-actions button {
  background: none; border: none; font-size: 13px; color: #576b95; padding: 2px 4px;
}
.meta .admin-actions button.danger { color: #d64545; }
.actions { margin-top: 8px; display: flex; gap: 8px; }
.actions button {
  flex: none; padding: 6px 14px; font-size: 13px;
  border: none; border-radius: 5px; background: #f7f7f7; color: #576b95;
}
.actions button:hover { background: #efefef; }
.actions button.copied { background: #e6f7ec; color: #07c160; }

/* ---- 空状态 / 加载 ---- */
.empty { text-align: center; color: #999; padding: 60px 0; }
.empty-icon { font-size: 40px; margin-bottom: 10px; }
.load-more-wrap { text-align: center; padding: 16px 0; }
.feed-end { color: #bbb; font-size: 13px; padding: 8px 0; }

/* ---- 图片预览 ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .88);
  display: flex; align-items: center; justify-content: center;
}
.lightbox img { max-width: 88vw; max-height: 82vh; border-radius: 4px; }
.lb-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: none; color: #fff; font-size: 34px; line-height: 1;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255, 255, 255, .12); border: none; color: #fff;
  font-size: 30px; width: 48px; height: 64px; border-radius: 6px;
}
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-bar {
  position: absolute; bottom: 22px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  color: #ddd; font-size: 14px;
}
.lb-download { background: #07c160; border-color: #07c160; color: #fff; text-decoration: none; }

/* ---- 弹窗 ---- */
.modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px; overflow-y: auto;
}
.modal-card {
  background: #fff; border-radius: 10px; padding: 20px;
  width: 100%; max-width: 420px;
}
.modal-card.modal-lg { max-width: 560px; }
.modal-card h3 { font-size: 17px; margin-bottom: 12px; }
.modal-tip { font-size: 13px; color: #999; margin-bottom: 12px; }
.modal-card input[type="password"],
.modal-card input[type="text"],
.modal-card input[type="datetime-local"] {
  width: 100%; padding: 8px 10px; margin-bottom: 10px;
  border: 1px solid #e0e0e0; border-radius: 6px; outline: none;
}
.modal-card textarea {
  width: 100%; padding: 10px; margin-bottom: 10px; resize: vertical;
  border: 1px solid #e0e0e0; border-radius: 6px; outline: none;
  line-height: 1.5;
}
.modal-card input:focus, .modal-card textarea:focus { border-color: #07c160; }
.form-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.form-row label { font-size: 14px; color: #666; flex: none; }
.form-row input[type="text"] { flex: 1; min-width: 100px; margin-bottom: 0 !important; }
.form-row input[type="datetime-local"] { width: auto !important; margin-bottom: 0 !important; }
.form-hint { font-size: 12px; color: #aaa; }
.form-err { color: #d64545; font-size: 13px; margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---- 图片选择 ---- */
.form-imgs { align-items: flex-start; }
.img-picker {
  flex: none; width: 84px; height: 84px; border: 1px dashed #ccc; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: #999; font-size: 13px; cursor: pointer;
}
.img-picker em { font-style: normal; font-size: 12px; color: #bbb; }
.img-picker:hover { border-color: #07c160; color: #07c160; }
.img-preview { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.img-preview .thumb {
  position: relative; width: 84px; height: 84px; border-radius: 6px; overflow: hidden;
}
.img-preview .thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-preview .thumb button {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
  border: none; border-radius: 50%; background: rgba(0, 0, 0, .55);
  color: #fff; font-size: 12px; line-height: 20px; padding: 0;
}

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  z-index: 200; background: rgba(0, 0, 0, .75); color: #fff;
  padding: 10px 20px; border-radius: 8px; font-size: 14px;
}

@media (max-width: 640px) {
  .feed-wrap { margin: 0 0 40px; }
  .feed { border-radius: 0; border-left: none; border-right: none; }
  .brand { font-size: 15px; }
  .grid.n2, .grid.n4 { max-width: 240px; }
  .grid.n3, .grid.n5, .grid.n6, .grid.n7, .grid.n8, .grid.n9 { max-width: 280px; }
}
