/* 收藏夹 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
  background: #f7f5f2;
  color: #2b2b2b;
}
.hidden { display: none !important; }

#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #e8e2da;
  position: sticky; top: 0; z-index: 10;
}
#topbar h1 { font-size: 18px; font-weight: 600; }
#account { display: flex; align-items: center; gap: 10px; font-size: 14px; }
button.link {
  background: none; border: none; color: #8a6d3b; cursor: pointer;
  font-size: 13px; padding: 2px 4px;
}
button.link:hover { text-decoration: underline; }

main { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* 登录 */
#login-view { display: flex; justify-content: center; padding-top: 80px; }
.card-form {
  display: flex; flex-direction: column; gap: 10px;
  background: #fff; padding: 28px; border-radius: 12px;
  border: 1px solid #e8e2da; width: 300px;
}
.card-form input {
  padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px;
}
.card-form button {
  padding: 10px; border: none; border-radius: 8px; font-size: 15px;
  background: #8a6d3b; color: #fff; cursor: pointer;
}
.error { color: #c0392b; font-size: 13px; }

/* 提交框 */
#add-form { display: flex; gap: 10px; margin-bottom: 6px; align-items: center; }
#add-input {
  flex: 1; padding: 12px 14px; font-size: 15px;
  border: 1px solid #ddd; border-radius: 10px; background: #fff;
}
#private-label {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; color: #8a6d3b; cursor: pointer; white-space: nowrap;
  user-select: none;
}
#add-btn {
  padding: 12px 22px; border: none; border-radius: 10px; font-size: 15px;
  background: #8a6d3b; color: #fff; cursor: pointer;
}
#add-btn:disabled { opacity: .5; cursor: wait; }
.hint { font-size: 13px; color: #999; margin-bottom: 18px; min-height: 18px; }

/* 上传者筛选 */
#filter-bar, #cat-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
#filter-bar { margin-bottom: 18px; }
#filter-bar:empty, #cat-filter-bar:empty { display: none; }
.f-chip {
  padding: 4px 14px; font-size: 13px; cursor: pointer;
  background: #fff; color: #777; border: 1px solid #e0d9cf; border-radius: 16px;
}
.f-chip:hover { border-color: #8a6d3b; color: #8a6d3b; }
.f-chip.on { background: #8a6d3b; border-color: #8a6d3b; color: #fff; }

/* 书架 */
.shelf { margin-bottom: 28px; }
.shelf h2 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.shelf h2 .count { color: #bbb; font-weight: 400; font-size: 13px; margin-left: 4px; }
.shelf-row {
  display: flex; flex-wrap: wrap; gap: 14px;
  padding-bottom: 10px;
}
.shelf-board {
  height: 8px; border-radius: 0 0 6px 6px;
  background: linear-gradient(#d9cbb8, #c4b199);
  box-shadow: 0 3px 6px rgba(0,0,0,.08);
}
.empty { color: #c0b8ac; font-size: 13px; padding: 30px 0; }

/* 封面卡片 */
.card {
  position: relative; width: 150px; aspect-ratio: 3 / 4;
  border-radius: 8px; overflow: hidden; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: transform .15s ease, box-shadow .15s ease;
  background: #ddd;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 18px rgba(0,0,0,.22); }
.cover, .cover img, .placeholder { width: 100%; height: 100%; }
.cover img { object-fit: cover; display: block; }

.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 12px; text-align: center; color: #fff;
}
.ph-emoji { font-size: 40px; }
.ph-title { font-size: 14px; font-weight: 600; line-height: 1.4; }
.cat-travel { background: linear-gradient(160deg, #4a90c2, #2c5f8a); }
.cat-food   { background: linear-gradient(160deg, #d4694a, #a03d28); }
.cat-ai     { background: linear-gradient(160deg, #6a5acd, #3d3390); }
.cat-movie  { background: linear-gradient(160deg, #444, #111); }
.cat-video  { background: linear-gradient(160deg, #fb7299, #c94f73); }
.cat-book   { background: linear-gradient(160deg, #9c6b3f, #6b4525); }
.cat-fun    { background: linear-gradient(160deg, #3fae7a, #20704b); }

/* 底部标题蒙层 */
.card-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.78));
  color: #fff;
}
.card-title { font-size: 13px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.chip {
  display: inline-block; font-size: 11px; padding: 1px 8px;
  background: rgba(255,255,255,.25); color: #fff; border-radius: 10px;
}
.stat {
  display: inline-block; font-size: 11px; padding: 1px 7px; margin-left: 4px;
  background: rgba(0,0,0,.45); color: #ffd97a; border-radius: 10px;
}
.card-lock {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  font-size: 13px; background: rgba(0,0,0,.55); border: none; border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.card-lock.only-hover { display: none; }
.card:hover .card-lock.only-hover { display: flex; }

.card-del {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 24px; height: 24px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 12px;
  display: none;
}
.card:hover .card-del { display: block; }

/* 弹层 */
#modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
#modal-box {
  position: relative; background: #fff; border-radius: 12px;
  max-width: 420px; width: calc(100% - 40px); padding: 24px;
  max-height: 85dvh; overflow-y: auto;
}
#modal-box h3 { margin-bottom: 10px; }
#modal-box p { margin-bottom: 10px; font-size: 14px; line-height: 1.6; }
#modal-box .chip { background: #eee; color: #555; }
#modal-box a { color: #8a6d3b; }
#modal-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; font-size: 16px; cursor: pointer; color: #999;
}
.h-meta { font-size: 12px; color: #999; }
#modal-box hr { border: none; border-top: 1px solid #eee; margin: 12px 0; }
/* 详情弹层里的高清图 */
.m-cover {
  display: block; width: 100%; max-height: 320px; object-fit: cover;
  border-radius: 8px; margin-bottom: 10px; background: #f0ece6;
}

/* 打分 */
.rating-row { display: flex; align-items: center; gap: 2px; margin-bottom: 12px; }
.star {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: #ddd; padding: 0 2px; line-height: 1;
}
.star.on { color: #f0b429; }
.rating-agg { font-size: 12px; color: #999; margin-left: 8px; }

/* 修改分类 */
.edit-cat { display: flex; gap: 6px; margin-bottom: 10px; }
.edit-cat select {
  padding: 6px 8px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 13px; background: #fff;
}
.edit-cat input {
  flex: 1; min-width: 0; padding: 6px 8px;
  border: 1px solid #ddd; border-radius: 8px; font-size: 13px;
}
.edit-cat button {
  padding: 6px 12px; border: none; border-radius: 8px;
  background: #8a6d3b; color: #fff; cursor: pointer; font-size: 13px; white-space: nowrap;
}

/* 上传封面图 */
.edit-img { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.edit-img button {
  padding: 6px 12px; border: none; border-radius: 8px;
  background: #8a6d3b; color: #fff; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.edit-img button:disabled { opacity: .5; cursor: wait; }
.edit-img button.link { background: none; color: #8a6d3b; padding: 2px 4px; }
.edit-img button.link.danger { color: #c0392b; }
.edit-img button.link:hover { text-decoration: underline; }
.m-custom-img {
  width: 54px; height: 72px; object-fit: cover;
  border-radius: 6px; border: 1px solid #e0d9cf;
}

/* 评论 */
.comments { max-height: 220px; overflow-y: auto; margin-bottom: 10px; }
.comment {
  position: relative; padding: 8px 10px; margin-bottom: 6px;
  background: #f7f5f2; border-radius: 8px;
}
.comment .c-who { font-size: 12px; font-weight: 600; color: #8a6d3b; }
.comment .c-time { font-size: 11px; color: #bbb; margin-left: 6px; }
.comment p { font-size: 13px; margin: 3px 0 0 !important; }
.c-del {
  position: absolute; top: 6px; right: 8px;
  background: none; border: none; color: #ccc; cursor: pointer; font-size: 12px;
}
.c-del:hover { color: #c0392b; }
#comment-form { display: flex; gap: 8px; }
#comment-input {
  flex: 1; padding: 8px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px;
}
#comment-form button {
  padding: 8px 14px; border: none; border-radius: 8px;
  background: #8a6d3b; color: #fff; cursor: pointer; font-size: 13px;
}

@media (max-width: 600px) {
  .card { width: calc(33.3% - 10px); }
  .ph-emoji { font-size: 28px; }
  .ph-title { font-size: 11px; }
  /* 触屏没有 hover，按钮常显 */
  .card-del, .card-lock.only-hover { display: flex; }
}
