/* 星标榜区块 · 嵌在 nav/index.html 里，只作用于 .stars-block 内部
   版式参考编辑式专题：编号小节 + 衬线标题 + 一句话 deck */

.stars-block {
  margin-bottom: var(--sp-9);
  padding-bottom: var(--sp-7);
  border-top: 1px solid var(--line);
  scroll-margin-top: 84px;
}

/* ── 页头 ── */
.stars-head {
  margin-bottom: var(--sp-7);
}
.stars-head h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 500;
  color: var(--text);
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}
.stars-head h2 em { font-style: italic; color: var(--accent-rust-text); }
.stars-lede {
  margin: 0;
  font-size: var(--fs-base);
  line-height: 1.9;
  color: var(--text-soft);
  max-width: 44em;
}
.stars-lede strong { color: var(--text); font-weight: 600; }

.stars-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--line-soft);
}
.stars-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.stars-src {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: var(--accent-rust-text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1em 0.6em;
}

/* ── 本期看点 ── */
.stars-pick {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-7);
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border-left: 2px solid var(--accent-rust);
  border-radius: 0 8px 8px 0;
}
.stars-pick:empty { display: none; }
.pick-item { display: flex; flex-direction: column; gap: 0.1em; }
.pick-k {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.pick-v { font-size: var(--fs-sm); color: var(--text-soft); }
.pick-v a { color: var(--text); font-weight: 600; }
.pick-v a:hover { color: var(--accent-rust-text); }
.pick-v b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ── 编号小节 ── */
.stars-sec {
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--line);
}
.stars-sec:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.stars-sec-last { padding-bottom: var(--sp-2); }

.stars-sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-3);
}
.stars-sec-num {
  flex-shrink: 0;
  min-width: 2em;
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--accent-rust-text);
  align-self: baseline;
}
.stars-sec-head h3 {
  flex: 1 1 auto;
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--text);
}
.stars-sec-head h3 em { font-style: italic; color: var(--accent-rust-text); }
.stars-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.stars-deck {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-sm);
  line-height: 1.85;
  color: var(--text-dim);
  max-width: 46em;
}
.stars-deck strong { color: var(--text-soft); font-weight: 600; }
.stars-deck code,
.stars-facts code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--text-soft);
}
.stars-deck-inline {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* ── 分段控件 ── */
.stars-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.stars-seg button {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--text-dim);
  background: none;
  border: 0;
  padding: 0.4em 0.85em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.stars-seg button + button { border-left: 1px solid var(--line); }
.stars-seg button:hover { color: var(--text); }
.stars-seg button[aria-pressed='true'] { background: var(--bg-card); color: var(--accent-rust-text); }

/* 按视图切换对应控件 */
.stars-block[data-view='heat'] .stars-seg[data-role='scale'],
.stars-block[data-view='line'] .stars-seg[data-role='win'] { display: none; }

/* ── 图表面板 ── */
.stars-panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: var(--sp-4);
}

.chart-shell { position: relative; }
.chart-scroll { overflow: visible; }
.chart-scroll svg { display: block; width: 100%; height: auto; overflow: visible; }

.chart-tip {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  min-width: 196px;
  max-width: 260px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6em 0.75em;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.12s;
}
.chart-tip.is-on { opacity: 1; }
.tip-date {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-dim);
  margin-bottom: 0.45em;
  letter-spacing: 0.04em;
  word-break: break-all;
}
.tip-row {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  font-size: var(--fs-sm);
  color: var(--text-soft);
  line-height: 1.75;
}
.tip-k {
  flex: 1 0 auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-dim);
}
.tip-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text); text-align: right; }
.tip-pct { font-size: var(--fs-xs); color: var(--text-dim); }
.tip-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.tip-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; align-self: center; }
.tip-foot {
  margin-top: 0.5em;
  padding-top: 0.4em;
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-dim);
}

/* ── 热力图 ── */
.heat-cell { cursor: pointer; }
.heat-cell.is-on rect { stroke: var(--text); stroke-width: 1.6; stroke-opacity: 0.85; }
.heat-cell.is-on text { fill-opacity: 1; }

.stars-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-3);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--fs-xs);
  color: var(--text-dim);
}
.legend-swatch { width: 14px; height: 2px; border-radius: 1px; }

.heat-scale { display: inline-flex; align-items: center; gap: 0.5em; }
.heat-scale-bar {
  display: block;
  width: 96px;
  height: 8px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line-soft);
}
.heat-scale-end {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ── 明细表 ── */
.stars-table-shell { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.stars-rank {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  min-width: 720px;
}
table.stars-rank th,
table.stars-rank td {
  padding: 0.62em 0.7em;
  text-align: right;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
table.stars-rank th:first-child,
table.stars-rank td:first-child { text-align: left; padding-left: 0; min-width: 240px; }
table.stars-rank th:nth-child(2),
table.stars-rank td:nth-child(2) { text-align: left; }
table.stars-rank th:last-child,
table.stars-rank td:last-child { padding-right: 0.2em; }
table.stars-rank thead th {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
table.stars-rank th.sortable { cursor: pointer; user-select: none; }
table.stars-rank th.sortable:hover { color: var(--text); }
table.stars-rank th[aria-sort='descending'],
table.stars-rank th[aria-sort='ascending'] { color: var(--accent-rust-text); }
table.stars-rank tbody tr:hover { background: var(--line-soft); }

.stars-name { display: flex; flex-direction: column; gap: 0.15em; min-width: 0; }
.stars-name a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--fs-base);
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stars-name a:hover { color: var(--accent-rust-text); }
.stars-sub-line {
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.stars-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-soft); }
.stars-num-strong { color: var(--text); font-weight: 600; }
.delta-up { color: var(--accent-rust-text); }
.delta-down { color: var(--accent-jade-text); }
.delta-flat { color: var(--text-dim); }
.stars-tag {
  display: inline-block;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--text-dim);
}

/* ── 口径清单 ── */
.stars-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
  max-width: 52em;
}
.stars-facts li {
  display: grid;
  grid-template-columns: 4.2em 1fr;
  gap: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px dashed var(--line-soft);
  font-size: var(--fs-sm);
  line-height: 1.85;
  color: var(--text-dim);
}
.stars-facts .k {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  color: var(--accent-rust-text);
  padding-top: 0.3em;
}

.stars-empty {
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--text-dim);
  font-size: var(--fs-sm);
  line-height: 1.9;
}
.stars-empty code { font-family: var(--font-mono); font-size: 0.92em; color: var(--text-soft); }

@media (max-width: 640px) {
  .stars-panel { padding: var(--sp-3); }
  .stars-head h2 { font-size: var(--fs-xl); }
  .stars-lede { font-size: var(--fs-sm); }

  .stars-sec-head { gap: var(--sp-2); }
  .stars-sec-head h3 { font-size: var(--fs-base); }
  .stars-tools { flex-basis: 100%; }

  /* 折线图整体横滑，避免 900px 的 viewBox 被压成 330px 后字看不见 */
  .chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart-scroll .line-svg { min-width: 560px; }

  .stars-facts li { grid-template-columns: 1fr; gap: 0; }
  .stars-facts .k { padding-top: 0; }

  table.stars-rank { min-width: 0; }
  table.stars-rank th,
  table.stars-rank td { padding: 0.6em 0.4em; }
  table.stars-rank th:first-child,
  table.stars-rank td:first-child { min-width: 0; }
  .stars-name a,
  .stars-sub-line { max-width: 132px; }
  /* 手机上先藏分类 / 走势 / 许可，只留名字和四个数 */
  table.stars-rank th:nth-child(2),
  table.stars-rank td:nth-child(2),
  table.stars-rank th:nth-child(7),
  table.stars-rank td:nth-child(7),
  table.stars-rank th:nth-child(8),
  table.stars-rank td:nth-child(8) { display: none; }
}
