/* ============================================================
 * style.css — 开发者导航站
 * 默认浅色主题，支持 [data-theme="dark"] 深色主题
 * ============================================================ */

/* 智博程序园主题：取自 Logo 的青绿 → 紫渐变 */
:root {
  --bg: #f4f9fa;
  --bg-soft: #eaf3f5;
  --surface: #ffffff;
  --surface-2: #fafdfe;
  --text: #10222a;
  --text-2: #3f5a64;
  --muted: #7e97a0;
  --border: #dfeaec;
  --border-2: #e9f2f4;
  --accent: #0e9fb2;
  --accent-2: #9a7fd1;
  --accent-soft: #e2f5f8;
  --star: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(19, 22, 41, .05);
  --shadow: 0 6px 20px -8px rgba(19, 22, 41, .14);
  --shadow-lg: 0 18px 50px -20px rgba(19, 22, 41, .28);
  --radius: 13px;
  --radius-sm: 10px;
  --header-h: 60px;
  --page-pad: 14px;
  --page-max: 1600px;
}

[data-theme="dark"] {
  --bg: #0c1417;
  --bg-soft: #121c20;
  --surface: #152025;
  --surface-2: #19262c;
  --text: #ecf4f6;
  --text-2: #aec6cd;
  --muted: #6f8b94;
  --border: #24363d;
  --border-2: #1d2c32;
  --accent: #3cc7d8;
  --accent-2: #b79ae8;
  --accent-soft: #10333a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 6px 20px -8px rgba(0, 0, 0, .6);
  --shadow-lg: 0 18px 50px -20px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
.hide { display: none !important; }

/* ---------------- 顶部导航 ---------------- */
.header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border-2);
}
.header-inner {
  max-width: var(--page-max); margin: 0 auto; height: 100%;
  padding: 0 var(--page-pad);
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-logo {
  position: relative;
  width: 32px; height: 32px; border-radius: 9px; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: 0 6px 14px -6px var(--accent);
}
.brand-logo img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; border-radius: inherit;
}
.brand-text { font-weight: 700; font-size: 15.5px; letter-spacing: .2px; white-space: nowrap; }
.brand-text em {
  font-style: normal; font-weight: 500; font-size: 11.5px;
  color: var(--muted); margin-left: 5px; letter-spacing: .5px;
}

.topnav { display: flex; gap: 2px; }
.topnav-item {
  padding: 6px 13px; border-radius: 8px; color: var(--text-2);
  font-weight: 500; font-size: 13.5px; transition: .18s; position: relative;
}
.topnav-item:hover { background: var(--bg-soft); color: var(--text); }
.topnav-item.is-active { background: var(--accent-soft); color: var(--accent); }
.topnav-item .badge {
  display: inline-block; min-width: 18px; padding: 0 5px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600;
  border-radius: 20px; line-height: 18px; text-align: center; vertical-align: 1px;
}

.header-search {
  flex: 1; max-width: 420px; margin-left: auto;
  display: flex; align-items: center; gap: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px; transition: .2s;
}
.header-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.engine-select {
  border: none; background: transparent; color: var(--text-2);
  font-size: 13px; padding: 6px 6px 6px 10px; border-radius: 8px; outline: none;
  cursor: pointer; max-width: 92px;
}
.engine-select:hover { background: var(--bg-soft); }
.header-search input {
  flex: 1; border: none; background: transparent; outline: none;
  padding: 7px 8px; min-width: 0;
}
.header-search input::placeholder { color: var(--muted); }
.hsearch-btn {
  width: 30px; height: 30px; border-radius: 8px; color: var(--muted);
  display: grid; place-items: center; font-size: 14px; transition: .18s;
}
.hsearch-btn:hover { background: var(--accent); color: #fff; }

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; font-size: 15px;
  color: var(--text-2); display: grid; place-items: center; transition: .18s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

.btn {
  border-radius: 10px; padding: 9px 18px; font-weight: 600; font-size: 13.5px;
  transition: .18s; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 8px 18px -8px var(--accent);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -8px var(--accent); }
.btn-ghost { background: var(--bg-soft); color: var(--text-2); padding: 7px 14px; }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-block { width: 100%; padding: 11px; }

/* ---------------- Hero ---------------- */
.hero { position: relative; overflow: hidden; padding: 30px var(--page-pad) 24px; }
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(680px 220px at 18% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(620px 240px at 84% 12%, color-mix(in srgb, var(--accent-2) 11%, transparent), transparent 72%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 820px; margin: 0 auto; text-align: center; }
.hero-title {
  font-size: clamp(24px, 2.6vw, 31px); line-height: 1.25; margin: 0 0 8px; letter-spacing: -.5px;
  background: linear-gradient(120deg, var(--text) 20%, var(--accent) 60%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--text-2); margin: 0 0 18px; font-size: 14px; }
.hero-sub b { color: var(--accent); }

.hero-search {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 7px; box-shadow: var(--shadow);
}
.hero-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.hero-search input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 10px 11px; font-size: 14.5px; min-width: 0;
}
.hero-search .btn-primary { padding: 11px 24px; }

.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
  max-height: 340px; overflow-y: auto; text-align: left;
}
.suggest-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; transition: .14s;
}
.suggest-item:hover, .suggest-item.is-on { background: var(--accent-soft); }
.suggest-item .si-name { font-weight: 600; }
.suggest-item .si-desc { color: var(--muted); font-size: 12.5px; }
.suggest-item .si-key { margin-left: auto; color: var(--muted); font-size: 12px; }

.hero-tags { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 14px; }
.htag {
  padding: 5px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  transition: .18s;
}
.htag:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* ---------------- 布局 ---------------- */
.layout {
  max-width: var(--page-max); margin: 0 auto;
  padding: 6px var(--page-pad) 64px;
  display: grid; grid-template-columns: 214px 1fr; gap: 18px; align-items: start;
}

/* 侧栏：靠边、紧凑 */
.sidebar {
  position: sticky; top: calc(var(--header-h) + 12px);
  display: flex; flex-direction: column; gap: 12px;
}
.side-card {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 11px 10px; box-shadow: var(--shadow-sm);
}
.side-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
  color: var(--muted); padding: 2px 7px 8px;
}
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; max-height: 58vh; overflow-y: auto; }
.cat-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 13px;
  transition: .16s; width: 100%; text-align: left;
}
.cat-item:hover { background: var(--bg-soft); color: var(--text); }
.cat-item.is-active, .cat-item.is-spy { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cat-item .ci-icon { font-size: 14px; }
.cat-item .ci-count {
  margin-left: auto; font-size: 11px; color: var(--muted);
  background: var(--bg-soft); padding: 0 6px; border-radius: 20px;
}
.cat-item.is-active .ci-count, .cat-item.is-spy .ci-count { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

.tip-list { list-style: none; margin: 0; padding: 0 8px; display: flex; flex-direction: column; gap: 9px; color: var(--text-2); font-size: 12.5px; }
kbd {
  background: var(--bg-soft); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 6px; font-size: 11px; font-family: ui-monospace, monospace;
}

/* 内容区 */
.content { min-width: 0; }
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 2px 2px 14px; position: sticky; top: var(--header-h); z-index: 20;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.toolbar-left { display: flex; align-items: baseline; gap: 9px; }
.toolbar-left h2 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
.view-count { color: var(--muted); font-size: 13px; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mini-select {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 9px; padding: 7px 10px; font-size: 13px; outline: none; cursor: pointer;
}
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.af {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
}
.af button { color: inherit; font-size: 12px; opacity: .7; }
.af button:hover { opacity: 1; }

/* 分类区块 */
.section { margin-bottom: 22px; }
.section-head { display: flex; align-items: center; gap: 9px; margin: 0 2px 10px; }
.section-head .sh-icon {
  width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center;
  font-size: 14px; background: var(--bg-soft);
}
.section-head h3 { margin: 0; font-size: 15.5px; }
.section-head .sh-count { color: var(--muted); font-size: 12.5px; }
.section-head .sh-desc {
  color: var(--muted); font-size: 12px; font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; flex-shrink: 1;
}
.section-head .sh-more { margin-left: auto; color: var(--accent); font-size: 12.5px; font-weight: 600; flex-shrink: 0; }
@media (max-width: 1180px) { .section-head .sh-desc { display: none; } }

.grid {
  display: grid; gap: 11px;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
}

/* 网站卡片 */
.card {
  position: relative; display: flex; gap: 10px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 11px;
  box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--card-accent, var(--accent)); opacity: 0; transition: .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 40%, var(--border)); }
.card:hover::before { opacity: 1; }

.card-icon {
  position: relative; flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .4px;
}
.card-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface); }
.card-icon span { position: relative; z-index: 1; }

.card-body { min-width: 0; flex: 1; }
.card-top { display: flex; align-items: center; gap: 6px; }
.card-name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-desc {
  color: var(--muted); font-size: 12px; margin: 2px 0 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.ctag {
  position: relative; z-index: 3;
  font-size: 11px; padding: 1px 7px; border-radius: 6px;
  background: var(--bg-soft); color: var(--text-2); transition: .16s;
}
.ctag:hover { background: var(--accent-soft); color: var(--accent); }

.card-fav {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; border-radius: 8px; font-size: 14px;
  display: grid; place-items: center; color: var(--muted); transition: .16s;
  background: var(--surface);
}
.card-fav:hover { background: var(--bg-soft); color: var(--star); transform: scale(1.12); }
.card-fav.is-fav { color: var(--star); }
.card-link {
  position: absolute; inset: 0; z-index: 2;
}
.card-fav { z-index: 3; }

/* 点赞投票 */
.card-like {
  position: absolute; top: 10px; right: 42px; z-index: 3;
  height: 28px; padding: 0 8px; border-radius: 8px; font-size: 12px;
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); background: var(--surface); transition: .16s;
}
.card-like:hover { background: var(--bg-soft); color: var(--accent); transform: scale(1.06); }
.card-like.is-liked { color: var(--accent); font-weight: 700; }

.stars-row { display: inline-flex; gap: 1px; color: var(--star); font-size: 11px; line-height: 1; }

/* 空状态 */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }

/* ---------------- 动效 ---------------- */
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
html.anim .card:not(.in) { opacity: 0; transform: translateY(14px); }
html.anim .card.in { animation: card-in .5s cubic-bezier(.2, .7, .3, 1); }
@keyframes sec-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
#sections.animate .section { animation: sec-in .24s ease both; }
@media (prefers-reduced-motion: reduce) {
  html.anim .card:not(.in) { opacity: 1; transform: none; }
  html.anim .card.in, #sections.animate .section { animation: none; }
}

/* 触屏设备：悬停不可用，操作按钮常显（并给标题留出空间） */
@media (hover: none) {
  .card-like { opacity: 1; }
  .card-top { padding-right: 40px; }
}

/* 首屏折叠 / 盲盒 */
#sections.is-limited .sec-extra { display: none; }
.more-cats-wrap { text-align: center; padding: 4px 0 14px; }
.more-cats-wrap .btn { padding: 9px 22px; }
.lucky-row { margin-top: 14px; }
.lucky-btn { color: var(--text-2); border: 1px dashed var(--border); }
.lucky-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------------- 网站排行榜 ---------------- */
.rank-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.rank-tab {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); transition: .16s;
}
.rank-tab:hover { border-color: var(--accent); color: var(--accent); }
.rank-tab.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-color: transparent; font-weight: 600;
}
.rank-sort {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-bottom: 12px; color: var(--muted); font-size: 12.5px;
}
.rank-chip {
  padding: 4px 12px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--bg-soft); color: var(--text-2); font-size: 12px; transition: .16s;
}
.rank-chip:hover { color: var(--accent); }
.rank-chip.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.rank-note { margin-left: auto; font-size: 11px; opacity: .8; }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; transition: .16s;
}
.rank-row:hover { border-color: var(--accent); transform: translateX(4px); box-shadow: var(--shadow-sm); }
.rk-no {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: var(--bg-soft); color: var(--text-2);
}
.rk-no.top1 { background: linear-gradient(135deg, #f7b733, #fc4a1a); color: #fff; }
.rk-no.top2 { background: linear-gradient(135deg, #b8c2cc, #8e9eab); color: #fff; }
.rk-no.top3 { background: linear-gradient(135deg, #d9a05b, #b06f2e); color: #fff; }
.rk-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; overflow: hidden; position: relative;
  display: grid; place-items: center; color: #fff; font-weight: 700;
}
.rk-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rk-main { min-width: 0; flex: 1; }
.rk-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.rk-hot {
  font-style: normal; font-size: 10px; color: #fff; padding: 1px 6px; border-radius: 6px;
  background: linear-gradient(135deg, #f7b733, #fc4a1a);
}
.rk-favmark { font-style: normal; color: var(--star); font-size: 12px; }
.rk-desc { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-cat { font-size: 12px; flex-shrink: 0; white-space: nowrap; }
.rk-heat { width: 150px; flex-shrink: 0; }
.rk-bar { height: 6px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; margin-bottom: 4px; }
.rk-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.rk-heat span { font-size: 11px; color: var(--text-2); }
.rk-traffic { width: 92px; flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.rk-traffic em { font-style: normal; display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; }
.rk-rec { width: 112px; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rk-stars { color: var(--star); font-size: 11px; white-space: nowrap; }
.rk-badge { font-style: normal; font-size: 10.5px; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.rk-badge.r5 { background: #fde68a; color: #92400e; }
.rk-badge.r4 { background: var(--accent-soft); color: var(--accent); }
.rk-badge.r3 { background: var(--bg-soft); color: var(--text-2); }
.rk-badge.r2 { background: var(--bg-soft); color: var(--muted); }
/* 排行榜入场动效沿用区块动画 */
.rank-wrap .rank-row { animation: sec-in .3s ease both; }
@media (max-width: 960px) {
  .rk-cat, .rk-traffic { display: none; }
  .rk-heat { width: 100px; }
  .rk-rec { width: auto; }
  .rank-note { display: none; }
}
@media (max-width: 640px) {
  .rk-desc, .rk-heat { display: none; }
  .rank-row { gap: 10px; padding: 10px 12px; }
}
.empty-emoji { font-size: 46px; margin-bottom: 10px; }
.empty p { font-size: 16px; color: var(--text-2); margin: 0 0 4px; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16, 18, 32, .5); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative; width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 26px; box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px;
  border-radius: 8px; color: var(--muted); display: grid; place-items: center;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-note { color: var(--muted); font-size: 12.5px; margin: 0 0 18px; line-height: 1.5; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); outline: none; transition: .18s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 11px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 200;
  opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.to-top {
  position: fixed; right: 28px; bottom: 28px; z-index: 90;
  width: 42px; height: 42px; border-radius: 12px; font-size: 17px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  box-shadow: var(--shadow); transition: .18s;
}
.to-top:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* ---------------- 响应式：PC → 平板 → 手机 ---------------- */

/* 大屏：内容区留白收窄，一屏多放内容 */
@media (min-width: 1600px) {
  :root { --page-pad: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); }
}

/* 中等屏：收紧侧栏与间距 */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 200px 1fr; gap: 16px; }
  .header-search { max-width: 300px; }
}
@media (max-width: 1024px) {
  .brand-text em { display: none; }
  .header-search { max-width: 240px; }
  .topnav-item { padding: 6px 10px; font-size: 13px; }
}

/* 平板 / 窄屏：侧栏转为顶部横滑胶囊条 */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 12px; padding-top: 2px; }
  .sidebar {
    position: static; max-height: none; flex-direction: row; gap: 0;
    overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--page-pad) * -1); padding: 0 var(--page-pad) 6px;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .side-card { background: none; border: none; box-shadow: none; padding: 0; min-width: 0; }
  .side-head, .side-tip { display: none; }
  .cat-list { flex-direction: row; flex-wrap: nowrap; gap: 6px; max-height: none; overflow: visible; }
  .cat-item {
    width: auto; white-space: nowrap; padding: 7px 12px; font-size: 13px;
    border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  }
  .cat-item.is-active, .cat-item.is-spy { border-color: transparent; }
  .cat-item .ci-count { display: none; }
  .header-search { display: none; }
}

/* 手机：头部改两行（导航与搜索均不丢失） */
@media (max-width: 720px) {
  :root { --header-h: 0px; }
  .header { height: auto; }
  .header-inner { flex-wrap: wrap; padding: 8px 12px 10px; gap: 8px; }
  .header-actions { margin-left: auto; }
  .topnav {
    order: 3; width: 100%; overflow-x: auto; gap: 2px; padding-bottom: 2px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav-item { padding: 6px 11px; font-size: 13px; white-space: nowrap; flex-shrink: 0; }
  .header-search { display: none; }

  .toolbar { position: static; padding: 0 0 10px; background: none; }
  .toolbar-right { width: 100%; margin-left: 0; gap: 8px; }
  .toolbar-right .mini-select { flex: 1; }

  .hero { padding: 26px 12px 22px; }
  .hero-sub { font-size: 12.5px; margin-bottom: 16px; }
  .hero-search { flex-wrap: wrap; gap: 8px; padding: 8px; }
  .hero-search input { order: 1; width: 100%; flex: none; padding: 9px 6px; font-size: 14px; }
  .hero-search .engine-select { order: 2; flex: 1; max-width: none; padding-left: 8px; }
  .hero-search .btn-primary { order: 3; flex: 0 0 auto; padding: 10px 20px; }
  .hero-tags { margin-top: 14px; gap: 6px; }
  .lucky-row { margin-top: 14px; }
  .lucky-btn { font-size: 12.5px; padding: 8px 14px; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 9px; }
  .section { margin-bottom: 22px; }
  .footer-inner { padding: 32px 12px 22px; }
  .to-top { right: 14px; bottom: 16px; width: 38px; height: 38px; }
  .toast { bottom: 20px; max-width: calc(100vw - 32px); text-align: center; }
}

/* 小屏手机：单列卡片、进一步压缩留白 */
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .card { padding: 10px; }
  .rank-row { padding: 9px 10px; gap: 8px; }
  .rk-icon, .rk-no { width: 30px; height: 30px; border-radius: 8px; font-size: 12px; }
  .qr-slot { width: 82px; height: 82px; }
}

@media (max-width: 380px) {
  .brand-text { font-size: 14px; }
  .hero-title { font-size: 22px; }
  .cat-item { padding: 6px 10px; font-size: 12.5px; }
}

/* ============================================================
 * 侧栏收缩
 * ============================================================ */
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; padding: 2px 4px 10px;
}
.side-head .side-title { padding: 0 4px; }
.collapse-btn {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px;
  color: var(--muted); font-size: 13px; line-height: 1;
  display: grid; place-items: center; transition: .18s;
}
.collapse-btn:hover { background: var(--accent-soft); color: var(--accent); }
.cat-item .ci-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.layout.is-collapsed { grid-template-columns: 64px 1fr; gap: 18px; }
.layout.is-collapsed .side-head { justify-content: center; }
.layout.is-collapsed .side-head .side-title { display: none; }
.layout.is-collapsed .cat-item { justify-content: center; padding: 9px 0; }
.layout.is-collapsed .cat-item .ci-name,
.layout.is-collapsed .cat-item .ci-count { display: none; }
.layout.is-collapsed .cat-item .ci-icon { font-size: 17px; }
.layout.is-collapsed .side-tip { display: none; }
.layout.is-collapsed .side-card { padding: 10px 6px; }

/* ---------------- 跳转确认弹窗 ---------------- */
.modal-title { margin: 0 0 6px; font-size: 18px; }
.modal-jump { max-width: 380px; text-align: center; }
.modal-jump .modal-title { margin-top: 4px; }
.modal-jump .modal-close { position: absolute; top: 12px; right: 14px; }
.jump-icon {
  width: 52px; height: 52px; margin: 2px auto 10px; border-radius: 16px;
  display: grid; place-items: center; font-size: 24px;
  background: var(--accent-soft); color: var(--accent);
}
.jump-target {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; text-align: left;
}
.jump-name { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.jump-url {
  color: var(--accent); font-size: 12.5px; word-break: break-all;
  font-family: ui-monospace, Consolas, monospace;
}
.jump-actions { display: flex; gap: 10px; }
.jump-actions .btn { flex: 1; padding: 10px; }
.jump-skip {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 14px; font-size: 12px; color: var(--muted); cursor: pointer;
}
.jump-skip input { accent-color: var(--accent); margin: 0; }

/* ============================================================
 * 底部：关于我们 / 联系方式留白区
 * ============================================================ */
.footer {
  margin-top: 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: var(--page-max); margin: 0 auto; padding: 36px var(--page-pad) 26px;
  display: grid; gap: 28px;
  grid-template-columns: 1.5fr .75fr .75fr 1.35fr;
}
.footer-col h4 {
  margin: 0 0 14px; font-size: 13px; font-weight: 700;
  letter-spacing: .6px; color: var(--text);
}
.footer-about p { margin: 0 0 12px; font-size: 13px; color: var(--text-2); line-height: 1.85; }
.footer-about .footer-meta { font-size: 12.5px; color: var(--muted); }
.footer-about b { color: var(--accent); }
.footer-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; margin-bottom: 18px;
}
.footer-brand em { font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.footer-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.footer-links a { font-size: 13px; color: var(--text-2); transition: .16s; }
.footer-links a:hover { color: var(--accent); }

/* 访问统计（不蒜子） */
.bsz-stat { color: var(--muted); font-size: 12.5px; }
.bsz-stat b { color: var(--accent); font-weight: 700; }

.qr-row { display: flex; gap: 10px; flex-wrap: wrap; }
.qr-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qr-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.qr-slot {
  position: relative; width: 92px; height: 92px;
  border-radius: 12px; border: 1.5px dashed var(--border-2);
  background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden;
}
.qr-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.qr-ph {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted); text-align: center; line-height: 1.4;
}
.qr-ph i {
  font-style: normal; font-size: 18px; color: var(--border-2);
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px dashed var(--border-2); display: grid; place-items: center;
}
.contact-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.contact-list li { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.contact-link { color: var(--accent); text-decoration: none; }
.contact-link:hover { text-decoration: underline; }
.contact-list .ci {
  width: 18px; text-align: center; color: var(--accent);
  font-size: 12px; flex-shrink: 0;
}
.contact-list b { font-weight: 500; }
.blank {
  background: var(--bg-soft); border-radius: 5px; padding: 1px 6px;
  color: var(--muted); font-weight: 500;
}
.qr-note { font-size: 11.5px; color: var(--muted); margin: 14px 0 0; line-height: 1.7; }
.qr-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-soft); border-radius: 4px; padding: 1px 4px; font-size: 11px;
}

.footer-bottom {
  border-top: 1px solid var(--border-2);
  max-width: var(--page-max); margin: 0 auto; padding: 16px var(--page-pad) 22px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
}
.footer-bottom a { color: var(--text-2); }
.footer-bottom a:hover { color: var(--accent); }
.to-top-link { margin-left: auto; font-weight: 600; }

.si-main { min-width: 0; display: flex; flex-direction: column; }
.si-desc { font-style: normal; color: var(--muted); font-size: 12.5px; }

@media (max-width: 1180px) {
  .footer-inner { grid-template-columns: 1.3fr 1fr 1fr; }
  .footer-contact { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 22px; }
  .footer-about { grid-column: 1 / -1; }
  /* 横滑胶囊模式下取消收缩态的特殊样式 */
  .layout.is-collapsed { grid-template-columns: 1fr; }
  .layout.is-collapsed .side-card { min-width: 0; padding: 0; }
  .layout.is-collapsed .cat-item { justify-content: flex-start; padding: 7px 12px; }
  .layout.is-collapsed .cat-item .ci-name { display: block; }
  .layout.is-collapsed .cat-item .ci-count { display: none; }
  .layout.is-collapsed .side-tip { display: none; }
}
@media (max-width: 640px) {
  .footer-inner { grid-template-columns: 1fr; padding: 30px 12px 22px; }
  .footer-bottom { padding: 14px 12px 20px; }
  .to-top-link { margin-left: 0; }
}
