/* =========================================================
   个人导航页 · 主样式
   移动优先，深色为主，支持明暗切换
   ========================================================= */

/* ---------- 设计变量 ---------- */
:root {
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --wrap: 1120px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

html[data-theme="dark"] {
  --bg: #070a12;
  --bg-bar: rgba(7, 10, 18, .72);
  --panel: rgba(255, 255, 255, .045);
  --panel-hi: rgba(255, 255, 255, .075);
  --chip-bg: rgba(255, 255, 255, .05);
  --stroke: rgba(255, 255, 255, .085);
  --stroke-hi: rgba(255, 255, 255, .2);
  --text: #eef1f8;
  --text-2: #b3bcd0;
  --muted: #838da6;
  --accent: #7c9cff;
  --accent-2: #a78bfa;
  --accent-3: #4ee0d0;
  --glow: rgba(124, 156, 255, .38);
  --card-shadow: 0 22px 44px -30px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .055);
  --ico-bg: rgba(255, 255, 255, .92);
  --aurora-op: 1;
  --grain-op: .028;
  --ok: #4ade80;
}

html[data-theme="light"] {
  --bg: #f2f5fb;
  --bg-bar: rgba(244, 247, 252, .8);
  --panel: #ffffff;
  --panel-hi: #ffffff;
  --chip-bg: #ffffff;
  --stroke: rgba(15, 23, 42, .075);
  --stroke-hi: rgba(79, 70, 229, .35);
  --text: #0b1220;
  --text-2: #414b63;
  --muted: #6f7889;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-3: #0891b2;
  --glow: rgba(99, 102, 241, .22);
  --card-shadow: 0 14px 32px -24px rgba(23, 34, 64, .55), inset 0 1px 0 rgba(255, 255, 255, .9);
  --ico-bg: #ffffff;
  --aurora-op: .55;
  --grain-op: .022;
  --ok: #16a34a;
}

/* ---------- 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

img { border: 0; display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- 背景光晕 ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--aurora-op);
}

.aurora span {
  position: absolute;
  display: block;
  width: clamp(240px, 58vmin, 620px);
  height: clamp(240px, 58vmin, 620px);
  border-radius: 50%;
  filter: blur(58px);
  will-change: transform;
}

.aurora .a1 {
  left: -16vmin;
  top: -20vmin;
  background: radial-gradient(circle at 50% 50%, rgba(72, 92, 255, .62) 0%, rgba(72, 92, 255, 0) 68%);
  animation: drift1 26s var(--ease) infinite alternate;
}

.aurora .a2 {
  right: -20vmin;
  top: -16vmin;
  background: radial-gradient(circle at 50% 50%, rgba(147, 76, 233, .48) 0%, rgba(147, 76, 233, 0) 70%);
  animation: drift2 32s var(--ease) infinite alternate;
}

.aurora .a3 {
  left: 26vw;
  bottom: -32vmin;
  background: radial-gradient(circle at 50% 50%, rgba(6, 182, 212, .26) 0%, rgba(6, 182, 212, 0) 72%);
  animation: drift3 29s var(--ease) infinite alternate;
}

html[data-theme="light"] .aurora span { filter: blur(66px); }
html[data-theme="light"] .aurora { --aurora-op: .7; }

@keyframes drift1 { to { transform: translate3d(6vw, 5vh, 0) scale(1.12); } }
@keyframes drift2 { to { transform: translate3d(-7vw, 7vh, 0) scale(1.08); } }
@keyframes drift3 { to { transform: translate3d(3vw, -6vh, 0) scale(1.15); } }

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--grain-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

@media (prefers-reduced-motion: reduce) {
  .aurora span { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 布局容器 ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: 18px;
  padding-right: 18px;
}

main.wrap { position: relative; z-index: 2; }

@media (min-width: 768px) {
  .wrap { padding-left: 28px; padding-right: 28px; }
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  padding-top: env(safe-area-inset-top, 0);
  border-bottom: 1px solid transparent;
  transition: background-color .35s var(--ease), border-color .35s var(--ease);
}

.topbar.is-scrolled {
  background: var(--bg-bar);
  border-bottom-color: var(--stroke);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
}

.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 12px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  overflow: hidden;
  box-shadow: 0 8px 20px -10px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: .18em;
  color: var(--muted);
  margin-top: 3px;
}

.topbar-act { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text-2);
  transition: color .25s, border-color .25s, transform .25s, background .25s;
}

.icon-btn svg { width: 18px; height: 18px; }
html[data-theme="dark"] .ic-sun { display: none; }
html[data-theme="light"] .ic-moon { display: none; }
.icon-btn:hover { color: var(--text); border-color: var(--stroke-hi); background: var(--panel-hi); }
.icon-btn:active { transform: scale(.94); }

/* ---------- Hero ---------- */
.hero { padding: 34px 0 6px; animation: rise .6s var(--ease-out) both; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .2em;
  color: var(--muted);
  text-transform: uppercase;
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(74, 222, 128, .6);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.hero-title {
  margin: 0;
  font-size: clamp(27px, 7.6vw, 44px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.035em;
}

.grad {
  background: linear-gradient(104deg, var(--accent) 6%, var(--accent-2) 52%, var(--accent-3) 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text-2);
  max-width: 34em;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  font-size: 11.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

.meta-pill svg { width: 13px; height: 13px; opacity: .7; }
.meta-pill.ghost { color: var(--muted); background: transparent; border-style: dashed; }

/* ---------- 搜索 ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  margin-top: 22px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--card-shadow);
  transition: border-color .25s, box-shadow .25s, background .25s;
}

.search:focus-within {
  border-color: var(--stroke-hi);
  box-shadow: 0 0 0 4px var(--glow), var(--card-shadow);
}

.search-ico { width: 18px; height: 18px; flex: 0 0 18px; color: var(--muted); }

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  letter-spacing: .01em;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }

.search-kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 1px 6px;
  line-height: 1.6;
}

.search-clear {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--chip-bg);
  border: 1px solid var(--stroke);
  color: var(--text-2);
}

.search-clear svg { width: 12px; height: 12px; }
.search-clear[hidden] { display: none; }

@media (max-width: 520px) {
  .search-kbd { display: none; }
}

/* ---------- 分类胶囊 ---------- */
.chips {
  position: sticky;
  top: calc(60px + env(safe-area-inset-top, 0px));
  z-index: 40;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 16px -18px 0;
  padding: 10px 18px;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color .3s var(--ease), border-color .3s var(--ease), box-shadow .3s;
}

.chips.is-stuck {
  background: var(--bg-bar);
  border-bottom-color: var(--stroke);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 12px 28px -24px rgba(0, 0, 0, .9);
}

@media (min-width: 768px) {
  .chips { margin-left: -28px; margin-right: -28px; padding-left: 28px; padding-right: 28px; }
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--chip-bg);
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  transition: color .22s, background .22s, border-color .22s, transform .22s, box-shadow .22s;
}

.chip-n {
  font-size: 10.5px;
  opacity: .55;
  font-variant-numeric: tabular-nums;
}

.chip:hover { color: var(--text); border-color: var(--stroke-hi); }
.chip:active { transform: scale(.96); }

.chip.is-on {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 22px -12px var(--glow);
}

.chip.is-on .chip-n { opacity: .8; }

/* ---------- 搜索结果提示 ---------- */
.result-hint {
  margin: 16px 0 -6px;
  font-size: 12px;
  color: var(--muted);
}

.result-hint b { color: var(--text-2); font-weight: 600; }

/* ---------- 分区 ---------- */
.sec { margin-top: 30px; animation: rise .55s var(--ease-out) both; }
.sec.is-hidden { display: none; }

.sec-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sec-head h2 {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
}

.sec-idx {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .06em;
}

.sec-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--stroke), transparent);
}

.sec-count {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 卡片网格 ---------- */
/* 手机上单列：描述能完整显示，点击区域也更大；平板起改为多列网格 */
.grid {
  display: grid;
  gap: 9px;
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .grid { gap: 11px; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); }
}

@media (min-width: 980px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); }
}

.grid-pin { grid-template-columns: 1fr; }

@media (min-width: 560px) {
  .grid-pin { grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); }
}

/* ---------- 站点卡片 ---------- */
.site {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--card-shadow);
  color: inherit;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: transform .28s var(--ease), border-color .28s, background .28s, box-shadow .28s;
}

.site::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(150px 110px at 12% 0%, var(--glow), transparent 72%);
  opacity: 0;
  transition: opacity .35s var(--ease);
  pointer-events: none;
}

.site > * { position: relative; z-index: 1; }

@media (hover: hover) {
  .site:hover {
    transform: translateY(-3px);
    border-color: var(--stroke-hi);
    background: var(--panel-hi);
    box-shadow: 0 26px 50px -30px rgba(0, 0, 0, .8);
  }
  .site:hover::after { opacity: .55; }
  .site:hover .site-go { opacity: 1; transform: translate(0, 0); }
}

.site:active { transform: scale(.982); }

.site-ico {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: var(--ico-bg);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(127, 140, 170, .14), 0 4px 10px -6px rgba(0, 0, 0, .6);
}

.site-ico img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.site-ico img.is-broken { display: none; }

.site-ico i {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  letter-spacing: 0;
}

.site-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }

.site-name {
  font-size: 14.2px;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-desc {
  margin-top: 2px;
  font-size: 11.9px;
  line-height: 1.45;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-go {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: var(--muted);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity .28s, transform .28s;
}

@media (hover: none) {
  .site-go { opacity: .3; transform: none; }
}

/* 手机上描述允许两行，信息更完整 */
@media (max-width: 559px) {
  .site-name { font-size: 14.6px; }
  .site-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* 置顶卡片更宽松，并加一圈渐变描边以区分层级 */
.site-pin {
  padding: 15px 14px;
  gap: 12px;
  border-color: transparent;
  background: var(--panel-hi);
}

.site-pin::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(118deg,
    rgba(124, 156, 255, .62),
    rgba(167, 139, 250, .3) 44%,
    rgba(255, 255, 255, .05) 78%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

html[data-theme="light"] .site-pin::before {
  background: linear-gradient(118deg,
    rgba(79, 70, 229, .5),
    rgba(124, 58, 237, .22) 46%,
    rgba(15, 23, 42, .06) 80%);
}

.site-pin .site-ico { width: 44px; height: 44px; flex-basis: 44px; border-radius: 13px; }
.site-pin .site-ico img { padding: 7px; }
.site-pin .site-name { font-size: 14.9px; }
.site-pin .site-desc { font-size: 12.1px; }
.site-pin .site-go { opacity: .45; transform: none; }

.pinned-sec .sec-head h2 { color: var(--text); }

/* ---------- 空状态 ---------- */
.empty {
  margin-top: 40px;
  padding: 46px 20px;
  text-align: center;
  border: 1px dashed var(--stroke);
  border-radius: var(--r-lg);
  background: var(--panel);
}

.empty[hidden] { display: none; }
.empty-ico { color: var(--muted); margin-bottom: 12px; }
.empty-ico svg { width: 30px; height: 30px; margin: 0 auto; }
.empty p { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.empty span { font-size: 12.5px; color: var(--muted); display: block; }

.btn-ghost {
  margin-top: 18px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--chip-bg);
  color: var(--text-2);
  font-size: 13px;
  transition: color .22s, border-color .22s;
}

.btn-ghost:hover { color: var(--text); border-color: var(--stroke-hi); }

/* ---------- 页脚 ---------- */
.foot {
  margin-top: 54px;
  padding: 26px 0 calc(38px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--stroke);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
}

.foot p { margin: 0; }
.foot-sub { font-size: 11.5px; opacity: .85; }
.foot a { color: var(--muted); transition: color .2s; }
.foot a:hover { color: var(--accent); }
.dot { margin: 0 7px; opacity: .5; }

/* 页脚联系邮箱 */
.foot a.foot-mail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--card-shadow);
  color: var(--text-2);
  font-size: 12.5px;
  letter-spacing: .015em;
  transition: color .22s var(--ease), border-color .22s, background .22s, transform .22s;
}

.foot-mail svg { width: 14px; height: 14px; opacity: .7; flex: 0 0 14px; }

.foot a.foot-mail:hover {
  color: var(--text);
  border-color: var(--stroke-hi);
  background: var(--panel-hi);
  transform: translateY(-1px);
}

.foot-mail:active { transform: scale(.98); }

@media (hover: none) {
  .foot a.foot-mail { padding: 10px 18px; }
}

/* ---------- 回到顶部 ---------- */
.totop {
  position: fixed;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--bg-bar);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text-2);
  box-shadow: var(--card-shadow);
  opacity: 0;
  transform: translateY(10px) scale(.9);
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease), color .2s;
}

.totop svg { width: 18px; height: 18px; }
.totop.is-show { opacity: 1; transform: none; pointer-events: auto; }
.totop:hover { color: var(--text); }

/* ---------- 入场动画 ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero, .sec { animation: none; }
  .site, .totop { transition: none; }
}

/* 搜索时置顶区若无匹配会自动隐藏（由脚本控制） */
