/* ---------- 主题变量 ---------- */
html {
  --maxw: 1060px;
  --radius: 14px;
}

html[data-theme="light"] {
  --bg: #f3f4f6;
  --bg-grad:
    radial-gradient(1200px 620px at 10% -12%, #ffffff, transparent 62%),
    radial-gradient(900px 520px at 102% -6%, #e7eefa, transparent 58%);
  --card: #ffffff;
  --text: #10151b;
  --muted: #5f6b7a;
  --faint: #98a3b0;
  --line: #e4e8ed;
  --line-strong: #cfd7e0;
  --accent: #0a66c2;
  --accent-soft: #e8f1fc;
  --ico-bg: #f2f5f9;
  --shadow: 0 1px 2px rgba(16, 21, 27, .05);
  --shadow-hover: 0 10px 26px rgba(16, 21, 27, .10);
}

html[data-theme="dark"] {
  --bg: #0b0e13;
  --bg-grad:
    radial-gradient(1100px 600px at 8% -12%, #17212d, transparent 62%),
    radial-gradient(820px 500px at 102% -6%, #101a25, transparent 56%);
  --card: #121820;
  --text: #e6ebf1;
  --muted: #8d99a6;
  --faint: #6b7683;
  --line: #1e2630;
  --line-strong: #2c3644;
  --accent: #4c9aff;
  --accent-soft: #13202f;
  --ico-bg: #182130;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-hover: 0 12px 30px rgba(0, 0, 0, .55);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}

.sprite { display: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
}

.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.clock {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.theme-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.theme-btn:hover { color: var(--accent); border-color: var(--accent); }
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-btn svg { width: 17px; height: 17px; }

/* ---------- 主体 ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 58px 24px 72px;
}

.hero h1 {
  margin: 0 0 9px;
  font-size: 33px;
  font-weight: 650;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.sub {
  margin: 0 0 26px;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- 搜索框 ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  padding: 0 10px 0 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .16s, box-shadow .16s;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}

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

.engine {
  flex: none;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.engine:hover { color: var(--accent); border-color: var(--accent); }
.engine:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 分组 ---------- */
.group { margin-top: 46px; }

.group h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted);
}

.group h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.count { color: var(--faint); font-weight: 400; }

.grid {
  display: grid;
  /* auto-fit 会把多余的空轨道折掉，让末行的卡片拉宽铺满整行；
     若改用 auto-fill，卡片不够时右边会留空位 */
  grid-template-columns: repeat(auto-fit, minmax(234px, 1fr));
  gap: 12px;
}

/* ---------- 卡片 ---------- */
.card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--line-strong);
}

.card:active { transform: translateY(0); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 没填 url 的卡片：不跳转、不变手型，避免误点把页面刷回顶部 */
.card.is-static { cursor: default; }
.card.is-static:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--line);
}
.card.is-static:hover .ico { background: var(--ico-bg); }

.ico {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--ico-bg);
  color: var(--accent);
  transition: background .16s;
}

.card:hover .ico { background: var(--accent-soft); }
.ico svg { width: 19px; height: 19px; }

.meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.t {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.d {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 页脚 ---------- */
footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 44px;
  font-size: 12.5px;
  color: var(--faint);
}

.icp {
  margin-left: auto;
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}

.icp:hover {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.icp:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .topbar { padding: 16px 16px 0; }
  main { padding: 38px 16px 56px; }
  .hero h1 { font-size: 25px; }
  .sub { font-size: 13.5px; margin-bottom: 20px; }
  .search { height: 48px; }
  .group { margin-top: 34px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .card { padding: 12px; gap: 10px; }
  .ico { width: 34px; height: 34px; }
  footer { padding: 0 16px 32px; gap: 6px 16px; }
  .icp { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  body, .card, .ico, .search, .theme-btn { transition: none; }
  .card:hover { transform: none; }
}
