:root {
  --bg: #f7f8fb;
  --bg-soft: #ffffff;
  --fg: #16203a;
  --fg-mute: #667089;
  --line: #e3e7f0;
  --brand: #3f63b4;
  --brand-soft: #eaf0fb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 32, 58, .05), 0 8px 24px rgba(22, 32, 58, .05);
  --wrap: 1080px;
}

@supports (color: oklch(0 0 0)) {
  :root {
    --bg: oklch(0.982 0.004 260);
    --bg-soft: oklch(1 0 0);
    --fg: oklch(0.28 0.035 265);
    --fg-mute: oklch(0.55 0.025 265);
    --line: oklch(0.918 0.011 265);
    --brand: oklch(0.52 0.135 264);
    --brand-soft: oklch(0.955 0.025 264);
  }
}

[data-theme="dark"] {
  --bg: #0e1320;
  --bg-soft: #161d2e;
  --fg: #e6ebf7;
  --fg-mute: #93a0bb;
  --line: #273049;
  --brand: #7c9cf0;
  --brand-soft: #1c2540;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

@supports (color: oklch(0 0 0)) {
  [data-theme="dark"] {
    --bg: oklch(0.19 0.02 265);
    --bg-soft: oklch(0.245 0.025 265);
    --fg: oklch(0.93 0.012 265);
    --fg-mute: oklch(0.7 0.025 265);
    --line: oklch(0.32 0.03 265);
    --brand: oklch(0.75 0.1 264);
    --brand-soft: oklch(0.3 0.045 265);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.mp-wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.mp-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .mp-header { background: var(--bg); }
}
.mp-header-inner { display: flex; align-items: center; gap: 18px; height: 60px; }

.mp-brand { display: flex; align-items: center; gap: 9px; color: var(--fg); }
.mp-brand:hover { text-decoration: none; }
.mp-logo {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 700;
}
.mp-brand-text { display: flex; flex-direction: column; line-height: 1.15; font-weight: 700; font-size: 15px; }
.mp-brand-text small { font-weight: 400; font-size: 11px; color: var(--fg-mute); }

.mp-nav { display: flex; gap: 16px; margin-left: auto; font-size: 14px; }
.mp-nav a { color: var(--fg-mute); }
.mp-nav a:hover { color: var(--brand); text-decoration: none; }

.mp-theme {
  width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--fg-mute);
  cursor: pointer; font-size: 14px; line-height: 1;
}
.mp-theme:hover { color: var(--brand); border-color: var(--brand); }

/* ---------- hero ---------- */
/* 首屏只有一块浅色面板：标题、搜索、热门词、四格数据都在同一张底上。
   之前是「圆形胶囊搜索框 + 独立白色数据卡 + 卡片网格」三种语言并排，
   视觉上互不相干，这里统一成同一种圆角与边框、同一套间距节奏。 */
.mp-hero { padding: 36px 0 6px; }
.mp-hero-panel {
  position: relative; overflow: hidden;
  padding: 44px 32px 0;
  text-align: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
/* 顶部一层很淡的径向高光，让面板不至于是一块死白 */
.mp-hero-panel::before {
  content: ""; position: absolute; inset: -40% 20% auto;
  height: 340px;
  background: radial-gradient(closest-side, var(--brand-soft), transparent);
  pointer-events: none;
}
.mp-hero-panel > * { position: relative; }

.mp-hero-eyebrow {
  margin: 0 0 12px;
  font-size: 12px; font-weight: 600; letter-spacing: .16em;
  color: var(--brand);
}
.mp-hero-title { margin: 0 0 10px; font-size: clamp(27px, 4.2vw, 38px); letter-spacing: -.02em; }
.mp-hero-sub { margin: 0 auto 26px; max-width: 620px; color: var(--fg-mute); font-size: 14px; }

.mp-search {
  display: flex; gap: 8px;
  max-width: 620px; margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.mp-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.mp-input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent; color: var(--fg);
  font: inherit; font-size: 15px;
  padding: 9px 12px; outline: none;
}
.mp-input::placeholder { color: var(--fg-mute); }
.mp-submit {
  flex: 0 0 auto;
  border: 0; border-radius: 8px;
  padding: 9px 22px;
  background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.mp-submit:hover { filter: brightness(1.08); }

.mp-search-inline { margin: 18px 0 22px; max-width: 100%; }

.mp-hot {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 6px 10px;
  margin: 18px auto 0; max-width: 700px;
  font-size: 13px; color: var(--fg-mute);
}
.mp-hot-label { font-weight: 600; color: var(--fg); opacity: .7; }
.mp-hot-item { color: var(--fg-mute); }
.mp-hot-item:hover { color: var(--brand); }

/* 四格数据压在面板底部，用分隔线切成一条信息带，
   不再单开一张白卡——那是首页之前最跳的一块 */
.mp-hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin: 30px -32px 0; padding: 18px 32px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  text-align: center;
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .mp-hero-stats { background: var(--bg); }
}
.mp-hero-stats > div + div { border-left: 1px solid var(--line); }
.mp-hero-stats dt { font-size: 12px; color: var(--fg-mute); }
.mp-hero-stats dd { margin: 3px 0 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }

.mp-section { padding: 24px 0; }

/* ---------- 分类入口 ---------- */
.mp-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
.mp-cat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 13px 15px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  transition: border-color .15s ease, transform .15s ease;
}
.mp-cat:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.mp-cat-name { font-size: 14px; font-weight: 600; }
.mp-cat-desc { font-size: 12px; color: var(--fg-mute); }

/* ---------- 网盘覆盖 ---------- */
.mp-pans { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-pan {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; color: var(--fg);
}
.mp-pan i { width: 7px; height: 7px; border-radius: 50%; }
.mp-pan em {
  font-style: normal; font-size: 12px; color: var(--fg-mute);
  padding-left: 6px; border-left: 1px solid var(--line);
}

.mp-section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.mp-section-head h2 { margin: 0; font-size: 17px; }
.mp-more { font-size: 13px; color: var(--fg-mute); }

/* ---------- cards ---------- */
/* 4 列：12 张卡片正好三行填满，1080 容器下不会出现「第二行只剩两张」
   的大片空白（190px 时是 5 列 12 张，末行空出 3 格） */
.mp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.mp-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 15px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
}
.mp-card:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.mp-card-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-card-meta { font-size: 12px; color: var(--fg-mute); }
.mp-card-badges { display: flex; align-items: center; gap: 5px; margin-top: 2px; min-height: 18px; }
.mp-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.mp-tag {
  font-style: normal; font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 5px;
  background: var(--brand-soft); color: var(--brand);
}

/* ---------- filters ---------- */
.mp-filters {
  display: flex; gap: 7px; overflow-x: auto;
  padding-bottom: 4px; margin-bottom: 12px;
  scrollbar-width: none;
}
.mp-filters::-webkit-scrollbar { display: none; }
.mp-filter {
  flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--fg-mute);
  border-radius: 999px; padding: 5px 13px;
  font: inherit; font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
.mp-filter em { font-style: normal; opacity: .6; margin-left: 3px; font-size: 12px; }
.mp-filter:hover { color: var(--brand); border-color: var(--brand); }
.mp-filter.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.mp-filter.is-active em { opacity: .8; }

/* ---------- list ---------- */
.mp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.mp-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.mp-item:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.mp-item-main { flex: 1 1 auto; min-width: 0; }
.mp-item-title {
  display: block;
  font-size: 14px; font-weight: 500; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mp-item-title:hover { color: var(--brand); text-decoration: none; }
.mp-item-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  margin-top: 5px; font-size: 12px; color: var(--fg-mute);
}
.mp-pill {
  font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 5px;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
}
.mp-src { opacity: .7; }

.mp-item-side { flex: 0 0 auto; display: flex; gap: 7px; }
.mp-btn-copy {
  border: 1px solid var(--line); background: transparent; color: var(--fg-mute);
  border-radius: 8px; padding: 5px 11px;
  font: inherit; font-size: 12px; cursor: pointer;
  white-space: nowrap;
}
.mp-btn-copy:hover { color: var(--brand); border-color: var(--brand); }
.mp-btn-copy.is-done { color: #16a34a; border-color: #16a34a; }

.mp-muted { color: var(--fg-mute); }
.mp-empty { padding: 26px 0; text-align: center; font-size: 14px; }
.mp-note { margin: 14px 0 0; font-size: 12px; }

/* ---------- topic ---------- */
.mp-crumb { padding: 18px 20px 0; font-size: 13px; color: var(--fg-mute); }
.mp-crumb a { color: var(--fg-mute); }
.mp-crumb span { margin: 0 6px; opacity: .5; }
.mp-crumb b { color: var(--fg); font-weight: 500; }

.mp-topic-title { margin: 16px 0 8px; font-size: clamp(22px, 3.4vw, 30px); letter-spacing: -.02em; }
.mp-topic-lead { margin: 0 0 4px; font-size: 13px; color: var(--fg-mute); }
.mp-topic-lead b { color: var(--fg); }

/* ---------- links ---------- */
.mp-links { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-soft);
  font-size: 13px; color: var(--fg);
}
.mp-link em { font-style: normal; font-size: 11px; color: var(--fg-mute); }
.mp-link:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ---------- prose ---------- */
.mp-prose { font-size: 14px; color: var(--fg-mute); max-width: 760px; }
.mp-prose h1 { font-size: 26px; color: var(--fg); margin: 0 0 16px; letter-spacing: -.02em; }
.mp-prose h2 { font-size: 16px; color: var(--fg); margin: 26px 0 8px; }
.mp-prose p { margin: 0 0 10px; }
.mp-prose ul { margin: 0 0 12px; padding-left: 20px; }
.mp-prose li { margin-bottom: 5px; }
.mp-prose kbd {
  font: inherit; font-size: 12px;
  padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--fg);
}
.mp-doc { padding-bottom: 40px; }

/* ---------- pager ---------- */
.mp-pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 24px; }
.mp-pager a, .mp-pager span {
  min-width: 32px; height: 32px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--fg-mute); background: var(--bg-soft);
}
.mp-pager a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.mp-pager .is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.mp-pager .is-gap { border: 0; background: none; color: var(--fg-mute); }
.mp-pager .mp-pager-step { min-width: 0; padding: 0 12px; }

/* ---------- footer ---------- */
.mp-footer {
  margin-top: 40px; padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--fg-mute);
}
.mp-footer-links { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 12px; }
.mp-footer-links a { color: var(--fg-mute); }
.mp-footer-links a:hover { color: var(--brand); }
.mp-footer-note { margin: 0 0 10px; line-height: 1.7; }
.mp-footer-copy { margin: 0; opacity: .7; font-size: 12px; }

/* ---------- 移动端：单行横向滚动 + 右缘渐隐 ---------- */
@media (max-width: 640px) {
  .mp-wrap { padding: 0 14px; }
  .mp-nav { display: none; }
  .mp-hero { padding: 20px 0 4px; }
  .mp-hero-panel { padding: 30px 18px 0; border-radius: 16px; }
  .mp-hero-sub { font-size: 13px; margin-bottom: 20px; }

  /* 搜索框在窄屏竖排，按钮占满一行，避免输入区被挤成一条缝 */
  .mp-search { flex-direction: column; gap: 6px; }
  .mp-submit { padding: 10px; }

  .mp-hero-stats { margin: 24px -18px 0; padding: 14px 18px; grid-template-columns: repeat(2, 1fr); gap: 0; }
  .mp-hero-stats > div { padding: 8px 0; }
  .mp-hero-stats > div:nth-child(odd) { border-left: 0; }
  .mp-hero-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }

  .mp-cats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .mp-cat { padding: 11px 12px; }

  /* 原站 .mp-row 模式：结果卡片横向滚动，右侧 mask 渐隐 */
  .mp-row {
    display: flex; gap: 10px;
    overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
  }
  .mp-row > * { flex: 0 0 84%; scroll-snap-align: start; }

  .mp-item { flex-direction: column; align-items: stretch; gap: 10px; }
  .mp-item-side { justify-content: flex-end; }
  .mp-filters { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
                        mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .mp-card:hover { transform: none; }
}
