/* ==========================================================================
   cilsearch.com「磁力搜」- 全站样式
   版式参考国内导航站（xdy.me）的既有做法：浅灰底 + 白色小卡片 + 细分隔线，
   左侧窄分类栏、右侧多列站点卡片、底部文章区；不使用大色块与渐变。
   ========================================================================== */

:root {
  --bg: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --line: #f1f2f3;
  --line-2: #e6e8ea;
  --ink: #333333;
  --ink-2: #5f5f5f;
  --ink-3: #8c8c8c;
  --ink-4: #a4abb0;
  --accent: #1e9fff;
  --accent-soft: #e8f3ff;
  --accent-line: #cfe6ff;
  --teal: #0f766e;
  --teal-soft: #e6f7f5;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-hover: 0 2px 8px rgba(30, 159, 255, .08);
}

[data-theme="dark"] {
  --bg: #1b1f22;
  --surface: #23282b;
  --surface-2: #1f2427;
  --line: #2c3236;
  --line-2: #363d42;
  --ink: #e6e9eb;
  --ink-2: #b6bdc2;
  --ink-3: #8b9499;
  --ink-4: #737c81;
  --accent: #4bb0ff;
  --accent-soft: #1d3346;
  --accent-line: #2a4a66;
  --teal: #4fd1c5;
  --teal-soft: #1c3a37;
  --shadow-hover: 0 2px 8px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { border: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
button { font-family: inherit; }

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 16px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ===================== 顶栏 ===================== */
.hdr {
  position: sticky; top: 0; z-index: 30;
  height: 50px;
  background: var(--surface-2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.hdr-in {
  max-width: 1440px; margin: 0 auto; height: 50px;
  padding: 0 16px;
  display: flex; align-items: center; gap: 12px;
}
.logo { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.logo-img { width: 26px; height: 26px; border-radius: var(--radius-sm); display: block; }
.logo-txt { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: .3px; }

.mnav {
  display: flex; align-items: center; gap: 2px;
  min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.mnav::-webkit-scrollbar { display: none; }
.mnav a {
  flex: 0 0 auto;
  height: 50px; line-height: 50px; padding: 0 10px;
  font-size: 14px; color: var(--ink-2); white-space: nowrap;
}
.mnav a:hover { color: var(--accent); }
.mnav a.on { color: var(--teal); font-weight: 600; }

.hsearch {
  margin-left: auto; flex: 0 0 232px;
  display: flex; align-items: center;
  height: 32px; padding-left: 10px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
}
.hsearch:focus-within { border-color: var(--accent); }
.hsearch input {
  flex: 1; min-width: 0; height: 30px;
  border: 0; outline: none; background: transparent;
  font-size: 13px; color: var(--ink);
}
.hsearch input::placeholder { color: var(--ink-4); }
.hsearch button {
  width: 32px; height: 30px; border: 0; background: transparent;
  color: var(--ink-3); cursor: pointer; display: grid; place-items: center;
}
.hsearch button:hover { color: var(--accent); }

.theme-btn {
  flex: 0 0 30px; width: 30px; height: 30px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-3);
  font-size: 14px; cursor: pointer; line-height: 1;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent-line); }

.domain-tip {
  background: var(--surface); border-bottom: 1px solid var(--line);
  color: var(--ink-3); font-size: 12px; text-align: center;
  padding: 5px 16px;
}

/* ===================== 版式 ===================== */
.page-main { padding-top: 14px; }
.layout { display: flex; align-items: flex-start; gap: 14px; }

.side {
  flex: 0 0 152px; width: 152px;
  position: sticky; top: 64px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}
.side-card + .side-card { margin-top: 12px; }
.side-h {
  font-size: 11.5px; font-weight: 400; color: var(--ink-4);
  padding: 4px 8px 6px; letter-spacing: .5px;
}
.side-list { display: flex; flex-direction: column; gap: 1px; }
.side-list a {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 8px;
  border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.side-list a:hover { background: var(--teal-soft); color: var(--teal); }
.sl-ico { display: inline-flex; color: var(--ink-4); }
.side-list a:hover .sl-ico { color: var(--teal); }
.sl-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnt { font-size: 11px; font-weight: 400; color: var(--ink-4); }

.side-search { display: flex; height: 30px; margin: 0 4px; }
.side-search input {
  flex: 1; min-width: 0; height: 30px; padding: 0 8px;
  border: 1px solid var(--line-2); border-right: 0; border-radius: 6px 0 0 6px;
  background: var(--surface-2); font-size: 12.5px; color: var(--ink); outline: none;
}
.side-search input:focus { border-color: var(--accent); background: var(--surface); }
.side-search button {
  width: 46px; height: 30px; border: 1px solid var(--line-2); border-radius: 0 6px 6px 0;
  background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; cursor: pointer;
}
.side-search button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.side-note { font-size: 11.5px; line-height: 1.7; color: var(--ink-4); padding: 8px 8px 0; }
.side-tip p { font-size: 11.5px; line-height: 1.8; color: var(--ink-3); padding: 0 8px; }
.side-link { display: inline-block; font-size: 11.5px; color: var(--accent); padding: 6px 8px 2px; }

.content { flex: 1; min-width: 0; padding-bottom: 36px; }

/* ===================== 面包屑 ===================== */
.breadcrumb { margin: 12px 0 10px; font-size: 12.5px; color: var(--ink-3); }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.breadcrumb li { display: inline-flex; align-items: center; }
.breadcrumb li + li::before { content: "/"; color: var(--ink-4); margin-right: 6px; font-size: 12px; }
.breadcrumb a { color: var(--ink-3); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current] span { color: var(--ink-2); }

/* ===================== 首屏检索条 ===================== */
.hero {
  display: flex; align-items: center; gap: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 22px;
}
.hero-l { flex: 1; min-width: 0; }
.hero-h1 { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.45; }
.hero-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.hero-meta { font-size: 12px; color: var(--ink-4); margin-top: 6px; }
.hero-meta b { color: var(--accent); font-weight: 600; }

.hero-r { flex: 0 0 400px; max-width: 50%; }
.hero-search {
  display: flex; height: 38px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); overflow: hidden;
}
.hero-search:focus-within { border-color: var(--accent); }
.hs-input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  padding: 0 12px; font-size: 13.5px; color: var(--ink);
}
.hs-input::placeholder { color: var(--ink-4); }
.hs-btn {
  width: 84px; border: 0; background: var(--accent); color: #fff;
  font-size: 14px; cursor: pointer;
}
.hs-btn:hover { background: #0d8eef; }

.hero-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.htab {
  height: 26px; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink-2);
  font-size: 12.5px; cursor: pointer;
}
.htab:hover { color: var(--accent); background: var(--accent-soft); }
.htab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.hero-kw { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--ink-4); }
.kw { color: var(--ink-2); }
.kw:hover { color: var(--accent); }

/* ===================== 栏目面板 ===================== */
.panel { margin-bottom: 26px; }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  min-height: 30px; margin-bottom: 12px; padding: 0 2px;
}
.panel-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 16px; font-weight: 700; color: var(--ink);
}
.p-ico { display: inline-flex; color: var(--accent); }
.panel-cnt {
  font-style: normal; font-size: 11.5px; font-weight: 400;
  color: var(--ink-3); background: rgba(0, 0, 0, .045);
  border-radius: 9px; padding: 0 7px; line-height: 18px;
}
[data-theme="dark"] .panel-cnt { background: rgba(255, 255, 255, .08); }
.panel-intro { font-size: 12px; color: var(--ink-4); }
.panel-more { margin-left: auto; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.panel-more:hover { color: var(--accent); }
.panel-body { min-width: 0; }

.sub-h {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin: 4px 0 8px;
}
.sub-h em {
  font-style: normal; font-size: 11px; font-weight: 400;
  color: var(--ink-4); background: rgba(0, 0, 0, .045);
  border-radius: 8px; padding: 0 6px; line-height: 16px;
}
[data-theme="dark"] .sub-h em { background: rgba(255, 255, 255, .08); }

/* ===================== 站点卡片 ===================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
/* 常用网站固定 5 个，单独排 5 列，避免最后空一格 */
.card-grid-featured { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  height: 60px; padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-hover);
  color: inherit;
}
.card-ico {
  flex: 0 0 24px; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}
.site-ico-img {
  width: 24px; height: 24px; object-fit: contain;
  border-radius: 4px; background: transparent;
}
.card-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.card-name {
  font-size: 14px; font-weight: 500; color: var(--ink);
  line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-desc {
  font-size: 12px; color: var(--ink-3); line-height: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card:hover .card-name { color: var(--accent); }

.card-badge {
  position: absolute; top: 0; right: 0;
  font-size: 10px; line-height: 15px; padding: 0 5px;
  background: #f5222d; color: #fff;
  border-bottom-left-radius: 6px;
}

/* ===================== 文章卡片 ===================== */
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.post:hover { border-color: var(--accent-line); box-shadow: var(--shadow-hover); }
.post-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.post-cat {
  font-size: 11.5px; color: var(--accent);
  background: var(--accent-soft); border-radius: 4px; padding: 1px 6px;
}
.post-date { font-size: 11.5px; color: var(--ink-4); }
.post-title { font-size: 14.5px; line-height: 1.55; font-weight: 600; margin: 8px 0 6px; }
.post-title a { color: var(--ink); }
.post-title a:hover { color: var(--accent); }
.post-sum { font-size: 12.5px; line-height: 1.7; color: var(--ink-3); }
.post-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.tag {
  display: inline-flex; align-items: center; gap: 3px;
  height: 24px; padding: 0 8px;
  background: var(--surface-2); border-radius: 5px;
  font-size: 12px; color: var(--ink-2);
}
.tag:hover { background: var(--accent-soft); color: var(--accent); }
.tag em {
  font-style: normal; font-size: 11px; color: var(--ink-4);
}
.tag-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.tag-row-t { font-size: 12px; color: var(--ink-4); margin-right: 2px; }

/* ===================== 分页 ===================== */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; }
.pg-btn {
  min-width: 30px; height: 30px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--ink-2);
}
.pg-btn:hover { border-color: var(--accent); color: var(--accent); }
.pg-btn.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pg-btn.current:hover { color: #fff; }
.pg-btn.disabled { color: var(--ink-4); background: var(--surface-2); }
.pg-gap { color: var(--ink-4); padding: 0 2px; }
.pg-info { margin-left: auto; font-size: 12px; color: var(--ink-4); }

/* ===================== 正文排版 ===================== */
.rich { font-size: 14px; line-height: 1.9; color: var(--ink-2); }
.rich h2 {
  font-size: 15.5px; font-weight: 600; color: var(--ink);
  margin: 22px 0 10px; padding-left: 9px; border-left: 3px solid var(--accent);
}
.rich h3 { font-size: 14.5px; color: var(--ink); margin: 16px 0 8px; }
.rich p { margin: 0 0 12px; }
.rich ul, .rich ol { margin: 0 0 12px; padding-left: 20px; list-style: disc; }
.rich ol { list-style: decimal; }
.rich li { margin-bottom: 6px; }
.rich img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 10px 0; }
.rich a { color: var(--accent); }
.rich strong { color: var(--ink); }
.rich blockquote {
  margin: 12px 0; padding: 8px 12px;
  background: var(--surface-2); border-left: 3px solid var(--line-2); color: var(--ink-3);
}

/* ===================== 二级详情页 ===================== */
.site-hero { display: flex; align-items: center; gap: 12px; }
.site-ico {
  flex: 0 0 48px; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.site-ico img { width: 48px; height: 48px; object-fit: contain; border-radius: var(--radius); }
.sh-main { min-width: 0; }
.site-name { font-size: 18px; font-weight: 700; color: var(--ink); }
.site-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn-go, .btn-line {
  height: 34px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 13.5px;
}
.btn-go { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-go:hover { background: #0d8eef; color: #fff; }
.btn-line { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-2); }
.btn-line:hover { border-color: var(--accent); color: var(--accent); }

.note-box {
  margin-top: 12px; padding: 8px 12px;
  background: var(--surface-2); border-left: 3px solid var(--line-2); border-radius: 4px;
  font-size: 12px; color: var(--ink-3);
}

.magnet-box {
  margin-top: 18px; padding: 12px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--line-2); border-radius: 8px;
}
.mb-title { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.mb-value {
  display: block; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: Consolas, Menlo, monospace; font-size: 12px; line-height: 1.7;
  color: var(--ink-2); word-break: break-all;
}
.mb-tip { font-size: 11.5px; color: var(--ink-4); margin-top: 6px; }

.article-head { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.article-h1 { font-size: 21px; line-height: 1.5; font-weight: 700; color: var(--ink); }
.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 10px; font-size: 12.5px; color: var(--ink-4);
}
.article-meta .post-cat { font-size: 12px; }

.empty {
  padding: 26px 16px; text-align: center;
  background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius);
  font-size: 13px; line-height: 1.9; color: var(--ink-3);
}

.seo-text { font-size: 13px; line-height: 1.9; color: var(--ink-3); }
.seo-text .panel-body > p { margin-bottom: 10px; }

/* ===================== 404 ===================== */
.nf-wrap { text-align: center; padding: 36px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.nf-code { font-size: 54px; font-weight: 700; line-height: 1; color: var(--line-2); letter-spacing: 2px; }
.nf-tip { font-size: 13px; color: var(--ink-3); margin: 10px 0 16px; }

/* ===================== 页脚 ===================== */
.foot { margin-top: 10px; background: var(--surface-2); border-top: 1px solid var(--line); }
.foot-in {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 24px; padding: 24px 16px 18px;
}
.foot-brand .foot-logo { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--ink); }
.foot-brand .foot-logo img { width: 24px; height: 24px; border-radius: var(--radius-sm); }
.foot-brand p { font-size: 12px; line-height: 1.85; color: var(--ink-4); margin-top: 10px; max-width: 420px; }
.foot-col h2 { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.foot-col li { font-size: 12.5px; line-height: 2; }
.foot-col a { color: var(--ink-3); }
.foot-col a:hover { color: var(--accent); }
.foot-bot { padding: 12px 16px 24px; border-top: 1px solid var(--line); }
.foot-disc { font-size: 11.5px; line-height: 1.85; color: var(--ink-4); }
.foot-copy { font-size: 12px; color: var(--ink-4); margin-top: 6px; }
.foot-copy span + span { margin-left: 6px; }
.foot-icp a { color: var(--ink-3); }
.foot-icp a:hover { color: var(--accent); }

/* ===================== 响应式 ===================== */
@media (max-width: 1360px) {
  .card-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .card-grid-featured { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hero-r { flex-basis: 360px; }
}

@media (max-width: 1180px) {
  .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card-grid-featured { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hero { flex-wrap: wrap; gap: 14px; }
  .hero-r { flex: 1 1 100%; max-width: none; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
  .side { display: none; }
  .mnav a { padding: 0 8px; font-size: 13.5px; }
  .hsearch { flex-basis: 170px; }
  .foot-in { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .hdr-in { gap: 8px; padding: 0 12px; }
  .logo-txt { font-size: 15px; }
  .hsearch { display: none; }
  .hero { padding: 12px; }
  .hero-h1 { font-size: 16px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card-grid-featured { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { height: 56px; padding: 0 8px; gap: 7px; }
  .post-grid { grid-template-columns: 1fr; }
  .panel-title { font-size: 15px; }
  .panel-intro { display: none; }
  .article-h1 { font-size: 18px; }
  .wrap, .foot-in, .foot-bot { padding-left: 12px; padding-right: 12px; }
  .foot-in { grid-template-columns: 1fr; gap: 18px; }
  .pg-info { margin-left: 0; width: 100%; }
}

@media (max-width: 480px) {
  .card-name { font-size: 13px; }
  .card-desc { font-size: 11.5px; }
  .hero-tabs { gap: 4px; }
  .htab { height: 24px; padding: 0 8px; font-size: 12px; }
}
