/* 共享赛季统计页 — 明亮专业主题 */
:root {
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --accent-hover: #0d9488;
  --win: #059669;
  --loss: #dc2626;
  --draw: #ca8a04;
  --chart-grid: rgba(15, 23, 42, 0.08);
  --font-sans: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  background-image:
    linear-gradient(180deg, #ffffff 0%, #f1f5f9 48%, #e8eef5 100%);
}

a {
  color: var(--accent-hover);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: #0f766e;
  text-decoration: underline;
}

/* —— Site top navigation (shared across season pages) —— */
.site-topbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.site-topbar__inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.site-topbar__nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.site-topbar__nav a {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.site-topbar__nav a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

.site-topbar__sep {
  color: var(--border-strong);
  font-weight: 400;
  user-select: none;
}

/* Season stats pages dropdown (hover / focus-within) */
.site-topbar__dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  /* Bridge hover: gap between trigger and menu was outside this box, so hover dropped before reaching links */
  padding-bottom: 0.4rem;
}

.site-topbar__dropdown[hidden] {
  display: none !important;
}

.site-topbar__dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.15rem;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
}

.site-topbar__dropdown-trigger[hidden] {
  display: none !important;
}

.site-topbar__dropdown-trigger:hover,
.site-topbar__dropdown-trigger:focus-visible {
  color: var(--accent-hover);
  outline: none;
}

.site-topbar__dropdown-trigger:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.site-topbar__dropdown-caret {
  font-size: 0.65rem;
  opacity: 0.75;
  transition: transform 0.15s ease;
}

.site-topbar__dropdown:hover .site-topbar__dropdown-caret,
.site-topbar__dropdown:focus-within .site-topbar__dropdown-caret {
  transform: rotate(-180deg);
}

.site-topbar__dropdown-heading {
  padding: 0.35rem 0.9rem 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
  list-style: none;
}

.site-topbar__dropdown-heading:not(:first-child) {
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.site-topbar__dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    visibility 0.15s;
}

.site-topbar__dropdown:hover .site-topbar__dropdown-menu,
.site-topbar__dropdown:focus-within .site-topbar__dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.site-topbar__dropdown-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s ease, color 0.1s ease;
}

.site-topbar__dropdown-link__label {
  flex: 1;
  min-width: 0;
}

.site-topbar__dropdown-link__logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}

.site-topbar__dropdown-link:hover {
  background: #f1f5f9;
  color: var(--accent-hover);
  text-decoration: none;
}

.site-topbar__dropdown-link.is-current {
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}

.stats-page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.stats-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.stats-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stats-header__brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1;
}

.stats-header__logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.stats-header__text {
  min-width: 0;
}

.stats-header__eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.35rem;
}

.stats-header__title {
  font-size: clamp(1.65rem, 4vw, 2.15rem);
  font-weight: 700;
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.stats-header__meta {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
}

.stats-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.kpi-card__label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.35rem;
}

.kpi-card__value {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--text);
}

.kpi-card__value--win {
  color: var(--win);
}

.kpi-card__value--loss {
  color: var(--loss);
}

.kpi-card__value--accent {
  color: var(--accent);
}

.section {
  margin-bottom: 2rem;
}

.section-intro {
  margin: -0.5rem 0 1rem;
  padding: 0;
  border: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.section__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.section__title::before {
  content: "";
  width: 3px;
  height: 1.05em;
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  border-radius: 2px;
}

.section__emoji {
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 1.05rem;
  vertical-align: -0.08em;
}

/* —— 排行榜 —— */
.rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.rank-board {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 1.1rem;
  box-shadow: var(--shadow);
}

.rank-board__title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(420px, 55vh);
  overflow-y: auto;
}

/* Hide scrollbar but keep scroll (wheel / touch) */
.rank-list--scroll {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rank-list--scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.rank-item:last-child {
  border-bottom: none;
}

.rank-num {
  flex-shrink: 0;
  width: 1.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.rank-num--1 {
  color: #b45309;
}

.rank-num--2 {
  color: #64748b;
}

.rank-num--3 {
  color: #a16207;
}

.rank-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-val {
  flex-shrink: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

/* —— 图表：固定高度，防止 canvas 无限增高 —— */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.chart-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.85rem 0.65rem;
  box-shadow: var(--shadow);
}

.chart-canvas-wrap {
  position: relative;
  height: 240px;
  width: 100%;
  overflow: hidden;
}

.chart-canvas-wrap canvas {
  display: block;
  max-height: 100%;
}

.chart-card__caption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  background: #f8fafc;
}

.data-table th:hover {
  color: var(--accent);
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.data-table .player-cell {
  font-weight: 500;
}

.data-table .jersey {
  display: inline-block;
  min-width: 2rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.match-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.65rem 1rem;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: background 0.12s ease;
}

.match-row__main {
  min-width: 0;
}

.match-row__opponent-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  width: 100%;
}

.match-row__opponent-cluster {
  display: flex;
  align-items: center;
  gap: 0.35rem 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.match-row__opponent-cluster .match-row__opponent {
  flex: 0 1 auto;
  min-width: 0;
  font-weight: 600;
}

.match-row__prefix {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-muted);
}

.match-row__prefix--home {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.match-row__prefix--away {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.match-row__prefix--neutral {
  font-size: 0.95rem;
  font-weight: 700;
  color: #64748b;
}

.match-row__game-name {
  margin-left: auto;
  flex-shrink: 0;
  max-width: 52%;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-muted);
  text-align: right;
}

.opponent-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  vertical-align: middle;
  flex-shrink: 0;
}

.match-row__scorers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-top: 0.4rem;
  max-width: 100%;
}

.match-scorer {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.12rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--text);
}

.match-scorer__name {
  font-weight: 600;
}

.match-scorer__balls {
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
}

.match-row__videos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.match-video-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: #64748b;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    transform 0.12s ease;
}

.match-video-icon:hover {
  background: #fff;
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
  transform: translateY(-1px);
  text-decoration: none;
}

.match-video-icon--highlight:hover {
  color: #ea580c;
  border-color: rgba(234, 88, 12, 0.4);
}

.match-video-icon__svg {
  width: 22px;
  height: 22px;
  display: block;
}

.match-row:last-child {
  border-bottom: none;
}

.match-row:hover {
  background: #f8fafc;
}

.match-row__date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.match-row__location-meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin-top: 0.28rem;
  max-width: 100%;
}

.match-row__location-line {
  display: block;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--text-muted);
}

/* Match venues map (Leaflet) */
.match-map {
  height: calc(min(420px, 70vh) * 1.3);
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #e2e8f0;
}

.match-map .leaflet-container {
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.match-map .leaflet-marker-icon {
  border: none;
  background: transparent;
}

.leaflet-pulse-marker {
  position: relative;
  width: 28px;
  height: 28px;
  pointer-events: none;
}

.leaflet-pulse-marker__dot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  /* 70% opacity (0.7) */
  background: rgba(0, 51, 102, 0.7);
  border: 1px dashed #94a3b8;
  box-sizing: border-box;
  z-index: 2;
}

.leaflet-pulse-marker__ring {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -7px;
  margin-top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(94, 2, 170, 0.35);
  border: 1px dashed rgba(234, 179, 8, 0.85);
  animation: leaflet-pulse-ripple 2.1s ease-out infinite;
  z-index: 1;
}

@keyframes leaflet-pulse-ripple {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}

.match-map-popup .leaflet-popup-content-wrapper {
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.match-map-popup .leaflet-popup-content {
  margin: 0;
  padding: 0;
  min-width: 200px;
}

.match-map-popup__scroll-body {
  height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.65rem 0.85rem;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

.match-map-popup__scroll-body::-webkit-scrollbar {
  width: 0.45rem;
}

.match-map-popup__scroll-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.match-map-popup__wrap {
  margin: 0;
}

.match-map-popup__game {
  text-align: left;
}

.match-map-popup__videos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.match-map-popup__videos .match-video-icon {
  width: 32px;
  height: 32px;
}

.match-map-popup__videos .match-video-icon__svg {
  width: 20px;
  height: 20px;
}

.match-map-popup__line {
  margin: 0.2rem 0;
  line-height: 1.45;
  color: var(--text);
}

.match-map-popup__line--date {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.match-map-popup__line--game-name {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.match-map-popup__score {
  font-weight: 600;
}

.match-map-popup__sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.55rem 0;
}

.match-map__empty {
  margin: 0;
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.match-row__score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1rem;
}

.match-row__result {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
}

.match-row__result--W {
  background: rgba(5, 150, 105, 0.12);
  color: var(--win);
}

.match-row__result--L {
  background: rgba(220, 38, 38, 0.1);
  color: var(--loss);
}

.match-row__result--D {
  background: rgba(202, 138, 4, 0.12);
  color: var(--draw);
}

.match-row__result--S {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.match-row--scheduled .match-row__opponent-line {
  opacity: 0.95;
}

.match-row__score--scheduled {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.footer-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.footer-note p {
  margin: 0;
}

.footer-note p + p {
  margin-top: 0.35em;
}

.footer-note__emoji {
  margin-right: 0.35em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .match-row {
    grid-template-columns: 1fr;
  }

  .match-row__score {
    justify-self: start;
  }
}
