/* ═══════════════════════════════════════════
   UPUC 全站样式 (纯 CSS3, 无框架依赖)
   ═══════════════════════════════════════════ */

:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-hover: #e2e8f0;
  --text: #0f172a;
  --text-soft: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --brand-1: #3b82f6;
  --brand-2: #7c3aed;
  --brand-grad: linear-gradient(135deg, #3b82f6, #7c3aed);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, .12);
  --radius: 12px;
}
[data-theme="dark"] {
  --bg: #0b1120;
  --bg-card: #111a2e;
  --bg-muted: #1a2438;
  --bg-hover: #223050;
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #26334d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, .45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.65; font-size: 15px;
  transition: background .25s, color .25s;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; }
.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex-shrink: 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: inline-block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ═══ 顶部导航 ═══ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg-card) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; box-shadow: 0 4px 10px rgba(99, 102, 241, .35);
}
.logo-text { font-size: 20px; font-weight: 800; letter-spacing: .5px;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search-box {
  flex: 1; max-width: 480px; display: flex; align-items: center; gap: 8px;
  background: var(--bg-muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 16px; transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within { border-color: var(--brand-1); box-shadow: 0 0 0 3px rgba(59, 130, 246, .15); }
.search-icon { color: var(--text-muted); }
.search-box input {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: var(--text); font-size: 14px; min-width: 0;
}
.search-box input::placeholder { color: var(--text-muted); }
.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-muted);
  color: var(--text-soft); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; font-size: 16px;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }

/* ═══ 分类导航栏 ═══ */
.cat-nav {
  position: sticky; top: 64px; z-index: 90;
  background: color-mix(in srgb, var(--bg-card) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav-inner { display: flex; gap: 8px; padding: 10px 16px; width: max-content; margin: 0 auto; }
.cat-tab {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  color: var(--text-soft); border: 1px solid var(--border); background: var(--bg-muted);
  transition: all .2s; cursor: pointer;
}
.cat-tab:hover { background: var(--bg-hover); color: var(--text); }
.cat-tab.active { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: 0 3px 8px rgba(99, 102, 241, .3); }
.cat-tab .icon { width: 1em; height: 1em; }
.cat-icon .icon { width: 20px; height: 20px; }
svg.chev { width: 1em; height: 1em; flex-shrink: 0; }

/* ═══ 分类区块 ═══ */
.cat-section { padding: 34px 0 6px; scroll-margin-top: 128px; }
.cat-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.cat-heading .cat-icon-box {
  width: 40px; height: 40px; border-radius: 10px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.cat-heading h2 { font-size: 20px; font-weight: 700; }
.cat-heading .cat-count { font-size: 13px; color: var(--text-muted); font-weight: 400; margin-left: 2px; }
.cat-heading .cat-line { flex: 1; height: 1px; background: var(--border); }

/* ═══ 卡片网格 ═══ */
.card-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.site-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative; box-shadow: var(--shadow-sm);
}
.site-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--cat-color, #3b82f6) 45%, var(--border));
}
.card-top { display: flex; align-items: center; gap: 10px; }
.card-avatar {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #fff;
  background: var(--cat-color, var(--brand-grad));
  box-shadow: 0 3px 8px color-mix(in srgb, var(--cat-color, #6366f1) 35%, transparent);
}
.card-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-name .ext { color: var(--text-muted); opacity: 0; transition: opacity .2s; width: .95em; height: .95em; }
.site-card:hover .ext { opacity: 1; }
.card-desc {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 38px;
}
.card-link { position: absolute; inset: 0; border-radius: var(--radius); }
.card-link:focus-visible { outline: 2px solid var(--brand-1); }
.search-hide { display: none !important; }

/* ═══ 面包屑 ═══ */
.breadcrumb {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-muted); padding: 16px 0 4px;
}
.breadcrumb a:hover { color: var(--brand-1); }
.breadcrumb .sep { opacity: .5; }
.breadcrumb .current { color: var(--text-soft); }

/* ═══ 详情页 ═══ */
.detail-main { padding: 10px 0 40px; }
.detail-hero {
  display: flex; align-items: center; gap: 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px; margin: 12px 0 22px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.detail-hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cat-color, #3b82f6) 8%, transparent), transparent 55%);
  pointer-events: none;
}
.detail-avatar {
  width: 76px; height: 76px; border-radius: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; color: #fff;
  background: var(--cat-color, var(--brand-grad));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--cat-color, #6366f1) 40%, transparent);
  position: relative;
}
.detail-title-box { min-width: 0; position: relative; }
.detail-title { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: #fff;
  background: var(--cat-color, var(--brand-grad));
  padding: 3px 10px; border-radius: 999px; vertical-align: middle;
}
.detail-desc { color: var(--text-soft); margin-top: 6px; font-size: 14.5px; }
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.detail-content { min-width: 0; }
.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.panel-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; margin-bottom: 12px;
}
.panel-title .icon { color: var(--cat-color, var(--brand-1)); }
.panel p { color: var(--text-soft); font-size: 14.5px; text-align: justify; }
.review-panel { border-left: 3px solid var(--cat-color, var(--brand-1)); }
.review-panel p { color: var(--text-soft); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 12.5px; padding: 4px 12px; border-radius: 999px;
  background: var(--bg-muted); color: var(--text-soft);
  border: 1px solid var(--border); transition: all .2s;
}
.tag:hover { background: var(--bg-hover); color: var(--text); }

/* FAQ */
.faq-list details { border-bottom: 1px solid var(--border); }
.faq-list details:last-child { border-bottom: 0; }
.faq-list summary {
  cursor: pointer; list-style: none; padding: 12px 0;
  font-size: 14.5px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+"; font-size: 17px; color: var(--text-muted);
  transition: transform .2s; flex-shrink: 0;
}
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list .faq-a { color: var(--text-muted); font-size: 13.5px; padding: 0 0 12px; }

/* URL 卡片 + 侧栏 */
.side-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm); position: sticky; top: 132px;
}
.side-card .url-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-muted); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 12px;
}
.side-card .url-text {
  font-size: 12.5px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left;
}
.go-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: #fff;
  background: var(--brand-grad); border-radius: 8px; padding: 9px 14px;
  transition: opacity .2s, transform .2s; width: 100%;
}
.go-btn:hover { opacity: .9; transform: translateY(-1px); }
.side-card .side-label {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px; margin-bottom: 12px;
}
.side-card .side-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }
.side-list { display: flex; flex-direction: column; gap: 8px; }
.side-item {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  background: var(--bg-muted); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 10px; transition: border-color .2s, transform .2s, background .2s;
}
.side-item:hover { border-color: #8b5cf6; transform: translateX(2px); }
.side-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700;
}
.side-info { min-width: 0; flex: 1; }
.side-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-desc { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.side-url {
  font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.side-list li { margin-bottom: 2px; }
.side-list a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: 8px; transition: background .2s;
}
.side-list a:hover { background: var(--bg-muted); }
.side-list .mini-avatar {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--mini-color, #6366f1);
}
.side-list .side-name { font-size: 13.5px; font-weight: 500; }
.side-list .side-desc { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 推广模块 */
.promo-panel {
  border: 1px solid color-mix(in srgb, var(--brand-1) 35%, var(--border));
  background: linear-gradient(135deg, rgba(59, 130, 246, .07), rgba(124, 58, 237, .07));
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.promo-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.promo-head .promo-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: var(--brand-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.promo-head h2 { font-size: 15.5px; font-weight: 700; }
.promo-badge {
  font-size: 10.5px; font-weight: 600; color: #fff;
  background: var(--brand-grad); border-radius: 4px; padding: 1px 7px;
}
.promo-panel p { font-size: 14px; color: var(--text-soft); }
.promo-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  font-size: 13.5px; font-weight: 600; color: #fff;
  background: var(--brand-grad); border-radius: 8px; padding: 9px 18px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, .3); transition: transform .2s, opacity .2s;
}
.promo-btn:hover { transform: translateY(-1px); opacity: .92; }

/* ═══ 页脚 ═══ */
.site-footer {
  background: var(--bg-card); border-top: 1px solid var(--border);
  margin-top: 30px; padding: 36px 0 0;
}
.footer-grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.3fr;
  gap: 30px; padding-bottom: 26px;
}
.footer-logo { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.footer-logo .logo-mark { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }
.footer-desc { font-size: 13px; color: var(--text-muted); line-height: 1.7; }
.footer-col h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 12px; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { font-size: 13px; color: var(--text-muted); transition: color .2s; }
.footer-col a:hover { color: var(--brand-1); }
.friend-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.footer-bottom {
  border-top: 1px solid var(--border); padding: 16px 0;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  font-size: 12.5px; color: var(--text-muted); text-align: center;
}
.footer-bottom a:hover { color: var(--brand-1); }

/* 回到顶部 */
.back-top {
  position: fixed; right: 22px; bottom: 26px; z-index: 99;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brand-grad); color: #fff; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md); opacity: 0; visibility: hidden;
  transform: translateY(12px); transition: all .25s;
}
.back-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { opacity: .9; }

/* 搜索无结果 */
.no-result {
  display: none; text-align: center; padding: 50px 0; color: var(--text-muted);
}
.no-result.show { display: block; }

/* ═══ 响应式 ═══ */
@media (max-width: 1100px) { .card-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .header-inner { height: 58px; gap: 10px; }
  .logo-text { display: none; }
  .cat-nav { top: 58px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .detail-hero { flex-direction: column; align-items: flex-start; gap: 14px; padding: 20px; }
  .detail-title { font-size: 20px; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .search-box input::placeholder { font-size: 13px; }
}
@media (max-width: 400px) { .card-grid { grid-template-columns: 1fr; } }
