.container.ranking-page {
  max-width: 1440px;
  width: 100%;
  padding-left: 28px;
  padding-right: 28px;
  box-sizing: border-box;
}

.ranking-page .ranking-header h1 {
  margin-bottom: 8px;
}

.ranking-subtitle {
  text-align: center;
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--text-muted);
}

.ranking-view-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 22px;
  max-width: none;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.ranking-view-tab {
  flex: 0 0 auto;
  min-width: 96px;
  height: 42px;
  padding: 0 20px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
  font-family: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ranking-view-tab:hover {
  color: var(--text-primary);
}

.ranking-view-tab.is-active {
  background: var(--search-btn-gradient);
  color: #fff;
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.22);
}

[data-theme="dark"] .ranking-view-tab.is-active {
  box-shadow: 0 6px 16px rgba(96, 165, 250, 0.2);
}

.ranking-view-panels {
  margin-bottom: 48px;
}

.ranking-view {
  display: none;
}

.ranking-view.is-active {
  display: block;
  animation: rankingViewIn 0.28s ease;
}

@keyframes rankingViewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ranking-boards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 0;
  min-height: min(86vh, 900px);
}

.ranking-board {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.ranking-board-total {
  background: linear-gradient(165deg, #f3e8ff 0%, var(--bg-card) 48%);
}

.ranking-board-month {
  background: linear-gradient(165deg, #fce7f3 0%, var(--bg-card) 48%);
}

.ranking-board-day {
  background: linear-gradient(165deg, #ecfeff 0%, var(--bg-card) 48%);
}

[data-theme="dark"] .ranking-board-total {
  background: linear-gradient(165deg, #1e3a5f 0%, var(--bg-card) 55%);
}

[data-theme="dark"] .ranking-board-month {
  background: linear-gradient(165deg, #0c4a6e 0%, var(--bg-card) 55%);
}

[data-theme="dark"] .ranking-board-day {
  background: linear-gradient(165deg, #134e4a 0%, var(--bg-card) 55%);
}

.ranking-board-head {
  display: flex;
  align-items: flex-end;
  min-height: 48px;
  margin-bottom: 10px;
}

.ranking-board-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.ranking-month-picker {
  flex-shrink: 0;
  min-width: 108px;
  margin: 0;
}

.ranking-month-picker select {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.ranking-board-date {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-text);
}

.ranking-board h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  color: var(--text-primary);
}

.ranking-table-wrap {
  flex: 1;
  min-height: 560px;
  max-height: min(82vh, 860px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}

.ranking-table-head,
.ranking-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 40px 40px;
  gap: 4px;
  align-items: center;
  padding: 10px 10px;
}

.ranking-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.ranking-board-month .ranking-table-head {
  background: #ec4899;
}

.ranking-board-day .ranking-table-head {
  background: #0d9488;
}

[data-theme="dark"] .ranking-board-month .ranking-table-head {
  background: #38bdf8;
  color: #0c4a6e;
}

[data-theme="dark"] .ranking-board-day .ranking-table-head {
  background: #2dd4bf;
  color: #134e4a;
}

.ranking-table-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ranking-table-list > li {
  border-top: 1px solid var(--border);
}

.ranking-empty {
  padding: 28px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.ranking-row {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ranking-row:hover,
.ranking-row:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.ranking-rank {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: var(--rank-badge);
}

.ranking-rank.is-gold {
  background: linear-gradient(160deg, #fde68a, var(--rank-gold));
}

.ranking-rank.is-silver {
  background: linear-gradient(160deg, #e2e8f0, var(--rank-silver));
  color: #1e293b;
}

.ranking-rank.is-bronze {
  background: linear-gradient(160deg, #fdba74, var(--rank-bronze));
}

.ranking-label {
  min-width: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-count {
  text-align: center;
  font-weight: 800;
  color: var(--heat);
  font-variant-numeric: tabular-nums;
}

.ranking-trend {
  text-align: center;
  font-weight: 800;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.ranking-table-head > span:nth-child(3),
.ranking-table-head > span:nth-child(4) {
  text-align: center;
}

.ranking-trend.is-up {
  color: var(--high-score);
}

.ranking-trend.is-down {
  color: #0d9488;
}

.ranking-trend.is-new {
  color: var(--accent-text);
}

.school-heat-chart-panel,
.longhu-board-panel {
  min-width: 0;
  width: 100%;
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.school-heat-chart-panel,
.school-heat-chart-panel-wide {
  background: linear-gradient(165deg, #ede9fe 0%, var(--bg-card) 28%);
}

.longhu-board-panel,
.longhu-board-panel-wide {
  background: linear-gradient(165deg, #fff1f2 0%, var(--bg-card) 32%);
  display: flex;
  flex-direction: column;
  min-height: min(72vh, 720px);
}

.longhu-board-panel-wide,
.school-heat-chart-panel-wide {
  max-width: none;
  margin: 0;
}

[data-theme="dark"] .school-heat-chart-panel {
  background: linear-gradient(165deg, #1e293b 0%, var(--bg-card) 50%);
}

[data-theme="dark"] .longhu-board-panel {
  background: linear-gradient(165deg, #3f1d2e 0%, var(--bg-card) 55%);
}

.longhu-board-head {
  margin-bottom: 10px;
}

.longhu-board-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--text-primary);
  font-family: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
}

.longhu-board-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.longhu-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px;
  border-radius: 10px;
  background: var(--bg-elevated);
}

.longhu-tab {
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.longhu-tab.is-active[data-longhu-tab="gainers"] {
  background: rgba(225, 29, 72, 0.12);
  color: #e11d48;
}

.longhu-tab.is-active[data-longhu-tab="losers"] {
  background: rgba(22, 163, 74, 0.14);
  color: #16a34a;
}

[data-theme="dark"] .longhu-tab.is-active[data-longhu-tab="gainers"] {
  background: rgba(251, 113, 133, 0.18);
  color: #fb7185;
}

[data-theme="dark"] .longhu-tab.is-active[data-longhu-tab="losers"] {
  background: rgba(74, 222, 128, 0.16);
  color: #4ade80;
}

.longhu-table-wrap {
  flex: 1;
  min-height: 420px;
  max-height: min(68vh, 680px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}

.longhu-table-head,
.longhu-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 56px minmax(100px, 0.45fr);
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
}

.longhu-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(135deg, #e11d48 0%, #f97316 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.longhu-board-panel.is-losers .longhu-table-head {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
}

.longhu-table-head > span:nth-child(3),
.longhu-table-head > span:nth-child(4) {
  text-align: center;
}

.longhu-table-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.longhu-table-list > li {
  border-top: 1px solid var(--border);
}

.longhu-empty {
  padding: 28px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.longhu-row {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.longhu-row:hover,
.longhu-row:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.longhu-rank {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: #fb7185;
}

.longhu-row.is-down-row .longhu-rank {
  background: #16a34a;
}

.longhu-label {
  min-width: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.longhu-count {
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.longhu-delta {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.longhu-delta.is-up,
.longhu-delta.is-new {
  color: #e11d48;
}

.longhu-delta.is-down {
  color: #16a34a;
}

[data-theme="dark"] .longhu-delta.is-up,
[data-theme="dark"] .longhu-delta.is-new {
  color: #fb7185;
}

[data-theme="dark"] .longhu-delta.is-down {
  color: #4ade80;
}

.school-heat-chart-head {
  margin-bottom: 12px;
}

.school-heat-chart-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--text-primary);
  font-family: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.school-heat-chart-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.school-heat-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.school-heat-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px 16px 132px auto;
  gap: 0 10px;
  align-items: end;
}

.school-heat-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.school-heat-field > label,
.school-heat-field > span:first-child,
.school-heat-search-wrap > label {
  display: block;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-secondary);
  white-space: nowrap;
}

.school-heat-label-spacer {
  visibility: hidden;
  user-select: none;
}

.school-heat-search-box {
  position: relative;
}

.school-heat-search-box input,
.school-heat-month-field select,
.school-heat-apply-btn {
  height: 40px;
  border-radius: 10px;
  box-sizing: border-box;
}

.school-heat-search-box input {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
}

.school-heat-search-box input:focus,
.school-heat-month-field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.school-heat-month-field select {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
}

.school-heat-range-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
}

.school-heat-apply-btn {
  padding: 0 18px;
  border: none;
  background: var(--search-btn-gradient);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.school-heat-apply-btn:hover {
  filter: brightness(1.05);
}

.school-heat-suggest {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow-dropdown);
}

.school-heat-suggest-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.school-heat-suggest-item:hover,
.school-heat-suggest-item:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.school-heat-suggest-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.school-heat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.school-heat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 6px 4px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--chip-color, var(--accent)) 45%, transparent);
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 14%, transparent);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.school-heat-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-heat-chip-remove {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.school-heat-chip-remove:hover,
.school-heat-chip-remove:focus-visible {
  color: var(--high-score);
  background: rgba(225, 29, 72, 0.08);
  outline: none;
}

.school-heat-hint {
  margin: 0;
  min-height: 1.3em;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.school-heat-hint.is-error {
  color: var(--high-score);
}

.school-heat-chart {
  width: 100%;
  height: min(56vh, 520px);
  min-height: 400px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-family: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.campus-heat-panel {
  width: 100%;
  min-width: 0;
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, #e0e7ff 0%, var(--bg-card) 30%);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .campus-heat-panel {
  background: linear-gradient(165deg, #1e293b 0%, var(--bg-card) 45%);
}

.campus-heat-head {
  margin-bottom: 14px;
}

.campus-heat-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--text-primary);
  font-family: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
}

.campus-heat-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.campus-heat-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-bottom: 10px;
}

.campus-heat-search-wrap {
  flex: 1 1 320px;
  min-width: 220px;
}

.campus-heat-metric {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.campus-heat-metric-btn {
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.campus-heat-metric-btn.is-active {
  background: var(--search-btn-gradient);
  color: #fff;
}

.campus-heat-hint {
  margin: 0 0 10px;
  min-height: 1.3em;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.campus-heat-hint.is-error {
  color: var(--high-score);
}

.campus-heat-chart {
  width: 100%;
  min-height: 360px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-family: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

@media (max-width: 1100px) {
  .ranking-boards {
    grid-template-columns: 1fr;
    gap: 16px;
    min-height: 0;
  }

  .ranking-board {
    padding: 18px;
  }

  .ranking-board h2 {
    font-size: 17px;
  }

  .ranking-table-head,
  .ranking-row {
    grid-template-columns: 40px minmax(0, 1fr) 48px 48px;
    gap: 6px;
    padding: 11px 12px;
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .container.ranking-page {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ranking-boards {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .ranking-view-tab {
    min-width: 0;
    height: 38px;
    padding: 0 14px;
    font-size: 14px;
  }

  .longhu-board-panel,
  .longhu-board-panel-wide {
    min-height: 0;
  }

  .longhu-table-wrap {
    min-height: 280px;
    max-height: min(60vh, 480px);
  }

  .ranking-table-wrap {
    min-height: 360px;
    max-height: min(70vh, 560px);
  }

  .school-heat-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 12px;
  }

  .school-heat-search-wrap {
    grid-column: 1 / -1;
  }

  .school-heat-range-sep {
    display: none;
  }

  .school-heat-apply-wrap {
    grid-column: 1 / -1;
  }

  .school-heat-apply-btn {
    width: 100%;
  }

  .school-heat-label-spacer {
    display: none;
  }

  .school-heat-chart {
    height: min(48vh, 360px);
    min-height: 280px;
  }
}

@media (max-width: 640px) {
  .ranking-table-head,
  .ranking-row {
    grid-template-columns: 44px minmax(0, 1fr) 56px 56px;
    padding: 10px;
    font-size: 13px;
  }

  .longhu-table-head,
  .longhu-row {
    grid-template-columns: 40px minmax(0, 1fr) 48px minmax(72px, 0.8fr);
    gap: 6px;
    padding: 10px;
  }

  .ranking-table-wrap,
  .longhu-table-wrap {
    min-height: 240px;
    max-height: min(50vh, 360px);
  }

  .school-heat-chart {
    height: 260px;
    min-height: 240px;
  }
}
