/* dsh-suite 目录站 · 深色主题
   主强调色对齐 DeepSeek 品牌蓝 (#4d6bfe)；绿色保留为次强调/成功态。 */

:root {
  --bg: #0b0f1a;
  --bg-soft: #0f1526;
  --surface: #151d2e;
  --surface-2: #1a2438;
  --border: #243044;
  --border-soft: #1c2739;
  --text: #e6eaf2;
  --muted: #94a3b8;
  --faint: #64748b;

  /* DeepSeek 品牌蓝 —— 主强调色 */
  --brand: #4d6bfe;
  --brand-bright: #7b96ff;
  --brand-deep: #3b57d6;
  --brand-soft: rgba(77, 107, 254, .16);

  /* 次强调 / 语义色 */
  --green: #34d399;   /* 成功 / compat-ok */
  --yellow: #facc15;  /* star 数 */
  --blue: #60a5fa;    /* info / beta */
  --red: #f87171;     /* broken */
  --violet: #a78bfa;  /* language */

  --radius: 12px;
  --radius-sm: 8px;
  --radius-badge: 6px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .install-cmd { font-family: var(--font-mono); }
.hidden, [hidden] { display: none !important; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: rgba(11, 15, 26, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.brand {
  font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: var(--brand); color: #eef1ff; font-family: var(--font-mono); font-size: 15px;
}
.nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.nav-lang, .nav-gh { color: var(--muted); font-weight: 600; }
.nav-lang:hover, .nav-gh:hover { color: var(--text); text-decoration: none; }

/* ---------- hero ---------- */
.hero {
  max-width: 1120px; margin: 0 auto;
  padding: 60px 24px 44px;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 48px;
  align-items: center;
}
.hero-text { text-align: left; }
.slogan {
  font-size: clamp(30px, 5.2vw, 52px);
  font-weight: 800; letter-spacing: -.02em; line-height: 1.1;
  margin: 0 0 16px;
  background: linear-gradient(90deg, #e6eaf2 0%, var(--brand-bright) 55%, var(--brand) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle {
  max-width: 560px; margin: 0 0 28px;
  color: var(--muted); font-size: 17px; line-height: 1.55;
}
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.hbadge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 600;
  transition: border-color .15s;
}
a.hbadge:hover { border-color: var(--brand); text-decoration: none; }
.hbadge-accent { border-color: var(--brand); color: var(--brand-bright); background: var(--brand-soft); }
.hbadge-img { height: 27px; border-radius: 999px; display: inline-block; }
.hero-cta { margin-top: 4px; }
.cta-cmd {
  display: inline-block; padding: 8px 16px; border-radius: 8px;
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--brand-bright); font-size: 13px;
}

/* mascot card —— 浅色图经径向遮罩融入深色主题 */
.mascot-card {
  position: relative; margin: 0; padding: 8px;
  border-radius: 20px; border: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 36%, var(--brand-soft), transparent 72%),
    var(--surface);
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: var(--shadow);
}
.mascot-img {
  display: block; width: 100%; height: auto;
  border-radius: 14px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 52%, transparent 97%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 52%, transparent 97%);
}
.mascot-caption {
  margin: 10px 6px 6px;
  font-size: 13.5px; font-weight: 600; line-height: 1.4;
  color: var(--brand-bright); text-align: center;
}

/* ---------- controls ---------- */
.controls {
  max-width: 1200px; margin: 0 auto; padding: 8px 24px 24px;
  position: sticky; top: 57px; z-index: 40;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.controls-row { display: flex; gap: 12px; margin-bottom: 12px; }
#search {
  flex: 1; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
#search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
#search::placeholder { color: var(--faint); }
#sort {
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; outline: none; cursor: pointer;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #eef1ff; }
.result-count { margin: 12px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- sections ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 0 24px 64px; }
section { margin-bottom: 48px; }
.section-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.section-hint { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

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

/* ---------- card ---------- */
.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-soft);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.card:hover {
  border-color: var(--brand);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.card-featured {
  border-color: rgba(77, 107, 254, .5);
  background: linear-gradient(var(--surface), rgba(77, 107, 254, .06));
}
.card-watch { opacity: .82; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-name { font-size: 15px; font-weight: 700; color: var(--text); word-break: break-all; line-height: 1.35; }
.card-name:hover { color: var(--brand-bright); text-decoration: none; }
.card-ribbons { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.ribbon { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-badge); white-space: nowrap; }
.ribbon-featured { background: var(--brand-soft); color: var(--brand-bright); }
.ribbon-beta { background: rgba(96, 165, 250, .15); color: var(--blue); }

.card-desc { margin: 0; color: var(--muted); font-size: 13.5px; flex: 1; line-height: 1.5; }

.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); }
.card-meta-spacer { flex: 1; }
.card-stars { color: var(--yellow); font-weight: 600; }
.card-lang { color: var(--violet); }
.card-author { color: var(--faint); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-badge); font-size: 11px; font-weight: 600; }
.badge-compat-ok { background: rgba(52, 211, 153, .15); color: var(--green); }
.badge-compat-broken { background: rgba(248, 113, 113, .15); color: var(--red); }
.badge-compat-unknown { background: rgba(148, 163, 184, .14); color: var(--muted); }
.badge-compat-unmaintained { background: rgba(100, 116, 139, .2); color: var(--faint); }
.badge-watch.w-placeholder { background: rgba(148, 163, 184, .14); color: var(--muted); }
.badge-watch.w-toolchain { background: rgba(96, 165, 250, .15); color: var(--blue); }
.badge-watch.w-tagriding { background: rgba(248, 113, 113, .15); color: var(--red); }

.card-foot { display: flex; align-items: center; gap: 8px; }
.install-cmd {
  flex: 1; min-width: 0; padding: 6px 10px; border-radius: 6px;
  background: var(--bg-soft); border: 1px solid var(--border-soft);
  color: var(--brand-bright); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy-btn {
  padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: border-color .15s, color .15s;
}
.copy-btn:hover { border-color: var(--brand); color: var(--brand-bright); }
.copy-btn.copied { border-color: var(--green); color: var(--green); }
.repo-link { font-size: 12px; color: var(--muted); white-space: nowrap; }
.repo-link:hover { color: var(--text); }


.copy-btn.copy-badge { border-style: dashed; border-color: var(--border); }
.copy-btn.copy-badge:hover { border-color: var(--brand); color: var(--brand-bright); }

/* ---------- watchlist ---------- */
.watchlist details { border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; background: var(--bg-soft); }
.watchlist summary { cursor: pointer; font-weight: 700; font-size: 16px; color: var(--muted); }
.watchlist summary:hover { color: var(--text); }
.watchlist .grid { margin-top: 16px; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 40px 24px 56px; text-align: center; color: var(--faint); font-size: 13px;
}
.foot-about { max-width: 560px; margin: 0 auto 18px; line-height: 1.6; }
.foot-links {
  display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center;
  max-width: 720px; margin: 0 auto;
}
.foot-links a { color: var(--muted); font-weight: 600; }
.foot-links a:hover { color: var(--brand-bright); }

/* ---------- responsive ---------- */
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-text { text-align: center; }
  .subtitle { margin-left: auto; margin-right: auto; }
  .hero-badges { justify-content: center; }
  .mascot-card { max-width: 300px; margin: 0 auto; }
}
@media (max-width: 640px) {
  .site-header { padding: 10px 16px; }
  .hero { padding: 36px 16px 28px; }
  main { padding: 0 16px 48px; }
  .controls { padding: 8px 16px 20px; }
  .controls-row { flex-direction: column; }
  .grid { grid-template-columns: 1fr; }
  .foot-links { gap: 6px 14px; }
}


/* ---------- star leaderboard page ---------- */
.lb-page { max-width: 960px; margin: 0 auto; padding: 0 24px 64px; }
.lb-hero { padding: 48px 0 8px; }
.lb-back a { color: var(--muted); font-size: 14px; }
.lb-back a:hover { color: var(--brand-bright); }
.lb-title {
  font-size: clamp(28px, 5vw, 44px); font-weight: 800; letter-spacing: -.02em; line-height: 1.12; margin: 8px 0 12px;
  background: linear-gradient(90deg, #e6eaf2, var(--brand-bright) 60%, var(--brand));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lb-subtitle { color: var(--muted); font-size: 15px; max-width: 640px; margin: 0; }

.lb-section { margin-top: 44px; }
.lb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.lb-stat {
  display: flex; flex-direction: column; gap: 4px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
}
.lb-stat-num { font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.lb-stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.lb-stat-accent { border-color: var(--brand); background: linear-gradient(var(--surface), var(--brand-soft)); }
.lb-stat-accent .lb-stat-num { color: var(--brand-bright); }

.lb-panel { padding: 18px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); }
.lb-panel-title { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 0 14px; }
.lb-chart { display: block; width: 100%; height: auto; }
.lb-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

.lb-rows { display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  transition: border-color .15s, transform .15s;
}
.lb-row:hover { border-color: var(--brand); transform: translateX(2px); }
.lb-rank { font-size: 15px; font-weight: 800; color: var(--faint); width: 32px; text-align: center; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.lb-rank-top { color: var(--yellow); }
.lb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-name { font-weight: 700; color: var(--text); font-size: 14.5px; word-break: break-all; }
.lb-name:hover { color: var(--brand-bright); text-decoration: none; }
.lb-desc { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-cat { font-size: 11px; font-weight: 700; color: var(--brand-bright); background: var(--brand-soft); padding: 2px 8px; border-radius: var(--radius-badge); white-space: nowrap; }
.lb-delta { font-size: 12px; font-weight: 700; color: var(--green); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-stars { font-size: 13px; font-weight: 700; color: var(--yellow); white-space: nowrap; font-variant-numeric: tabular-nums; }

.nav-lb { color: var(--muted); font-weight: 600; }
.nav-lb:hover { color: var(--brand-bright); text-decoration: none; }

@media (max-width: 640px) {
  .lb-page { padding: 0 16px 48px; }
  .lb-cat { display: none; }
  .lb-desc { white-space: normal; }
}


/* ---------- learn page ---------- */
.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.learn-card {
  display: flex; flex-direction: column; gap: 12px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  transition: border-color .18s, transform .18s, box-shadow .18s; color: var(--text); text-decoration: none;
}
.learn-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.learn-img { display: block; width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); }
.learn-body { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.learn-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.learn-name { font-weight: 700; font-size: 15px; color: var(--text); }
.learn-type { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-badge); white-space: nowrap; }
.learn-type-official { background: var(--brand-soft); color: var(--brand-bright); }
.learn-type-community { background: rgba(96, 165, 250, .15); color: var(--blue); }
.learn-type-paper { background: rgba(167, 139, 250, .15); color: var(--violet); }
.learn-desc { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; flex: 1; }
.learn-lang { font-size: 11px; color: var(--faint); font-weight: 600; }

/* ---------- new arrivals feed ---------- */
.new-arrivals { margin-bottom: 48px; }
.na-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.na-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; transition: border-color .15s;
}
.na-item:hover { border-color: var(--brand); text-decoration: none; }
.na-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.na-cat { font-size: 10.5px; font-weight: 700; color: var(--brand-bright); background: var(--brand-soft); padding: 2px 7px; border-radius: var(--radius-badge); white-space: nowrap; }
.na-stars { font-size: 12px; font-weight: 700; color: var(--yellow); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- line chart ---------- */
.lb-line { width: 100%; height: auto; }


/* ---------- UX 修正 v2 ---------- */
/* Learn 卡片统一：截图缩为 3:2 小图，全部卡等高 */
.learn-grid { grid-auto-rows: 1fr; }
.learn-img { aspect-ratio: 3 / 2; object-fit: cover; max-height: 150px; width: 100%; }

/* Star 榜紧凑化：生态总览 5 卡一行 */
.lb-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.lb-stat { flex: 1 1 150px; flex-direction: row; align-items: baseline; gap: 8px; padding: 10px 14px; }
.lb-stat-num { font-size: 20px; }
.lb-stat-label { font-size: 12px; }

/* 两图并排（桌面端） */
.lb-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .lb-charts { grid-template-columns: 1fr; } }

/* 增长曲线限高 ≤300px */
.lb-growth { padding: 12px 16px; }
.lb-growth .lb-line { height: 250px; width: auto; max-width: 100%; display: block; margin: 0 auto; }

/* 展开全部按钮 */
.expand-btn {
  margin-top: 12px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--brand-bright);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s;
}
.expand-btn:hover { border-color: var(--brand); }
