:root {
  --gold: #f7c34c;
  --gold-strong: #f5b83d;
  --ink: #f2f3f7;
  --muted: #8b90a3;
  --row-a: rgba(255, 255, 255, 0.055);
  --row-b: rgba(255, 255, 255, 0.02);
  --row-border: rgba(255, 255, 255, 0.09);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 50% -12%, #26242e 0%, #14121a 45%, #090810 100%);
  background-attachment: fixed;
}

/* 星空 */
#stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
#stars i {
  position: absolute;
  border-radius: 50%;
  background: #eceaf2;
  animation: twinkle 3.2s ease-in-out infinite alternate;
}
#stars i.gold { background: #ffd98a; }
@keyframes twinkle {
  from { opacity: 0.12; }
  to   { opacity: 0.8; }
}

.page {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

/* 语言切换按钮 */
.lang-toggle {
  all: unset;
  cursor: pointer;
  position: absolute;
  top: 18px;
  right: 20px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12.5px;
  font-weight: 600;
  color: #c0c3ce;
}
.lang-toggle:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(247, 195, 76, 0.45);
}

.hero { text-align: center; margin-bottom: 40px; }
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--gold);
  text-shadow: 0 2px 18px rgba(247, 195, 76, 0.22);
}
.hero .num { font-size: 1.15em; }
.hero .sub {
  margin: 0;
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--muted);
}
.hero .intro {
  max-width: 620px;
  margin: 16px auto 0;
  font-size: 13.5px;
  line-height: 1.8;
  color: #a7abba;
}
.hero .stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.hero .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.13);
  font-size: 12px;
  color: #c0c3ce;
  white-space: nowrap;
}
.hero .chip b { color: var(--gold); font-weight: 700; }

/* 周榜/日榜切换 */
.chart-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 26px;
}
.chart-tab {
  all: unset;
  cursor: pointer;
  padding: 7px 24px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: #9ba0b0;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.chart-tab:hover { color: #d8dbe4; background: rgba(255, 255, 255, 0.08); }
.chart-tab.active {
  color: var(--gold);
  background: rgba(247, 195, 76, 0.12);
  border-color: rgba(247, 195, 76, 0.5);
}

/* 表头 */
.table-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 150px 110px 120px 100px;
  gap: 12px;
  padding: 0 26px 10px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 1px;
}
.table-head span:nth-child(n + 3) { text-align: center; }

/* 排行卡片 */
.row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 150px 110px 120px 100px;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 16px 26px;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--row-a), var(--row-b));
  border: 1px solid var(--row-border);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.row:hover {
  transform: translateY(-2px);
  border-color: rgba(247, 195, 76, 0.4);
}
.row.flash { animation: flash 1.4s ease; }
@keyframes flash {
  0%   { box-shadow: 0 0 0 3px rgba(247, 195, 76, 0.55); border-color: var(--gold); }
  100% { box-shadow: none; }
}

.rank {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  color: #d8dbe4;
}
.row.top3 .rank { color: var(--gold); text-shadow: 0 0 12px rgba(247, 195, 76, 0.4); }

.proj { min-width: 0; }
.proj .name {
  display: block;
  font-size: 16.5px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
.proj .name:hover { text-decoration: underline; }
.pathline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  min-width: 0;
}
.proj .path {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: #9ba0b0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lang {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: #b5b9c6;
  white-space: nowrap;
}
.lang i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.proj .desc {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #83889a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj .usecase {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #bfa46a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend { text-align: center; }
.spark { width: 104px; height: 30px; }
.spark path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.5;
  opacity: 0.9;
}
.spark circle { fill: var(--gold); }

.company {
  text-align: center;
  font-size: 13.5px;
  color: #c9cdd8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delta {
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  color: var(--gold-strong);
  white-space: nowrap;
}
.stars {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #cfd2dc;
}

.loading, .empty {
  text-align: center;
  padding: 48px 0;
  color: var(--muted);
  font-size: 14px;
}

/* 趋势追踪 */
.trends { margin-top: 52px; }
.trends h2 {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 6px;
}
.trends-note {
  margin: 0 0 14px;
  font-size: 12px;
  color: #71767f;
}
.trends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}
.trend-card {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.trend-card:hover { background: rgba(255, 255, 255, 0.09); }
.trend-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.trend-info .t1 {
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trend-info .r {
  color: #767b8c;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trend-info .meta { color: #c3c6d2; font-size: 11.5px; }
.trend-info .meta b { color: var(--gold); font-weight: 700; }

/* 往期榜单 */
.history { margin-top: 52px; }
.history h2 {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 14px;
}
.history ul { list-style: none; margin: 0; padding: 0; }
.history li button {
  all: unset;
  display: block;
  width: 100%;
  cursor: pointer;
  padding: 12px 18px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13.5px;
  color: #9ba0b0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.history li button:hover { background: rgba(255, 255, 255, 0.085); }
.history li .t1 { color: #d8dbe4; }

.foot {
  margin-top: 44px;
  text-align: center;
  font-size: 12.5px;
  color: #71767f;
}
.foot p { margin: 4px 0; }
.foot .hint { color: #565b64; }

@media (max-width: 720px) {
  .table-head { display: none; }
  .row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas: "rank proj delta" "rank proj stars";
    padding: 14px 16px;
  }
  .rank { grid-area: rank; font-size: 18px; }
  .proj { grid-area: proj; }
  .company { display: none; }
  .trend { display: none; }
  .delta { grid-area: delta; font-size: 16px; }
  .stars { grid-area: stars; font-size: 13px; }
}
