﻿*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #5b9bd5;
  --primary-dark: #3f83c4;
  --primary-light: #7fb8e0;
  --primary-bg: #eef5fb;
  --bg: #f2f7fc;
  --card: #ffffff;
  --text: #2c3e50;
  --text-secondary: #5a7a95;
  --text-tertiary: #8da8c0;
  --border: #d4e2f0;
  --border-light: #e8f0f8;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 4px rgba(91, 155, 213, 0.08);
  --shadow-md: 0 4px 16px rgba(91, 155, 213, 0.12);
  --header-height: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html {
  font-size: clamp(13px, 1.2vw + 8px, 16px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding-top: calc(var(--header-height) + 60px);
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--primary);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--primary-dark);
}

.header-inner {
  width: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-img {
  height: 36px;
  width: auto;
  display: block;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  color: #fff;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.logo-sub {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.8px;
}

.filter-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  min-height: 52px;
  display: flex;
  align-items: center;
  overflow: visible;
}

.filter-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  text-align: center;
}

.filter-inner {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px 24px;
  padding: 8px 28px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.hint {
  display: block;
  font-size: 0.62rem;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 0;
  line-height: 1.2;
}

.filter-group select,
.filter-group input {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-family: var(--font);
  background: var(--primary-bg);
  color: var(--text);
  outline: none;
  transition: all 0.2s ease;
  line-height: 1.4;
  height: 36px;
  -webkit-appearance: none;
  appearance: none;
}

.filter-group select {
  min-width: 88px;
  cursor: pointer;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238da8c0' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.filter-group select:hover,
.filter-group input:hover {
  border-color: var(--primary-light);
  background-color: var(--card);
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--primary);
  background-color: var(--card);
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.10);
}

.filter-group input {
  min-width: 150px;
}

.filter-group input::placeholder {
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

.multi-select {
  width: 100%;
  min-width: 120px;
}

.multi-select-trigger {
  padding: 6px 28px 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-family: var(--font);
  background: var(--primary-bg);
  color: var(--text);
  line-height: 1.4;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238da8c0' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all 0.2s ease;
}

.multi-select-trigger:hover {
  border-color: var(--primary-light);
  background-color: var(--card);
}

.multi-select-dropdown {
  display: none;
  z-index: 10000;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
  white-space: nowrap;
}

.multi-select-dropdown.open {
  display: block;
}

.multi-option {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--text);
  transition: background 0.12s;
  white-space: nowrap;
}

.multi-option:hover {
  background: var(--primary-bg);
}

.multi-option.selected {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.multi-option.selected:hover {
  background: var(--primary-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  background: var(--card);
  color: var(--text-secondary);
  line-height: 1;
  outline: none;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

.btn:active {
  transform: scale(0.96);
}

.main-content {
  width: 100%;
  padding: 18px 28px 48px;
}

.stats-bar {
  flex: none;
}

.stat-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 14px;
  background: var(--primary-bg);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--primary);
}

.stat-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--primary);
  opacity: 0.75;
}

.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-height) - 110px);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin: 0;
  width: 100%;
}

.table-wrapper:hover {
  box-shadow: var(--shadow-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead tr:first-child th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  text-align: center;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 3;
  white-space: nowrap;
}

thead tr:first-child th.top-static {
  background: var(--primary-dark);
}

thead tr:last-child th {
  background: var(--primary-bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 9px 12px;
  text-align: center;
  border: 1px solid var(--border-light);
  border-top: none;
  user-select: none;
  cursor: default;
  white-space: nowrap;
  position: sticky;
  top: 41px;
  z-index: 2;
}

thead tr:last-child th.sortable {
  cursor: pointer;
  transition: background 0.12s;
  text-align: center;
}

thead tr:last-child th.sortable:hover {
  background: #dce8f5;
  color: var(--primary);
}

thead tr:last-child th.sortable .sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.5rem;
  color: var(--text-tertiary);
  vertical-align: middle;
  line-height: 1;
}

thead tr:last-child th.sortable.sort-asc .sort-icon::after {
  content: " \25B2";
  color: var(--primary);
}

thead tr:last-child th.sortable.sort-desc .sort-icon::after {
  content: " \25BC";
  color: var(--primary);
}

thead tr:last-child th.sortable:not(.sort-asc):not(.sort-desc) .sort-icon::after {
  content: " \25B2\25BC";
  font-size: 0.4rem;
  opacity: 0.35;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s ease;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  outline: 2px solid var(--primary-light);
  outline-offset: -1px;
}

tbody tr:nth-child(even) {
  background: transparent;
}

tbody td {
  padding: 9px 14px;
  vertical-align: middle;
  color: var(--text);
  font-size: 0.88rem;
  border: 1px solid var(--border-light);
  border-top: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

tbody td.info-cell {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

tbody td.num {
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  font-size: 0.88rem;
  white-space: nowrap;
}

tbody td.num.highlight {
  color: var(--primary);
  font-weight: 700;
}

tbody td.num.rank {
  color: var(--text-secondary);
  font-weight: 500;
}

.empty-state,
.loading-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-tertiary);
}

.loading-state .spin {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-state p,
.empty-state p {
  font-size: 0.95rem;
}

@media (max-width: 1280px) {
  .header-inner,
  .filter-inner {
    padding: 0 20px;
  }
  .main-content {
    padding: 16px 20px 40px;
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 54px;
  }

  .table-wrapper {
    border-radius: var(--radius-sm);
  }

  thead tr:first-child th {
    font-size: 0.76rem;
    padding: 10px 10px;
  }

  thead tr:last-child th {
    font-size: 0.73rem;
    padding: 8px 10px;
    top: 39px;
  }

  tbody td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  tbody td.num {
    font-size: 0.8rem;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 52px;
  }

  body {
    padding-top: calc(var(--header-height) + 120px);
  }

  .header-inner,
  .filter-inner {
    padding: 0 14px;
  }

  .logo-img {
    height: 30px;
  }

  .logo-title {
    font-size: 0.92rem;
  }

  .logo-sub {
    font-size: 0.62rem;
  }

  .filter-bar {
    padding: 6px 0;
  }

  .filter-inner {
    flex-wrap: nowrap;
    gap: 6px 10px;
    padding: 0 14px;
  }

  .filter-group label {
    font-size: 0.72rem;
  }

  .filter-group select,
  .filter-group input,
  .multi-select-trigger {
    font-size: 0.8rem;
    height: 32px;
    padding: 4px 8px;
    min-width: 0;
  }

  .filter-group select,
  .multi-select-trigger {
    padding-right: 22px;
    background-position: right 6px center;
  }

  .btn {
    height: 32px;
    font-size: 0.8rem;
    padding: 0 12px;
    flex-shrink: 0;
  }

  .main-content {
    padding: 12px 10px 28px;
  }

  .stat-item {
    padding: 4px 12px;
  }

  .stat-num {
    font-size: 1rem;
  }

  table {
    font-size: 0.74rem;
  }

  thead tr:first-child th {
    font-size: 0.7rem;
    padding: 8px 8px;
  }

  thead tr:last-child th {
    font-size: 0.68rem;
    padding: 6px 8px;
  }

  thead tr:last-child th {
    top: 0;
  }

  tbody td {
    padding: 6px 8px;
    font-size: 0.74rem;
  }

  tbody td.num {
    font-size: 0.74rem;
  }
}

@media (max-width: 480px) {
  :root {
    --header-height: 48px;
  }

  .header-inner {
    padding: 0 10px;
  }

  .logo-img {
    height: 26px;
  }

  .logo-title {
    font-size: 0.82rem;
  }

  .logo-sub {
    font-size: 0.55rem;
  }

  .filter-inner {
    gap: 4px 6px;
    padding: 0 10px;
  }

  .filter-group label {
    font-size: 0.68rem;
  }

  .filter-group select,
  .filter-group input,
  .multi-select-trigger {
    font-size: 0.74rem;
    height: 30px;
    padding: 3px 6px;
  }

  .filter-group select,
  .multi-select-trigger {
    padding-right: 18px;
  }

  .btn {
    height: 30px;
    font-size: 0.74rem;
    padding: 0 10px;
  }

  .main-content {
    padding: 10px 6px 20px;
  }

  table {
    font-size: 0.68rem;
  }

  thead tr:first-child th {
    font-size: 0.64rem;
    padding: 6px 5px;
  }

  thead tr:last-child th {
    font-size: 0.62rem;
    padding: 5px 5px;
  }

  tbody td {
    padding: 5px 5px;
    font-size: 0.68rem;
  }

  tbody td.num {
    font-size: 0.68rem;
  }
}

.narrow-device-tip {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  color: #333;
  text-align: center;
  padding: 32px 28px 24px;
  font-size: 1rem;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  z-index: 1000;
  max-width: 85vw;
  line-height: 1.6;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.narrow-device-tip .tip-close {
  background: #87ceeb;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  color: #fff;
  padding: 8px 24px;
  border-radius: 6px;
  line-height: 1;
  margin-top: 4px;
}

.narrow-device-tip .tip-close:hover {
  background: #5bb8d6;
}

.narrow-device-tip-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 999;
}

@media (max-width: 799px) {
  .narrow-device-tip.show {
    display: flex;
  }
  .narrow-device-tip-backdrop.show-backdrop {
    display: block;
  }
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 10px 20px;
  font-size: 0.85rem;
  color: #888;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  line-height: 1.6;
  z-index: 100;
}

.main-content {
  padding-bottom: 60px;
}