/* ============================================================
   无言导航 · 前台样式
   ============================================================ */

:root {
  --accent: #5b5bd6;
  --accent-2: #8b5cf6;

  --bg: #f4f5fa;
  --bg-soft: #eceef7;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --text: #16181f;
  --text-2: #454a58;
  --muted: #767d8f;
  --border: rgba(20, 24, 40, .08);
  --border-strong: rgba(20, 24, 40, .14);
  --shadow-sm: 0 1px 2px rgba(18, 22, 40, .05);
  --shadow-md: 0 2px 4px rgba(18, 22, 40, .04), 0 12px 28px -14px rgba(18, 22, 40, .18);
  --shadow-lg: 0 6px 12px rgba(18, 22, 40, .06), 0 24px 48px -20px rgba(40, 40, 120, .28);
  --ring: rgba(91, 91, 214, .18);

  --ok: #0f9b6c;
  --ok-bg: rgba(15, 155, 108, .12);
  --warn: #b26a00;
  --warn-bg: rgba(226, 150, 20, .16);
  --hot: #d92d20;
  --hot-bg: rgba(217, 45, 32, .12);
  --info: #3b6ad6;
  --info-bg: rgba(59, 106, 214, .12);

  --radius: 16px;
  --radius-lg: 22px;
  --wrap: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #0a0b10;
  --bg-soft: #0f1116;
  --surface: #14161d;
  --surface-2: #191c25;
  --text: #eef1f8;
  --text-2: #c2c8d6;
  --muted: #8c93a6;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, .3), 0 14px 30px -16px rgba(0, 0, 0, .8);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, .4), 0 30px 60px -24px rgba(0, 0, 0, .9);
  --ring: rgba(139, 92, 246, .28);
  --ok: #34d399; --ok-bg: rgba(52, 211, 153, .14);
  --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .16);
  --hot: #f87171; --hot-bg: rgba(248, 113, 113, .16);
  --info: #93b4ff; --info-bg: rgba(147, 180, 255, .16);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- 背景光斑 ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .42;
  animation: float 22s ease-in-out infinite;
}
.orb-a { width: 520px; height: 520px; top: -180px; left: -120px; background: radial-gradient(circle, rgba(99, 91, 255, .34), transparent 70%); }
.orb-b { width: 480px; height: 480px; top: 120px; right: -160px; background: radial-gradient(circle, rgba(56, 189, 248, .24), transparent 70%); animation-delay: -7s; }
.orb-c { width: 560px; height: 560px; bottom: -260px; left: 32%; background: radial-gradient(circle, rgba(236, 72, 153, .13), transparent 70%); animation-delay: -13s; }
html[data-theme="dark"] .orb { opacity: .3; }
.grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(120, 130, 160, .10) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: .5;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
}
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(30px, -40px, 0) scale(1.08); }
}

/* ---------- 布局 ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 22px;
  position: relative;
  z-index: 1;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.topbar.is-stuck {
  border-bottom-color: var(--border);
  box-shadow: 0 8px 24px -20px rgba(20, 24, 40, .5);
}
.topbar-in {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 66px;
}

.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px;
  display: block;
  border-radius: 10px;
  box-shadow: 0 2px 6px -2px rgba(60, 60, 160, .45);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: -.2px; }
.brand-text small { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }

.search {
  flex: 1;
  min-width: 0;
  max-width: 460px;
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
}
.search input { min-width: 0; }
.search .s-ico {
  position: absolute; left: 14px;
  width: 17px; height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 42px;
  padding: 0 78px 0 40px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 4px var(--ring);
}
.s-kbd {
  position: absolute; right: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
  pointer-events: none;
}
.s-clear {
  position: absolute; right: 8px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.s-clear[hidden] { display: none; }
.search.has-val .s-kbd { display: none; }
.s-clear:hover { color: var(--text); }
.s-clear svg { width: 14px; height: 14px; }

.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .18s, color .18s, border-color .18s;
}
.icon-btn:hover { transform: translateY(-1px); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.i-sun { display: none; }
html[data-theme="dark"] .i-sun { display: block; }
html[data-theme="dark"] .i-moon { display: none; }

/* ---------- Hero ---------- */
.main { padding-top: 56px; padding-bottom: 40px; }
.hero { max-width: 760px; }
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.16;
  letter-spacing: -1.2px;
  font-weight: 800;
}
.hl {
  background: linear-gradient(100deg, var(--accent), var(--accent-2) 60%, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin: 0 0 8px;
  font-size: clamp(15px, 2.2vw, 18px);
  color: var(--text-2);
  font-weight: 500;
}
.hero-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 620px;
}
.stats {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--muted);
}
.stats .stat b { color: var(--text); font-size: 14px; font-weight: 700; }
.stats .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }

/* ---------- 分类 chips ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 26px 2px 6px;
  margin-bottom: 6px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips.is-scrollable:not(.at-end) {
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 30px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 30px), transparent 100%);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.chip em { font-style: normal; font-size: 11px; color: var(--muted); }
.chip .ci { font-size: 13px; }
.chip.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}
.chip.is-active em { color: rgba(255, 255, 255, .78); }

/* ---------- 分组 ---------- */
.group { margin-top: 30px; scroll-margin-top: 92px; }
.group-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.group-head h2 {
  display: flex; align-items: center; gap: 7px;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.2px;
  white-space: nowrap;
}
.group-head .gi { font-size: 14px; }
.gn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.group-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent 90%);
}

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(316px, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(.2, .7, .3, 1), box-shadow .22s, border-color .22s;
  overflow: hidden;
  animation: cardIn .5s cubic-bezier(.2, .7, .3, 1) both;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 55%);
  opacity: 0;
  transition: opacity .22s;
  pointer-events: none;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  box-shadow: var(--shadow-lg);
}
.card:hover::after { opacity: 1; }
.card:active { transform: translateY(-1px) scale(.995); }

.card-ico {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  font-size: 22px;
  line-height: 1;
}
.card-ico img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.card-ico.has-img { background: #fff; padding: 5px; }
html[data-theme="dark"] .card-ico.has-img { background: var(--surface-2); }
.card-ico .emo { display: block; transform: translateY(.5px); }
.card-ico.fallback { background: var(--surface-2); }

.card-main { flex: 1; min-width: 0; display: block; }
.card-title {
  display: flex; align-items: center; gap: 7px;
  min-width: 0;
}
.card-title b {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pin { font-style: normal; font-size: 10px; color: #f5a623; }

.badge {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 5px;
  letter-spacing: .2px;
}
.b-ok { color: var(--ok); background: var(--ok-bg); }
.b-warn { color: var(--warn); background: var(--warn-bg); }
.b-hot { color: var(--hot); background: var(--hot-bg); }
.b-info { color: var(--info); background: var(--info-bg); }

.card-desc {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-host {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  opacity: .72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-arrow {
  flex: 0 0 auto;
  width: 16px; height: 16px;
  margin-top: 3px;
  color: var(--muted);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity .22s, transform .22s, color .22s;
}
.card:hover .card-arrow { opacity: 1; transform: none; color: var(--accent); }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 空状态 ---------- */
.empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-emo { font-size: 34px; margin-bottom: 10px; opacity: .8; }
.empty p { margin: 0 0 6px; font-size: 15px; color: var(--text-2); font-weight: 600; }
.empty span { font-size: 12.5px; }
.empty kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
}

/* ---------- 页脚 ---------- */
.foot {
  margin-top: 56px;
  padding: 26px 0 34px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.foot-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}
.foot p { margin: 0; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); text-decoration: underline; }

/* ---------- 滚动显现 ---------- */
[data-reveal] {
  animation: reveal .6s cubic-bezier(.2, .7, .3, 1) both;
}
[data-reveal]:nth-child(1) { animation-delay: .02s; }
[data-reveal]:nth-child(2) { animation-delay: .08s; }
[data-reveal]:nth-child(3) { animation-delay: .14s; }
[data-reveal]:nth-child(4) { animation-delay: .2s; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .main { padding-top: 34px; }
  .topbar-in { height: 62px; gap: 12px; }
  .brand-text small { display: none; }
  .search { max-width: none; }
  .s-kbd { display: none; }
  .search input { padding-right: 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); }
}
@media (max-width: 620px) {
  .wrap { padding: 0 14px; }

  /* 顶栏：品牌 + 主题按钮一行，搜索独占一行 */
  .topbar-in {
    height: auto;
    flex-wrap: wrap;
    align-items: center;
    padding: 9px 0 10px;
    gap: 8px 10px;
  }
  .brand { gap: 8px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-text strong { font-size: 14.5px; }
  .search { order: 3; flex: 1 1 100%; max-width: none; margin-left: 0; }
  .top-actions { margin-left: auto; gap: 6px; }
  .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .search input { height: 38px; font-size: 13px; padding: 0 38px 0 36px; }
  .search .s-ico { width: 15px; height: 15px; left: 12px; }

  /* Hero 收紧 */
  .main { padding-top: 20px; }
  .hero h1 { font-size: 26px; letter-spacing: -.7px; margin-bottom: 8px; }
  .hero-sub { font-size: 13px; margin-bottom: 6px; }
  .hero-desc { font-size: 12px; line-height: 1.6; }
  .stats { margin-top: 12px; gap: 8px; font-size: 11.5px; }
  .stats .stat b { font-size: 13px; }

  /* 分类胶囊：手机上换行显示，不横向截断 */
  .chips {
    padding: 16px 2px 2px;
    gap: 7px;
    flex-wrap: wrap;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .chip { height: 30px; padding: 0 11px; font-size: 12px; }

  /* 双列紧凑卡片 */
  .grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .card {
    flex-direction: column;
    gap: 7px;
    padding: 12px;
    border-radius: 14px;
  }
  .card-main { width: 100%; }
  .card-ico { width: 36px; height: 36px; font-size: 18px; border-radius: 10px; }
  .card-title b { font-size: 13px; }
  .card-desc { display: none; }
  .card-host { margin-top: 2px; font-size: 10px; }
  .card-arrow { display: none; }
  .badge { font-size: 9.5px; padding: 2px 5px; }

  .group { margin-top: 22px; scroll-margin-top: 116px; }
  .group-head { margin-bottom: 9px; }
  .group-head h2 { font-size: 14px; }
  .foot { margin-top: 40px; padding: 22px 0 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 极简模式：无顶栏 / 无标题区 / 无分类胶囊 ---------- */
.main-bare { padding-top: 40px; }
.main-bare .group:first-child { margin-top: 0; }
@media (max-width: 620px) {
  .main-bare { padding-top: 20px; }
}

/* 极简模式下页脚贴底 */
body.bare { display: flex; flex-direction: column; min-height: 100vh; }
body.bare .main { flex: 1 0 auto; }
body.bare .foot { flex: 0 0 auto; }
