:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6ea;
  --text: #1c2024;
  --text-2: #5b626b;
  --text-3: #8a929c;
  --accent: #1f8a4c;
  --accent-2: #185fa5;
  --free: #0f6e56;
  --free-bg: #e1f5ee;
  --quota: #854f0b;
  --quota-bg: #faedda;
  --oss: #534ab7;
  --oss-bg: #eeedfe;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
}
[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e8eaed;
  --text-2: #aeb6c0;
  --text-3: #7a828d;
  --accent: #4fd07f;
  --accent-2: #378add;
  --free: #5dcaa5;
  --free-bg: #0f3329;
  --quota: #ef9f27;
  --quota-bg: #3a2c0c;
  --oss: #afa9ec;
  --oss-bg: #221f3d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar { display: flex; align-items: center; gap: 16px; padding: 14px 0; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; }
.logo .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 800;
}
.logo small { color: var(--text-3); font-weight: 400; font-size: 12px; }
.search { flex: 1; position: relative; max-width: 520px; margin: 0 auto; min-width: 200px; }
.search input {
  width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); padding: 0 14px 0 38px; font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--accent-2); }
.search svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--text-3); }
.theme-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 16px; flex: none;
}
.theme-btn:hover { color: var(--text); }

.hero { padding: 38px 0 22px; text-align: center; }
.hero h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: -.5px; }
.hero p { color: var(--text-2); margin: 0 auto; max-width: 640px; font-size: 15px; }
.stats { display: flex; justify-content: center; gap: 30px; margin-top: 20px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat b { font-size: 22px; color: var(--accent); display: block; }
.stat span { font-size: 12px; color: var(--text-3); }

.note { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; font-size: 13px; color: var(--text-2); }

.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 6px 0 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; transition: .15s;
}
.tab:hover { border-color: var(--accent-2); color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.spacer { flex: 1; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
select.sort { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; outline: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding-bottom: 40px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  transition: transform .12s, border-color .12s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.card .row1 { display: flex; align-items: center; gap: 10px; }
.card .avatar { width: 38px; height: 38px; border-radius: 9px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; }
.card .name { font-weight: 600; font-size: 15px; }
.card .cat { font-size: 11px; color: var(--text-3); }
.card .desc { font-size: 13px; color: var(--text-2); min-height: 38px; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; color: var(--text-3); background: var(--surface-2); padding: 3px 8px; border-radius: 6px; }
.card .row2 { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.badge.free { color: var(--free); background: var(--free-bg); }
.badge.quota { color: var(--quota); background: var(--quota-bg); }
.badge.oss { color: var(--oss); background: var(--oss-bg); }
.card .go { font-size: 12px; color: var(--accent-2); font-weight: 600; }
.hot { font-size: 10px; color: #fff; background: #d85a30; padding: 1px 6px; border-radius: 5px; margin-left: 6px; vertical-align: middle; }
.empty { grid-column: 1/-1; text-align: center; color: var(--text-3); padding: 60px 0; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; margin: 4px 0 14px; }
.section-title .date { font-size: 12px; color: var(--text-3); font-weight: 400; }
.section-title .refresh-btn { margin-left: auto; font-size: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.section-title .refresh-btn:hover { color: var(--text); }
.today-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 26px; }

footer { border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--text-3); font-size: 12px; }
footer a { color: var(--accent-2); }

/* ===== 顶部导航（教程 + 提交） ===== */
.topnav { display: flex; align-items: center; gap: 10px; flex: none; }
.nav-link {
  font-size: 13px; color: var(--text-2); padding: 7px 10px; border-radius: 8px;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.submit-btn {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-size: 13px; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600;
  white-space: nowrap; transition: .15s;
}
.submit-btn:hover { filter: brightness(1.06); }

/* ===== 本周热门 TOP 10 榜单 ===== */
.rank-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px 16px; margin-bottom: 26px;
}
.rank-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.rank-row:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.rank-no {
  width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: var(--text-2); background: var(--surface-2);
}
.rank-row.top1 .rank-no { background: #f6c544; color: #5a3d00; }
.rank-row.top2 .rank-no { background: #cfd6df; color: #3a4250; }
.rank-row.top3 .rank-no { background: #e0a06a; color: #4a2c00; }
.avatar.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; flex: none; }
.rank-main { flex: 1; min-width: 0; }
.rank-main .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-main .cat { font-size: 11px; color: var(--text-3); }
.rank-row .go { font-size: 13px; color: var(--accent-2); font-weight: 600; flex: none; }

/* ===== 提交收录 弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,12,16,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative; width: min(440px, 100%); background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 92vh; overflow: auto;
}
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.modal-sub { margin: 0 0 14px; font-size: 13px; color: var(--text-2); }
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--text); }
#submitForm { display: flex; flex-direction: column; gap: 12px; }
#submitForm label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-2); }
#submitForm input, #submitForm select {
  height: 40px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2);
  color: var(--text); padding: 0 12px; font-size: 14px; outline: none; font-family: inherit;
}
#submitForm input:focus, #submitForm select:focus { border-color: var(--accent-2); }
.submit-send {
  height: 44px; border: none; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 2px;
}
.submit-send:hover { filter: brightness(1.06); }
.form-msg { min-height: 18px; font-size: 13px; color: var(--accent); margin: 0; text-align: center; }

@media (max-width: 560px) {
  .topnav .nav-link { display: none; }
  .rank-list { grid-template-columns: 1fr; }
}

/* ===== 返回顶部悬浮按钮 ===== */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--accent); color: #fff;
  border: none; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s, transform .25s, visibility .25s, filter .15s;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { filter: brightness(1.08); }
.to-top svg { width: 20px; height: 20px; }
@media (max-width: 560px) {
  .to-top { right: 14px; bottom: 14px; width: 42px; height: 42px; }
}

/* ===== 卡片角标 / 投票 / 收藏 ===== */
.card { position: relative; }
.badge.new { color: #fff; background: #d85a30; }
.badge.limited { color: #fff; background: #b8881f; }
.vote { font-size: 11px; color: var(--text-2); background: var(--surface-2); padding: 3px 9px; border-radius: 999px; }
.fav-toggle {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--border);
  color: var(--text-3); cursor: pointer; font-size: 17px; line-height: 1; user-select: none;
}
.fav-toggle:hover { color: #e0a93b; border-color: #e0a93b; }
.fav-toggle.on { color: #e0a93b; border-color: #e0a93b; background: #fff6e2; }

/* 今日推荐分享按钮 */
.share-btn {
  margin-left: auto; font-size: 12px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.share-btn:hover { color: var(--text); border-color: var(--accent); }

/* 我的收藏筛选按钮 */
.fav-filter {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; transition: .15s; white-space: nowrap;
}
.fav-filter:hover { border-color: #e0a93b; color: var(--text); }
.fav-filter.active { background: #e0a93b; border-color: #e0a93b; color: #fff; }
