:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #33415c;
  --muted: #8a94a6;
  --accent: #5b7c99;
  --border: #e2e8f0;
  --purple-grad: linear-gradient(180deg, #7fb5d6, #9ec8c8);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #e6edf5 0%, #eef3f8 35%, #f2f6f9 70%, #eef4f4 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }

/* 背景气泡装饰 */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  background: #dce6f0;
  z-index: 0;
  pointer-events: none;
}
body::before { width: 180px; height: 180px; top: 60px; right: -40px; opacity: .5; }
body::after { width: 120px; height: 120px; bottom: 40px; left: -30px; opacity: .4; }

/* 顶栏 */
.topbar {
  background: var(--card);
  border-bottom: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #7fb5d6, #9ec8c8);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 1px;
  white-space: nowrap;
}
.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #dce6f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  padding: 5px 5px 5px 18px;
  max-width: 760px;
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text);
  background: transparent;
}
.search-box input::placeholder { color: #9aa8bd; }
.search-box input.voice-recording { color: #d85a30; }
.search-btn {
  border: none;
  background: #7fb5d6;
  color: #ffffff;
  border-radius: 999px;
  padding: 6px 18px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.search-btn:hover { background: #6ba8cc; }

.topnav { display: flex; gap: 14px; margin-left: auto; white-space: nowrap; font-size: 13px; color: #7a8aa0; }
.topnav a { color: #7a8aa0; }
.topnav a:hover { color: var(--accent); }
.nav-user { color: var(--text); }

/* 主体 */
.container { max-width: 1320px; margin: 0 auto; padding: 20px; position: relative; z-index: 1; display: flex; gap: 24px; align-items: flex-start; }

/* 左侧分类快捷导航 */
.side-nav { width: 140px; flex-shrink: 0; position: sticky; top: 76px; }
.side-nav-inner {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.side-link {
  display: block;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text);
  border-radius: 8px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.side-link:hover { background: #eef3f8; color: var(--accent); }
.side-link.active { background: #dce6f0; color: var(--accent); font-weight: 500; }

/* 回到顶部按钮 */
.back-top {
  display: block;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--accent);
  background: #eef3f8;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  margin-top: 14px;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
}
.back-top:hover { background: #dce6f0; }

.content { flex: 1; min-width: 0; }

/* 快速收藏引导卡片 */
.collect-guide {
  position: relative;
  background: linear-gradient(135deg, #eef6ff, #f0faf5);
  border: 0.5px solid #dbe7f2;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 22px;
}
.collect-guide-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: #9aa8bd;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}
.collect-guide-close:hover { background: #e3ecf5; color: #33415c; }
.collect-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 13px; }
.collect-title { font-size: 16px; font-weight: 600; color: #33415c; }
.collect-sub { font-size: 12px; color: #7a8aa0; flex: 1; min-width: 140px; }
.collect-btn {
  background: #378add; color: #fff; padding: 7px 16px; border-radius: 999px;
  font-size: 13px; white-space: nowrap;
}
.collect-btn:hover { background: #2f74bd; }
.collect-items { display: flex; gap: 18px; }
.collect-item { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: flex-start; }
.ci-icon { font-size: 20px; line-height: 1.5; }
.ci-body b { font-size: 13px; color: #33415c; display: block; margin-bottom: 3px; }
.ci-body p { font-size: 12px; color: #7a8aa0; line-height: 1.7; margin: 0; }
.ci-body a { color: #378add; }
.ci-body code { background: #eef3f8; padding: 1px 5px; border-radius: 4px; font-size: 11px; word-break: break-all; }
@media (max-width: 768px) {
  .collect-items { flex-direction: column; gap: 12px; }
}

html { scroll-behavior: smooth; }

.category { margin-bottom: 22px; }
.cat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 500;
  color: #33415c;
  margin-bottom: 12px;
}
.cat-title::before {
  content: "";
  width: 6px;
  height: 24px;
  border-radius: 3px;
  background: var(--purple-grad);
  flex-shrink: 0;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  list-style: none;
}
.link-item {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  text-align: center;
  transition: border-color .15s, transform .15s;
}
.link-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.link-title { display: block; font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-item:hover .link-title { color: var(--accent); }
.link-note-tag {
  display: inline-block; margin-top: 4px; font-size: 11px; color: #1d9e75;
  background: #e1f5ee; border-radius: 10px; padding: 1px 7px; cursor: pointer; user-select: none;
}
.link-note-tag:hover { background: #9fe1cb; }

/* 我的收藏区 */
.my-section { margin-bottom: 22px; }
.my-cat-name { font-size: 13px; font-weight: 500; color: #7a8aa0; margin: 10px 0 8px; padding-left: 16px; }

/* 搜索结果面板 */
.result-panel {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 640px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(91, 124, 153, .18);
  padding: 16px;
  z-index: 100;
}

/* 结果面板内的「关闭」按钮（右上角） */
.result-close {
  position: absolute;
  top: 10px;
  right: 12px;
  height: 28px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  color: #9aa8bd;
  border: 0.5px solid var(--border);
}
.result-close:hover { color: #d85a30; border-color: #d85a30; }

.footer { text-align: center; color: var(--muted); padding: 24px; font-size: 12px; position: relative; z-index: 1; }

/* 搜索结果卡片 */
.result-item { background: var(--card); border: 0.5px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.result-item .link-title { font-size: 14px; }
.result-item .link-desc { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.ai-reason { font-size: 12px; color: #1d9e75; margin-top: 4px; }
.ai-actions { margin-top: 8px; }
.btn-adopt, .btn-dismiss, .btn-open {
  height: 28px; padding: 0 14px; border-radius: 14px; font-size: 12px; cursor: pointer; border: 0.5px solid var(--border); background: var(--card); color: var(--text); margin-right: 8px;
}
.btn-adopt { background: #1d9e75; border-color: #1d9e75; color: #fff; }
.btn-adopt.done { background: #97c459; border-color: #97c459; }
.btn-open { color: var(--accent); border-color: var(--accent); }
.btn-dismiss:hover { border-color: #d85a30; color: #d85a30; }

/* 换一批按钮（右下角） */
.ai-more { text-align: right; margin-top: 4px; }
.btn-next-batch, .btn-prev-batch {
  height: 32px; padding: 0 18px; border-radius: 16px; font-size: 13px; cursor: pointer;
  background: #fff;
}
.btn-next-batch { color: #d85a30; border: 0.5px solid #d85a30; }
.btn-next-batch:hover { background: #fdf0ea; }
.btn-prev-batch { color: #378add; border: 0.5px solid #378add; margin-right: 10px; }
.btn-prev-batch:hover { background: #eef6ff; }

/* 响应式：平板（自适应，略增间距） */
@media (max-width: 1024px) {
  .link-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .side-nav { width: 120px; }
}
/* 响应式：手机（固定 2 列，隐藏侧边导航） */
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .brand { font-size: 17px; }
  .search-box { order: 3; flex-basis: 100%; max-width: none; }
  .link-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .link-item { padding: 9px 8px; }
  .link-title { font-size: 13px; }
  .side-nav { display: none; }
  .container { display: block; }
}
