:root {
  --trend-bg-1: #e8f4ff;
  --trend-bg-2: #f7f2ea;
  --trend-line: #d6e3ef;
  --trend-text: #13253d;
  --trend-muted: #5d6e86;
  --trend-primary: #0b88c2;
  --trend-accent: #fb6f5f;
  --trend-shadow: 0 14px 28px rgba(17, 31, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--trend-text);
  font: 14px/1.5 "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  background:
    radial-gradient(circle at 12% -18%, #b9dcff 0%, rgba(185, 220, 255, 0) 42%),
    radial-gradient(circle at 110% 0%, #ffd9c0 0%, rgba(255, 217, 192, 0) 33%),
    linear-gradient(180deg, var(--trend-bg-1) 0%, var(--trend-bg-2) 100%);
}

.trends-wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 8px 14px 24px;
}

.trends-toolbar {
  margin-top: 8px;
  border: 1px solid #d5e3ef;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 28px rgba(15, 25, 40, 0.08);
}

.trends-toolbar h1 {
  font-size: 30px;
  letter-spacing: 0.2px;
}

.back-share-btn {
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(11, 136, 194, 0.28);
}

.hero {
  margin: 14px 0 0;
  padding: 18px;
  border: 1px solid #d2e2ee;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, #f4f9ff 70%);
  box-shadow: var(--trend-shadow);
  display: grid;
  gap: 12px;
}

.hero-main h2 {
  margin: 0;
  font-size: 36px;
  line-height: 1.08;
}

.hero-main .muted {
  font-size: 14px;
  color: #3d4f67;
}

.hero-actions {
  display: flex;
  justify-content: flex-end;
}

#refresh-btn {
  border-color: #91c5e4;
  background: #f0f9ff;
  color: #0a527b;
  font-weight: 700;
}

#refresh-btn:hover {
  border-color: #62abd6;
  background: #e0f3ff;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.meta-card {
  border: 1px solid var(--trend-line);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
}

.meta-card .k {
  color: var(--trend-muted);
  font-size: 12px;
}

.meta-card .v {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 800;
  color: #0f2c45;
  letter-spacing: 0.2px;
}

#meta-updated {
  font-size: 20px !important;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filters-panel {
  margin: 20px 0 14px;
  padding: 12px 14px 14px;
  border: 1px solid #d5e4f0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 8px 22px rgba(18, 33, 52, 0.06);
}

.filters-divider {
  height: 1px;
  margin: 0 0 12px;
  background: linear-gradient(90deg, rgba(80, 97, 119, 0), rgba(80, 97, 119, 0.4), rgba(80, 97, 119, 0));
}

.filters {
  display: grid;
  gap: 10px;
}

.filter-group {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  align-items: start;
}

.filter-title {
  margin-top: 6px;
  color: #5a6f89;
  font-size: 12px;
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border: 1px solid #dbe8f3;
  border-radius: 14px;
  background: #f5faff;
}

.chip {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #c8d9e8;
  border-radius: 999px;
  background: #ffffff;
  color: #1c3550;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: #6cb4db;
  background: #f0faff;
}

.chip.active {
  border-color: var(--trend-primary);
  background: linear-gradient(180deg, #0fa6e8 0%, #0b88c2 100%);
  color: #fff;
  box-shadow: 0 6px 14px rgba(11, 136, 194, 0.28);
}

.error-box,
.loading-box {
  margin: 6px 0 12px;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid #fad0cb;
  background: #fff4f2;
  color: #a83328;
}

.loading-box {
  border-color: #d2e7f4;
  background: #f0f8ff;
  color: #154569;
}

.board {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.board[hidden] {
  display: none !important;
}

.board-overall {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.board-groups {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}

.rank-card,
.group-card {
  border: 1px solid #d2e1ee;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: 0 10px 20px rgba(17, 31, 51, 0.06);
  padding: 12px;
  opacity: 0;
  transform: translateY(8px);
  animation: fade-up 0.32s ease forwards;
}

.rank-head {
  display: grid;
  grid-template-columns: 52px 66px 1fr;
  align-items: center;
  gap: 9px;
}

.rank-num {
  font-size: 24px;
  font-weight: 900;
  color: var(--trend-accent);
}

.rank-cover,
.group-item-cover {
  width: 66px;
  height: 88px;
  border-radius: 8px;
  border: 1px solid #d2e1ee;
  object-fit: cover;
  background: #dfebf5;
}

.rank-main,
.group-item-main {
  min-width: 0;
}

.rank-title,
.group-item-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.group-item-title {
  font-size: 15px;
  line-height: 1.2;
}

.rank-sub,
.group-item-sub {
  margin: 5px 0 0;
  color: var(--trend-muted);
  font-size: 12px;
}

.group-item-sub {
  margin-top: 4px;
}

.rank-foot {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.pick-badge,
.group-total {
  border: 1px solid #bdd8ea;
  border-radius: 999px;
  padding: 2px 10px;
  color: #0d4f78;
  font-weight: 800;
  background: #eff8ff;
}

.subject-link {
  width: 34px;
  height: 34px;
  border: 1px solid #c8d8e7;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #3f5a77;
  text-decoration: none;
  background: #fff;
}

.subject-link:hover {
  border-color: #8dc2e2;
  color: #1e4f73;
  background: #f2f9ff;
}

.group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.group-title {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
}

.group-total {
  padding: 4px 11px;
}

.group-list {
  display: grid;
  gap: 8px;
}

.group-item {
  display: grid;
  grid-template-columns: 40px 56px 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #d8e6f2;
  border-radius: 12px;
  padding: 7px;
  background: #ffffff;
}

.group-item-rank {
  font-size: 20px;
  font-weight: 900;
  color: #0fa6e8;
  text-align: center;
}

.group-item-cover {
  width: 56px;
  height: 74px;
}

.group-item-right {
  text-align: right;
  display: grid;
  gap: 4px;
  justify-items: end;
}

.empty-box {
  border: 1px dashed #c8d9e8;
  border-radius: 14px;
  padding: 20px;
  background: #f8fcff;
  color: #62758f;
  text-align: center;
  font-weight: 700;
}

.trends-footer {
  margin-top: 16px;
  text-align: center;
  color: #4f6076;
}

.trends-footer-line {
  height: 1px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, rgba(80, 97, 119, 0), rgba(80, 97, 119, 0.45), rgba(80, 97, 119, 0));
}

.trends-footer p {
  margin: 2px 0;
}

.trends-footer a {
  color: #0b88c2;
  font-weight: 800;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-groups {
    grid-template-columns: 1fr;
  }

  .trends-toolbar h1 {
    font-size: 24px;
  }

  .filter-group {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .filter-title {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .trends-wrap {
    padding: 8px 10px 18px;
  }

  .hero {
    padding: 12px;
  }

  .hero-main h2 {
    font-size: 28px;
  }

  .meta-card .v {
    font-size: 22px;
  }

  #meta-updated {
  font-size: 20px !important;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

  .board-overall {
    grid-template-columns: 1fr;
  }

  .rank-head {
    grid-template-columns: 48px 58px 1fr;
  }

  .rank-cover {
    width: 58px;
    height: 78px;
  }

  .group-title {
    font-size: 24px;
  }

  .group-item {
    grid-template-columns: 34px 50px 1fr;
  }

  .group-item-cover {
    width: 50px;
    height: 66px;
  }

  .group-item-right {
    grid-column: 2 / span 2;
    justify-items: start;
    text-align: left;
    grid-auto-flow: column;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .rank-card,
  .group-card {
    opacity: 1;
    transform: none;
  }
}
