:root {
  --mariners-navy: #0c2c56;
  --mariners-teal: #005c5c;
  --mariners-accent: #00a3a3;

  --win-color: #16a34a;
  --loss-color: #dc2626;
  --neutral-color: #b45309;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fa;
  color: #111827;
}

/* ================= HEADER ================= */

header {
  text-align: center;
  padding: 24px 16px 16px;
  background: linear-gradient(135deg, var(--mariners-teal), var(--mariners-navy));
  color: white;
  border-bottom: 3px solid var(--mariners-accent);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: none;
  transition: box-shadow 0.3s ease, padding 0.3s ease;
}

header.scrolled {
  padding: 8px 16px 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.header-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;

  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;

  transition: all 0.3s ease;
}

header.scrolled .header-inner {
  justify-content: space-between;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 auto;
  transition: all 0.3s ease;
}

header.scrolled .header-content {
  justify-content: flex-start;
  margin: 0;
  gap: 10px;
}

.header-text {
  text-align: center;
  transition: text-align 0.3s ease;
}

header.scrolled .header-text {
  text-align: left;
}

.team-logo {
  width: 56px;
  height: 56px;
  transition: width 0.3s ease, height 0.3s ease;
}

header.scrolled .team-logo {
  width: 26px;
  height: 26px;
}

.header-text h1 {
  margin: 0 0 6px;
  font-size: 2rem;
  line-height: 1.1;
  color: white;
  transition: font-size 0.3s ease, margin 0.3s ease;
}

header.scrolled .header-text h1 {
  font-size: 1.1rem;
  margin: 0;
}

.header-subtitle {
  margin: 0;
  opacity: 0.9;
  color: white;
}

header.scrolled .header-subtitle {
  display: none;
}

/* ================= RIGHT NAV ================= */

.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;

  position: absolute;
  right: 0;
  bottom: 6px;

  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

header.scrolled .header-nav {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(6px);
}

.header-nav a {
  position: relative;
  display: inline-block;
  padding: 4px 0 8px;
  color: white;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.92;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.header-nav a:hover {
  opacity: 1;
  color: #b8f1f1;
}

.header-nav a.active {
  color: #5eead4;
  opacity: 1;
}

.nav-underline {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  background: var(--mariners-accent);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition:
    left 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease;
}

/* ================= HERO ================= */

.hero-card {
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 0 16px;
}

.hero-card > div {
  background: linear-gradient(135deg, #ffffff 0%, #f7fcfc 100%);
  border: 1px solid #dbe7ea;
  border-left: 5px solid var(--mariners-teal);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.hero-label {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
}

.hero-title {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #0f172a;
  line-height: 1.15;
}

.hero-subtitle {
  font-size: 1rem;
  color: #475569;
}

.hero-result {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.hero-result.win {
  background: rgba(22, 163, 74, 0.12);
  color: var(--win-color);
}

.hero-result.loss {
  background: rgba(220, 38, 38, 0.12);
  color: var(--loss-color);
}

.hero-result.other {
  background: rgba(180, 83, 9, 0.12);
  color: var(--neutral-color);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.hero-score-block {
  text-align: right;
}

.hero-score {
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.hero-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.hero-meta-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
}

.hero-meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 6px;
}

.hero-meta-value {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.hero-performers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.hero-group-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
}

.hero-player-list {
  display: grid;
  gap: 10px;
}

.hero-player-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 10px 12px;
}

.hero-player-image {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  object-fit: cover;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.hero-player-name {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}

.hero-player-position {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-player-stat {
  font-size: 0.9rem;
  color: #475569;
}

.hero-linescore {
  margin-bottom: 18px;
}

.hero-linescore-table-wrapper {
  overflow-x: auto;
}

.hero-linescore-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
}

.hero-linescore-table th,
.hero-linescore-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
  color: #0f172a;
  font-size: 0.9rem;
}

.hero-linescore-table th:first-child,
.hero-linescore-table td:first-child {
  text-align: left;
  font-weight: 700;
}

.hero-linescore-table thead {
  background: #f8fafc;
}

.hero-key-play {
  margin-bottom: 18px;
}

.hero-key-play-text {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-left: 4px solid var(--mariners-accent);
  border-radius: 14px;
  padding: 14px 16px;
  color: #334155;
  line-height: 1.5;
}

.hero-highlight-link-wrap {
  margin-bottom: 18px;
}

.hero-highlight-link {
  display: inline-block;
  text-decoration: none;
  background: var(--mariners-teal);
  color: white;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-highlight-link:hover {
  background: var(--mariners-accent);
  transform: translateY(-1px);
}

/* ================= MAIN ================= */

main {
  max-width: 1200px;
  margin: 24px auto 30px;
  padding: 0 16px 32px;
  display: grid;
  gap: 24px;
}

/* ================= CARDS ================= */

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-top: 4px solid var(--mariners-teal);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 18px;
  font-size: 1.35rem;
  color: #0f172a;
  position: relative;
  padding-bottom: 10px;
}

.card h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 44px;
  height: 3px;
  background: var(--mariners-accent);
  border-radius: 999px;
}

/* ================= TEAM OVERVIEW CARDS ================= */

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfc 100%);
  border: 1px solid #dbe7ea;
  border-left: 4px solid var(--mariners-accent);
  border-radius: 16px;
  padding: 18px;
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--mariners-navy);
}

.stat-subtext {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #64748b;
}

/* ================= TABLES ================= */

.table-wrapper {
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
  background: #ffffff;
}

.stats-table thead {
  background: linear-gradient(180deg, #f2fbfb 0%, #f8fafc 100%);
}

.stats-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #46606b;
  border-bottom: 1px solid #d7e6e8;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease, background 0.2s ease;
}

.stats-table th:hover {
  color: var(--mariners-teal);
  background: rgba(0, 163, 163, 0.06);
}

.stats-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  color: #111827;
  vertical-align: middle;
}

.stats-table tbody tr {
  transition: background 0.2s ease;
}

.stats-table tbody tr:hover {
  background: #f2fbfb;
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.number-cell {
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.sort-indicator {
  margin-left: 6px;
  opacity: 0.75;
  color: var(--mariners-accent);
  font-weight: 700;
}

/* ================= GAME CELLS ================= */

.game-team-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-team-logo-wrap {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #f2fbfb;
  border: 1px solid #d7e6e8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.game-team-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
  display: block;
}

/* ================= RESULTS ================= */

.result-win {
  color: var(--win-color);
  font-weight: 700;
}

.result-loss {
  color: var(--loss-color);
  font-weight: 700;
}

.result-other {
  color: var(--neutral-color);
  font-weight: 700;
}

/* ================= UTILITY TEXT ================= */

.loading-text,
.empty-text,
.error-text {
  padding: 12px 0;
  color: #475569;
}

/* ================= ANCHOR OFFSET ================= */

#team-overview-section,
#batting-leaders-section,
#pitching-leaders-section,
#recent-games-section,
#last-game-section {
  scroll-margin-top: 110px;
}

/* ================= MOBILE ================= */

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    justify-content: center;
  }

  header.scrolled .header-inner {
    flex-direction: row;
    justify-content: space-between;
  }

  .team-logo {
    width: 48px;
    height: 48px;
  }

  header.scrolled .team-logo {
    width: 24px;
    height: 24px;
  }

  .header-text h1 {
    font-size: 1.6rem;
  }

  header.scrolled .header-text h1 {
    font-size: 1rem;
  }

  .header-nav {
    gap: 12px;
  }

  .header-nav a {
    font-size: 0.85rem;
  }

  .card {
    padding: 16px;
  }

  .stats-table {
    min-width: 900px;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-top {
    flex-direction: column;
  }

  .hero-score-block {
    text-align: left;
  }

  .hero-performers {
    grid-template-columns: 1fr;
  }
}