/* ==========================================================================
   轻导航 · 样式表
   浅紫渐变 + 白色圆角卡片 + pill 标签（参考股市看板风格）
   ========================================================================== */

:root {
  --fs-root: 16px;

  --bg: #f3f1fa;
  --panel: #ffffff;
  --panel-sub: #faf9ff;
  --panel-sink: #f5f3fc;
  --border: rgba(26, 20, 60, 0.075);
  --border-strong: rgba(26, 20, 60, 0.14);

  --text: #17152b;
  --text-2: #5f5c78;
  --text-3: #9793ad;

  --brand: #6c5cf7;
  --brand-2: #9285ff;
  --brand-soft: #efeaff;
  --brand-line: #ded5ff;
  --brand-ink: #4b3ddb;

  --ok: #15a34a;
  --warn: #e08b00;
  --danger: #e5484d;

  --r-xl: 1.4rem;
  --r-lg: 1.1rem;
  --r-md: 0.85rem;
  --r-sm: 0.6rem;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(23, 21, 43, 0.05);
  --shadow-sm: 0 1px 2px rgba(23, 21, 43, 0.04), 0 6px 16px -10px rgba(23, 21, 43, 0.18);
  --shadow: 0 2px 4px rgba(23, 21, 43, 0.03), 0 14px 32px -16px rgba(23, 21, 43, 0.22);
  --shadow-lg: 0 30px 70px -24px rgba(23, 21, 43, 0.32);

  --thumb-h: 8.4rem;
  --grid-min: 15.5rem;

  /* 真实网站图标：浅色底板 + 外围柔底，保证深色 / 白色 logo 都看得清 */
  --icon-plate: linear-gradient(155deg, #ffffff 0%, #f6f5fc 100%);
  --icon-plate-edge: rgba(23, 21, 43, 0.1);
  --icon-plate-bg: #f4f1ff;
}

html[data-fs="s"] { --fs-root: 14.5px; }
html[data-fs="m"] { --fs-root: 16px; }
html[data-fs="l"] { --fs-root: 17.5px; }
html[data-fs="xl"] { --fs-root: 19.5px; }

html[data-theme="dark"] {
  --bg: #0e0d18;
  --panel: #181727;
  --panel-sub: #1d1c2e;
  --panel-sink: #14131f;
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f1f0f8;
  --text-2: #a9a6c0;
  --text-3: #7c7996;

  --brand: #8b7bff;
  --brand-2: #a99cff;
  --brand-soft: #262148;
  --brand-line: #3a3363;
  --brand-ink: #c3b8ff;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 16px -10px rgba(0, 0, 0, 0.7);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 14px 32px -16px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, 0.9);

  --icon-plate: linear-gradient(155deg, #f4f3fa 0%, #e6e4f0 100%);
  --icon-plate-edge: rgba(0, 0, 0, 0.22);
  --icon-plate-bg: #201d33;
}

* { box-sizing: border-box; }

html { font-size: var(--fs-root); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(62rem 30rem at 6% -8%, #e6dfff 0%, transparent 62%),
    radial-gradient(52rem 28rem at 92% -12%, #ffe5f1 0%, transparent 62%),
    radial-gradient(48rem 26rem at 50% 106%, #dff0ff 0%, transparent 60%);
}
html[data-theme="dark"] body::before {
  background:
    radial-gradient(62rem 30rem at 6% -8%, #241f4d 0%, transparent 62%),
    radial-gradient(52rem 28rem at 92% -12%, #3a1f3e 0%, transparent 62%),
    radial-gradient(48rem 26rem at 50% 106%, #14293d 0%, transparent 60%);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 0.6rem; height: 0.6rem; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

.ic { width: 1.05em; height: 1.05em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic.fill { fill: currentColor; stroke: none; }

/* ==========================================================================
   布局骨架
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  min-height: 100vh;
  align-items: start;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.1rem 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.35rem; }
.brand-mark {
  width: 2.4rem; height: 2.4rem; flex: none;
  display: grid; place-items: center;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, var(--brand), #b98bff);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(108, 92, 247, 0.9);
}
.brand-mark .ic { width: 1.3rem; height: 1.3rem; stroke-width: 1.9; }
.brand-text strong { display: block; font-size: 1rem; letter-spacing: 0.01em; }
.brand-text span { display: block; font-size: 0.66rem; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }

.side-search {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.5rem 0.7rem;
  background: var(--panel-sink);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--text-3);
  transition: border-color 0.16s, background 0.16s;
}
.side-search:focus-within { border-color: var(--brand-line); background: var(--panel); }
.side-search input {
  border: 0; background: transparent; outline: none; width: 100%;
  font-size: 0.82rem; color: var(--text);
}
.side-search kbd {
  font-size: 0.62rem; padding: 0.1rem 0.32rem; border-radius: 0.3rem;
  border: 1px solid var(--border-strong); color: var(--text-3); background: var(--panel);
}

.nav-group { display: flex; flex-direction: column; gap: 0.15rem; }
.nav-label {
  font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); padding: 0.55rem 0.6rem 0.3rem;
}
.nav-item {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border: 0; background: transparent; width: 100%;
  border-radius: var(--r-md);
  font-size: 0.855rem; color: var(--text-2); text-align: left;
  cursor: pointer; transition: background 0.14s, color 0.14s;
}
.nav-item:hover { background: var(--panel-sink); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav-item.active .ic { stroke-width: 2; }
.nav-item .count {
  margin-left: auto; font-size: 0.68rem; color: var(--text-3);
  background: var(--panel-sink); border-radius: var(--r-pill);
  padding: 0.08rem 0.42rem; min-width: 1.5rem; text-align: center;
}
.nav-item.active .count { background: rgba(255, 255, 255, 0.7); color: var(--brand-ink); }
html[data-theme="dark"] .nav-item.active .count { background: rgba(255, 255, 255, 0.12); }

.nav-cats { overflow-y: auto; margin: 0 -0.2rem; padding: 0 0.2rem; flex: 1 1 auto; min-height: 0; }
.cat-dot { width: 0.5rem; height: 0.5rem; border-radius: 999px; flex: none; }

.side-foot { display: flex; gap: 0.4rem; padding-top: 0.5rem; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.38rem;
  padding: 0.46rem 0.8rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 0.8rem; color: var(--text-2);
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.16s, border-color 0.16s, color 0.16s, background 0.16s;
  white-space: nowrap;
}
.btn:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 10px 20px -12px rgba(108, 92, 247, 0.95);
}
.btn.primary:hover { color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-sink); }
.btn.icon { padding: 0.46rem; border-radius: 0.7rem; }
.btn.sm { padding: 0.3rem 0.6rem; font-size: 0.74rem; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 34%, transparent); }

/* ---------- 主区 ---------- */
.main { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; padding-right: 0.15rem; }

.topbar { display: flex; align-items: center; gap: 0.75rem; padding: 0.15rem 0.35rem 0; }
.topbar h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.topbar .sub { font-size: 0.76rem; color: var(--text-3); margin-top: 0.15rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.stamp {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; color: var(--text-3);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 0.34rem 0.7rem;
}
.stamp b { color: var(--brand-ink); font-weight: 600; }
.live-dot { width: 0.42rem; height: 0.42rem; border-radius: 999px; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.7rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.pills { display: inline-flex; gap: 0.3rem; padding: 0.22rem; background: var(--panel-sink); border-radius: var(--r-pill); }
.pill {
  border: 0; background: transparent; cursor: pointer;
  padding: 0.36rem 0.85rem; border-radius: var(--r-pill);
  font-size: 0.79rem; color: var(--text-2); transition: all 0.16s;
}
.pill:hover { color: var(--text); }
.pill.active { background: var(--panel); color: var(--brand-ink); font-weight: 600; box-shadow: var(--shadow-xs); }
html[data-theme="dark"] .pill.active { background: var(--brand-soft); }

.seg { display: inline-flex; gap: 0.15rem; padding: 0.2rem; background: var(--panel-sink); border-radius: 0.65rem; }
.seg button {
  border: 0; background: transparent; cursor: pointer; color: var(--text-3);
  padding: 0.3rem 0.5rem; border-radius: 0.5rem; display: grid; place-items: center;
}
.seg button.active { background: var(--panel); color: var(--brand-ink); box-shadow: var(--shadow-xs); }

.select {
  border: 1px solid var(--border); background: var(--panel);
  border-radius: var(--r-pill); padding: 0.4rem 0.75rem;
  font-size: 0.79rem; color: var(--text-2); cursor: pointer;
}
.select:hover { border-color: var(--border-strong); }
.spacer { flex: 1 1 auto; }

.chips { display: flex; gap: 0.45rem; overflow-x: auto; padding: 0.1rem 0.1rem 0.35rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.38rem 0.78rem; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--panel);
  font-size: 0.79rem; color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: all 0.16s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.chip.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 10px 18px -12px rgba(108, 92, 247, 1); }
.chip .n { font-size: 0.7rem; opacity: 0.72; }

/* ---------- 英雄条（顶部两块强调卡） ---------- */
.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 0.9rem; }
.hero-card {
  position: relative; overflow: hidden;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.hero-card::after {
  content: ""; position: absolute; right: -3rem; top: -3.5rem;
  width: 8rem; height: 8rem; border-radius: 999px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 13%, transparent), transparent 70%);
  pointer-events: none;
}

/* 快捷入口 */
.hero-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.hero-title { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.84rem; font-weight: 600; }
.hero-title .ic { color: var(--brand-ink); }
.hero-sub { font-size: 0.7rem; color: var(--text-3); }
.hero-head .btn { margin-left: auto; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.4rem, 1fr)); gap: 0.4rem; }
.quick {
  display: flex; align-items: center; gap: 0.42rem;
  padding: 0.36rem 0.5rem; text-align: left; cursor: pointer;
  background: var(--panel-sub); border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: transform 0.14s, border-color 0.16s, background 0.16s;
}
.quick:hover { transform: translateY(-1px); border-color: var(--brand-line); background: var(--brand-soft); }
.quick .favicon {
  position: static; width: 1.35rem; height: 1.35rem; padding: 0.14rem;
  border-radius: 0.45rem; border: 1px solid var(--border); box-shadow: none;
}
.quick .nm { font-size: 0.78rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick .vt { margin-left: auto; flex: none; font-size: 0.65rem; color: var(--text-3); }

.cat-heat .row { display: flex; align-items: center; padding: 0.26rem 0; font-size: 0.79rem; color: var(--text-2); }
.cat-heat .row + .row { border-top: 1px dashed var(--border); }
.cat-heat .cn { white-space: nowrap; }
.cat-heat b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
/* ---------- 站点网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr));
  gap: 0.9rem;
}
.grid.list-view { grid-template-columns: 1fr; gap: 0.5rem; }

.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-line); }
.card.is-pinned::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; z-index: 3;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

.thumb { position: relative; height: var(--thumb-h); background: var(--panel-sink); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.3, 1); }
html[data-theme="dark"] .thumb img:not(.thumb-mark),
html[data-theme="dark"] .drawer-hero img:not(.thumb-mark) { filter: brightness(0.8) saturate(0.85); }
.card:hover .thumb img { transform: scale(1.045); }

/* 真实网站图标：加载成功后（.ok）淡入，盖住默认缩略图；失败会被前端摘掉 */
.thumb .thumb-mark,
.drawer-hero .thumb-mark {
  position: absolute; inset: 0; margin: auto; z-index: 1;
  width: 4.9rem; height: 4.9rem; object-fit: contain;
  padding: 0.62rem;
  background: var(--icon-plate);
  border: 1px solid var(--icon-plate-edge);
  border-radius: 1.05rem;
  box-shadow: 0 0 0 999px var(--icon-plate-bg), 0 10px 24px -14px rgba(23, 21, 43, 0.4);
  opacity: 0; transform: scale(0.94);
  transition: opacity 0.32s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.thumb .thumb-mark.ok,
.drawer-hero .thumb-mark.ok { opacity: 1; transform: scale(1); }
.card:hover .thumb .thumb-mark { transform: scale(1.06); }
.drawer-hero .thumb-mark { width: 6.6rem; height: 6.6rem; padding: 0.85rem; border-radius: 1.4rem; }
.grid.list-view .thumb .thumb-mark { width: 3.9rem; height: 3.9rem; padding: 0.5rem; border-radius: 0.85rem; }

.favicon {
  position: absolute; left: 0.55rem; bottom: 0.55rem;
  width: 1.85rem; height: 1.85rem; padding: 0.22rem;
  border-radius: 0.6rem; background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.4);
  display: grid; place-items: center; overflow: hidden;
}
html[data-theme="dark"] .favicon { background: rgba(24, 23, 39, 0.92); }
.favicon img { width: 100%; height: 100%; object-fit: contain; border-radius: 0.34rem; }

.badge {
  position: absolute; right: 0.5rem; top: 0.5rem; z-index: 2;
  font-size: 0.64rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 0.16rem 0.44rem; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.92); color: var(--brand-ink);
  box-shadow: 0 3px 10px -4px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}
.badge.hot { background: linear-gradient(135deg, #ff7a59, #ff4d6d); color: #fff; }

.card-body { padding: 0.65rem 0.7rem 0.7rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1 1 auto; }
.card-title { display: flex; align-items: center; gap: 0.4rem; }
.card-title h4 { margin: 0; font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-desc { font-size: 0.76rem; color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.3em; }
.card-tags { display: flex; gap: 0.28rem; flex-wrap: wrap; }
.tag {
  font-size: 0.67rem; color: var(--text-3);
  background: var(--panel-sink); border-radius: var(--r-pill);
  padding: 0.13rem 0.45rem;
}
.card-foot { display: flex; align-items: center; gap: 0.5rem; margin-top: auto; padding-top: 0.45rem; border-top: 1px dashed var(--border); font-size: 0.7rem; color: var(--text-3); }
.card-foot .host { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot .acts { margin-left: auto; display: flex; gap: 0.25rem; }
.mini {
  border: 0; background: transparent; cursor: pointer; color: var(--text-3);
  padding: 0.22rem; border-radius: 0.45rem; display: grid; place-items: center;
  transition: all 0.15s;
}
.mini:hover { background: var(--panel-sink); color: var(--brand-ink); }
.mini.on { color: #f5a524; }
.mini.on .ic { fill: currentColor; stroke: currentColor; }

/* 列表视图卡片 */
.grid.list-view .card { flex-direction: row; align-items: stretch; }
.grid.list-view .thumb { width: 9.5rem; height: 5.4rem; min-height: 0; flex: none; }
.grid.list-view .card-body { padding: 0.6rem 0.8rem; gap: 0.28rem; }
.grid.list-view .card-desc { min-height: auto; -webkit-line-clamp: 1; }

/* 空状态 */
.empty { grid-column: 1 / -1; text-align: center; padding: 3.5rem 1rem; color: var(--text-3); }
.empty .ic { width: 2.4rem; height: 2.4rem; stroke-width: 1.3; margin-bottom: 0.6rem; }
.empty p { margin: 0.2rem 0; font-size: 0.85rem; }

/* ---------- 骨架屏 ---------- */
.skeleton { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.sk-line { background: linear-gradient(90deg, var(--panel-sink) 25%, var(--border) 37%, var(--panel-sink) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- 详情抽屉 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(23, 21, 43, 0.42);
  backdrop-filter: blur(3px);
  opacity: 0; animation: fade 0.22s ease forwards;
}
@keyframes fade { to { opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(30rem, 94vw);
  display: flex; flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: slide 0.26s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes slide { from { transform: translateX(2rem); opacity: 0.4; } }
.drawer-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); }
.drawer-head .t { font-size: 0.8rem; color: var(--text-3); }
.drawer-scroll { overflow-y: auto; padding: 0 0.9rem 1.4rem; }
.drawer-hero { position: relative; margin: 0.9rem 0 0.8rem; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); }
.drawer-hero img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.drawer-title { display: flex; align-items: center; gap: 0.6rem; }
.drawer-title .favicon { position: static; width: 2.3rem; height: 2.3rem; padding: 0.28rem; box-shadow: var(--shadow-xs); border: 1px solid var(--border); }
.drawer-title h2 { margin: 0; font-size: 1.22rem; }
.drawer-title .host { font-size: 0.75rem; color: var(--text-3); }
.drawer-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin: 0.85rem 0 1rem; }
.drawer-desc { font-size: 0.84rem; color: var(--text-2); line-height: 1.7; }
.section-title { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin: 1.15rem 0 0.5rem; }
.kv { display: grid; grid-template-columns: 5.2rem 1fr; gap: 0.4rem 0.8rem; font-size: 0.8rem; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); word-break: break-all; }
.kv dd.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.76rem; color: var(--text-2); }
.related { display: flex; flex-direction: column; gap: 0.4rem; }
.related button {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  padding: 0.5rem 0.6rem; text-align: left; cursor: pointer;
  background: var(--panel-sub); border: 1px solid var(--border); border-radius: var(--r-md);
  transition: all 0.15s;
}
.related button:hover { border-color: var(--brand-line); transform: translateX(2px); }
.related .favicon { position: static; width: 1.6rem; height: 1.6rem; padding: 0.18rem; box-shadow: none; border: 1px solid var(--border); }
.related .nm { font-size: 0.82rem; font-weight: 600; }
.related .ds { font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related .vis { margin-left: auto; font-size: 0.7rem; color: var(--text-3); }

/* ---------- 统计页 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.8rem; }
.stat {
  padding: 0.9rem 1rem; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
}
.stat .n { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.stat .l { font-size: 0.75rem; color: var(--text-3); margin-top: 0.15rem; }
.bar-row { display: grid; grid-template-columns: 6.5rem 1fr 3.6rem; align-items: center; gap: 0.6rem; padding: 0.3rem 0; font-size: 0.79rem; }
.bar { height: 0.62rem; border-radius: 999px; background: var(--panel-sink); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.6s cubic-bezier(0.2, 0.8, 0.3, 1); }
.bar-row .v { text-align: right; color: var(--text-3); font-size: 0.74rem; }

.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 1rem 1.1rem;
}
.panel > h3 { margin: 0 0 0.7rem; font-size: 0.95rem; display: flex; align-items: center; gap: 0.4rem; }

/* ---------- 设置面板 ---------- */
.sheet {
  position: fixed; z-index: 61; right: 1.2rem; bottom: 1.2rem;
  width: min(22rem, 92vw);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 0.9rem 1rem; animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes pop { from { transform: translateY(0.6rem) scale(0.98); opacity: 0; } }
.sheet h3 { margin: 0 0 0.6rem; font-size: 0.92rem; display: flex; align-items: center; gap: 0.4rem; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.42rem 0; font-size: 0.82rem; color: var(--text-2); }
.field + .field { border-top: 1px solid var(--border); }
.switch { display: inline-flex; gap: 0.15rem; padding: 0.18rem; background: var(--panel-sink); border-radius: var(--r-pill); }
.switch button { border: 0; background: transparent; cursor: pointer; padding: 0.28rem 0.62rem; border-radius: var(--r-pill); font-size: 0.75rem; color: var(--text-3); }
.switch button.active { background: var(--panel); color: var(--brand-ink); font-weight: 600; box-shadow: var(--shadow-xs); }

/* ---------- 表单（后台） ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; }
.form-row { display: flex; flex-direction: column; gap: 0.3rem; }
.form-row.full { grid-column: 1 / -1; }
.form-row label { font-size: 0.74rem; color: var(--text-3); }
.input, .textarea {
  width: 100%; padding: 0.5rem 0.7rem;
  background: var(--panel-sub); border: 1px solid var(--border);
  border-radius: var(--r-md); font-size: 0.83rem; outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.input:focus, .textarea:focus { border-color: var(--brand); background: var(--panel); }
.textarea { min-height: 4.5rem; resize: vertical; line-height: 1.6; }

/* ---------- 表格（后台） ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.81rem; }
.table th {
  text-align: left; padding: 0.55rem 0.6rem; font-size: 0.7rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border);
}
.table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--panel-sub); }
.table .nm { display: flex; align-items: center; gap: 0.5rem; }
.table .favicon { position: static; width: 1.5rem; height: 1.5rem; padding: 0.15rem; box-shadow: none; border: 1px solid var(--border); }

/* ---------- 批量操作条 ---------- */
.bulkbar {
  position: sticky; top: 0.6rem; z-index: 6;
  background: linear-gradient(135deg, var(--brand-soft), var(--panel));
  border-color: var(--brand-line);
  box-shadow: var(--shadow);
}
.bulkbar .selinfo { font-size: 0.82rem; color: var(--brand-ink); font-weight: 600; white-space: nowrap; }
.bulkbar .selinfo b { font-size: 1.05rem; }
.table tr.is-sel td { background: var(--brand-soft); }
input[type="checkbox"] { accent-color: var(--brand); width: 1rem; height: 1rem; cursor: pointer; }

/* ---------- 提示 ---------- */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 1.6rem; transform: translateX(-50%); display: flex; flex-direction: column; gap: 0.4rem; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.5rem 0.95rem; border-radius: var(--r-pill);
  background: rgba(23, 21, 43, 0.92); color: #fff;
  font-size: 0.8rem; box-shadow: var(--shadow-lg);
  animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.toast.ok { background: rgba(17, 122, 62, 0.95); }
.toast.err { background: rgba(190, 40, 45, 0.95); }
.toast .undo {
  border: 0; cursor: pointer; color: #fff; font-size: 0.73rem; font-weight: 600;
  background: rgba(255, 255, 255, 0.22); border-radius: var(--r-pill); padding: 0.18rem 0.6rem;
}
.toast .undo:hover { background: rgba(255, 255, 255, 0.34); }

/* ---------- 页脚 ---------- */
.foot { padding: 0.6rem 0.35rem 1.6rem; font-size: 0.72rem; color: var(--text-3); display: flex; gap: 0.8rem; flex-wrap: wrap; }
.foot a:hover { color: var(--brand-ink); }

/* ---------- 响应式 ---------- */
@media (max-width: 62rem) {
  .app { grid-template-columns: 1fr; padding: 0.7rem; }
  .sidebar { position: static; max-height: none; }
  .nav-cats { max-height: 11rem; }
  .hero { grid-template-columns: 1fr; }
  :root { --grid-min: 13rem; }
}
@media (max-width: 40rem) {
  .topbar { flex-wrap: wrap; }
  .topbar-right { margin-left: 0; width: 100%; }
  :root { --grid-min: 100%; --thumb-h: 7.4rem; }
  .grid.list-view .thumb { width: 6.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   全站索引（服务端渲染）
   首页底部这份目录是「真的」，不是给爬虫单独准备的隐藏文本：
   关掉 JS、慢网、搜索抓取，看到的都是同一份内容。
   ========================================================================== */
.site-index {
  padding: 3rem 1.6rem 4.5rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
}
.si-wrap { max-width: 74rem; margin: 0 auto; }
.si-wrap h2 { font-size: 1.1rem; margin: 0 0 0.4rem; letter-spacing: -0.01em; }
.si-desc { color: var(--text-3); font-size: 0.78rem; margin: 0 0 1.6rem; line-height: 1.6; }
.si-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.5rem 2rem;
}
.si-cat h3 {
  font-size: 0.8rem; font-weight: 600; margin: 0 0 0.55rem;
  color: var(--text-3); letter-spacing: 0.02em;
}
.si-cat h3 span { opacity: 0.55; font-weight: 400; margin-left: 0.15rem; }
.si-cat ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.si-cat li { font-size: 0.8rem; line-height: 1.45; }
.si-cat a {
  color: var(--text); text-decoration: none;
  border-bottom: 1px solid transparent; padding-bottom: 1px;
  transition: color 0.14s ease, border-color 0.14s ease;
}
.si-cat a:hover { color: var(--brand); border-color: var(--brand-line); }
.si-cat em {
  display: block; font-style: normal; font-size: 0.74rem;
  color: var(--text-3); opacity: 0.85;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
