body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #eeeeee;
  color: #000;
  font-size: 14px;
}

a {
  color: purple;
}

/* TOP BAR */

.top-bar {
  background: #3b3739;
  color: white;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 16px;
  font-size: 15px;
}

.top-bar span {
  white-space: nowrap;
}

/* HEADER / SEARCH */

.search-header {
  background: white;
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 14px 36px;
  border-bottom: 1px solid #ccc;
}

.logo-area {
  display: flex;
  align-items: center;
  min-width: 360px;
}

.baseball-icon {
  font-size: 52px;
  margin-right: 10px;
}

.logo-text h1 {
  margin: 0;
  font-size: 46px;
  line-height: 38px;
  color: #555;
}

.logo-text h2 {
  margin: 0;
  font-size: 30px;
  line-height: 30px;
  color: #555;
  font-weight: normal;
}

.global-search {
  display: flex;
  flex: 1;
  gap: 24px;
  position: relative;
}

.global-search input {
  flex: 1;
  font-size: 28px;
  padding: 8px 10px;
  border: 1px solid #888;
}

.global-search button {
  width: 270px;
  background: #990018;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
}

.global-search-results {
  position: absolute;
  top: 62px;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #777;
  z-index: 99999;
  max-height: 650px;
  overflow-y: auto;
  padding: 10px 14px;
  font-size: 24px;
}

.search-close {
  position: absolute;
  right: 14px;
  top: 4px;
  font-size: 36px;
  color: #29538a;
  cursor: pointer;
  font-weight: bold;
}

.search-section-title {
  display: block;
  font-weight: bold;
  color: #1a4cff;
  margin: 8px 0;
  text-decoration: underline;
}

.search-result-row {
  display: flex;
  justify-content: space-between;
  color: #1a4cff;
  padding: 5px 12px;
  text-decoration: none;
}

.search-result-row:hover {
  background: #fff3a3;
}

/* NAV */

.nav-bar {
  background: #dddddd;
  border-bottom: 3px solid #b00000;
  padding: 7px 0;
}

.nav-bar a {
  color: #222;
  text-decoration: none;
  font-weight: bold;
  padding: 8px 20px;
}

.nav-bar a:hover {
  background: #cfcfcf;
}

/* HOME PAGE */

.page-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr 0.9fr;
  gap: 34px;
  padding: 30px 32px;
}

.box {
  background: white;
  min-height: 460px;
}

.box-title {
  background: #a80000;
  color: white;
  font-weight: bold;
  padding: 4px;
  text-decoration: underline;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 4px;
}

.avatar {
  height: 78px;
  background: #bbbbbb;
  border: 1px solid white;
}

.left-box h3,
.right-box h3,
.right-box h4,
.left-box p,
.middle-box p,
.right-box p {
  padding-left: 8px;
}

.standings-table {
  margin: 20px 0 0 12px;
  border-collapse: collapse;
  font-size: 12px;
}

.standings-table th,
.standings-table td {
  border: 1px solid #aaa;
  padding: 5px 12px;
  text-align: center;
}

.standings-table th {
  color: #a00000;
  background: white;
}

.ad-banner {
  background: #555;
  color: white;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  margin-top: 20px;
  padding: 10px;
}

.ad-banner span {
  font-size: 14px;
}

.discord-button {
  display: block;
  margin: 40px auto 5px auto;
  background: #a80000;
  color: white;
  border: none;
  padding: 12px 28px;
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer;
}

/* GENERAL CONTENT */

.content-page {
  background: white;
  max-width: 1100px;
  margin: 30px auto;
  padding: 25px;
  min-height: 500px;
}

.search-box {
  width: 100%;
  max-width: 400px;
  padding: 10px;
  margin: 15px 0;
  font-size: 16px;
}

.bbref-title {
  color: #8b001b;
}

/* OLD PLAYER LIST ELEMENTS */

.letter-heading {
  border-bottom: 2px solid #b00000;
  color: #b00000;
  margin-top: 25px;
}

.player-name-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.player-link {
  display: block;
  padding: 8px;
  background: #f3f3f3;
  color: #0645ad;
  text-decoration: none;
  border: 1px solid #ddd;
}

.player-link:hover {
  background: #e2e2e2;
  text-decoration: underline;
}

.player-link span {
  color: #555;
  font-size: 12px;
  margin-left: 5px;
}

.player-header {
  border-bottom: 3px solid #b00000;
  margin-bottom: 25px;
}

/* PLAYERS DIRECTORY */

.players-directory-page {
  font-family: Arial, sans-serif;
}

.letter-index {
  font-size: 48px;
  line-height: 1.6;
  margin: 15px 0 45px 0;
}

.letter-index a {
  color: #3148d4;
  text-decoration: none;
  margin-right: 18px;
}

.letter-index a:hover {
  text-decoration: underline;
}

.letter-index .current-letter {
  color: black;
}

.letter-disabled {
  color: #aaa;
  margin-right: 18px;
}

.player-letter-section {
  border-top: 1px solid #ccc;
  padding: 10px 0;
}

.player-letter-section h2 {
  margin: 0 0 8px 0;
  color: #3148d4;
}

.player-letter-section p {
  font-size: 18px;
  line-height: 1.6;
}

.active-player-link {
  font-weight: bold;
}

.single-letter-player-list {
  font-size: 20px;
  line-height: 2;
}

.single-letter-player-list a {
  display: block;
}

.player-count {
  color: #8b001b;
}

/* PLAYER PAGE */

.player-bio-card {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 25px;
}

.player-picture-frame {
  width: 92px;
  height: 137px;
  border: 1px solid #777;
  background: #ddd;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.player-headshot {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.player-info h1 {
  font-size: 44px;
  margin: 0 0 10px 0;
}

.player-info p {
  font-size: 20px;
  margin: 6px 0;
}

.player-summary-table {
  border-collapse: collapse;
  margin: 25px 0;
  font-size: 20px;
}

.player-summary-table th,
.player-summary-table td {
  padding: 4px 18px;
  text-align: right;
  border-right: 1px solid #ccc;
}

.player-summary-table th:first-child {
  color: #a00000;
  text-align: left;
}

.partial-row td {
  color: #666;
  background: #f1f1f1;
}

.partial-row a {
  color: #666;
}

.career-total-row td {
  font-weight: bold;
  background: #eeeeee;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: none !important;
}

.first-career-row td {
  border-top: 2px solid #777 !important;
}

.last-career-row td {
  border-bottom: 2px solid #777 !important;
}

.range-popup {
  border: 1px solid #777;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  padding: 22px;
  margin: 20px 0;
  background: white;
  position: relative;
}

.range-popup h2 {
  color: #8b001b;
  margin-top: 0;
}

.range-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: #b00000;
  font-size: 34px;
  font-weight: bold;
  cursor: pointer;
}

#clear-range-selection {
  background: none;
  border: none;
  color: #b00000;
  font-size: 18px;
  cursor: pointer;
}

.range-selected-row td {
  background: orange !important;
}

.stat-rank-1 {
  font-weight: 900;
}

.stat-rank-top-3 {
  font-style: italic;
}

/* SEASON PAGE */

.season-page {
  background: white;
  margin: 25px;
  padding: 20px;
  min-height: 600px;
}

.season-controls {
  margin-bottom: 20px;
}

.season-controls button {
  background: #a80000;
  color: white;
  border: none;
  padding: 10px 18px;
  margin-right: 8px;
  font-weight: bold;
  cursor: pointer;
}

.season-controls button:hover {
  background: #800000;
}

.team-stat-block {
  margin-bottom: 35px;
}

.team-stat-block h2 {
  color: #8b0000;
  margin-bottom: 6px;
}

.season-title-card {
  display: flex;
  align-items: center;
  gap: 24px;
  border-top: 3px solid #8b001b;
  padding: 25px 0;
  margin-bottom: 20px;
}

.season-logo {
  width: 200px;
  height: 200px;
  object-fit: contain;
}

.season-title-card h1 {
  font-size: 40px;
  line-height: 48px;
  margin: 0 0 14px 0;
  color: black;
}

.season-nav-buttons {
  display: flex;
  gap: 35px;
  margin-bottom: 18px;
}

.season-nav-buttons button {
  font-size: 22px;
  padding: 12px 24px;
  border: 1px solid #bbb;
  border-radius: 5px;
  background: #f0f0f5;
  color: #90001b;
  cursor: pointer;
}

.season-nav-buttons button:hover {
  background: #e1e1e8;
}

.hidden-season-button,
.season-nav-buttons button.hidden-season-button {
  display: none;
}

.season-awards {
  font-size: 20px;
  line-height: 28px;
}

.season-awards strong {
  color: black;
}

.season-awards a {
  color: #0645ad;
  text-decoration: underline;
}

#team-stats-section {
  margin-bottom: 35px;
}

.loading-season #team-stats-section,
.loading-season #batting-section,
.loading-season #pitching-section {
  visibility: hidden;
}

/* TABLES */

.table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid #ccc;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stats-table th,
.stats-table td {
  border: 1px solid #aaa;
  padding: 6px;
  text-align: center;
}

.stats-table th {
  background: #eeeeee;
  color: #a00000;
}

.season-stats-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.season-stats-table,
.season-stats-table th,
.season-stats-table td {
  font-family: Verdana, Arial, sans-serif;
}

.season-stats-table th,
.season-stats-table td {
  border: 1px solid #ccc;
  padding: 4px 7px;
  text-align: right;
  white-space: nowrap;
}

.season-stats-table th {
  color: #a00000;
  background: #f7f7f7;
  font-weight: bold;
}

.season-stats-table td:nth-child(1),
.season-stats-table td:nth-child(2),
.season-stats-table th:nth-child(1),
.season-stats-table th:nth-child(2) {
  text-align: left;
}

.team-stats-table td:nth-child(2),
.team-stats-table th:nth-child(2) {
  text-align: right !important;
}

.league-total-row td {
  font-weight: bold;
  border-top: 2px solid #777 !important;
  background: #eeeeee;
}

.clickable-stats-table tbody tr:hover td {
  background: #fff3a3;
}

.clickable-stats-table tbody tr.selected-row td,
.selected-row td {
  background: #f4a742 !important;
}

.clickable-stats-table tbody tr.selected-row:hover td {
  background: #f4a742;
}

.sortable-header {
  cursor: pointer;
  user-select: none;
  vertical-align: bottom;
}

.sortable-header:hover {
  background: #ffe599;
}

.sort-arrow {
  font-size: 11px;
  height: 12px;
  line-height: 12px;
  color: #a00000;
}

.sorted-column,
.sorted-cell {
  background: #fff3a3 !important;
}

.stat-table-header h1 {
  color: #8b001b;
  margin-bottom: 12px;
}

.partial-button {
  margin-left: 20px;
  background: #fff59d;
  color: #a00000;
  border: none;
  padding: 3px 12px;
  font-size: 18px;
  cursor: pointer;
}

/* HIGHLIGHT TOOLBAR */

.highlight-toolbar {
  display: none;
  background: #fff2cc;
  border: 1px solid #d6b656;
  padding: 10px;
  margin-bottom: 12px;
}

.highlight-toolbar.show {
  display: block;
}

.highlight-filter-button {
  margin-left: 12px;
  background: #a80000;
  color: white;
  border: none;
  padding: 6px 10px;
  font-weight: bold;
  cursor: pointer;
}

.highlight-filter-button:hover {
  background: #800000;
}

/* TOOLTIP */

#stat-tooltip {
  display: none;
  position: absolute;
  background: white;
  color: black;
  border: 1px solid #333;
  border-radius: 5px;
  padding: 8px 10px;
  max-width: 280px;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 3px 8px rgba(0,0,0,.25);
  pointer-events: none;
}

.global-search {
  position: relative;
}

.global-search-results {
  position: absolute;
  top: 62px;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #777;
  z-index: 99999;
  max-height: 650px;
  overflow-y: auto;
  padding: 10px 14px;
  font-size: 22px;
}

.search-close {
  position: absolute;
  right: 14px;
  top: 4px;
  font-size: 36px;
  color: #29538a;
  cursor: pointer;
  font-weight: bold;
}

.search-section-title {
  display: block;
  font-weight: bold;
  color: purple;
  margin: 8px 0 12px 0;
  text-decoration: underline;
}

.search-result-row {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  color: #1a4cff;
  padding: 6px 12px;
  text-decoration: none;
}

.search-result-row:hover {
  background: #fff3a3;
}

.search-result-name {
  color: #1a4cff;
  text-decoration: underline;
  font-weight: bold;
}

.search-result-extra {
  display: block;
  color: #555;
  font-size: 13px;
  margin-top: 2px;
  text-decoration: none;
}

.search-result-years {
  color: black;
  font-size: 22px;
  white-space: nowrap;
}

.team-title-card {
  display: flex;
  align-items: flex-start;
  gap: 30px;
  border-top: 3px solid #8b001b;
  padding: 25px 0;
  margin-bottom: 25px;
}

.team-logo-wrap {
  width: 170px;
  flex-shrink: 0;
  text-align: center;
}

.team-logo {
  width: 160px;
  height: 160px;
  object-fit: contain;
}

.team-title-info {
  flex: 1;
}

.team-title-info h1 {
  font-size: 40px;
  margin: 0 0 18px 0;
}

.team-awards {
  position: absolute;
  right: 55px;
  top: 215px;
  width: 330px;
}

.team-title-badge {
  background: #990018;
  color: white;
  font-weight: bold;
  text-align: center;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 5px;
  font-size: 18px;
  text-decoration: underline;
}

.team-meta {
  font-size: 20px;
  line-height: 30px;
}

.top-team-players {
  margin: 25px 0;
}

.top-player-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.top-player-card {
  display: flex;
  justify-content: space-between;
  background: #f7f7f7;
  border: 1px solid #ccc;
  padding: 8px 10px;
  color: #0645ad;
  text-decoration: none;
}

.top-player-card:hover {
  background: #fff3a3;
  text-decoration: underline;
}

.team-stat-section {
  margin-top: 32px;
}

.leaders-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 25px;
}

.leader-box {
  border: 1px solid #cfcfcf;
  background: #f8f8f8;
}

.leader-box-title {
  background: #e5e5e5;
  font-weight: bold;
  text-align: center;
  padding: 8px;
  font-size: 20px;
}

.leader-list {
  padding: 12px;
}

.leader-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  font-size: 16px;
}

.leader-row a {
  color: #0645ad;
  text-decoration: underline;
  font-weight: bold;
}

.hidden-leader {
  display: none;
}

.show-hidden-leader {
  display: flex;
}

.expand-leaders-button {
  width: 100%;
  border: none;
  background: white;
  color: darkred;
  font-size: 18px;
  cursor: pointer;
  padding: 10px;
  border-top: 1px solid #ccc;
}

.leaders-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-bar {
  display: flex;
  align-items: center;
}

.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-drop-link {
  display: inline-block;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #777;
  min-width: 240px;
  z-index: 99999;
  padding: 8px 0;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu strong {
  display: block;
  padding: 7px 12px;
  color: #8b001b;
  background: #eeeeee;
  font-size: 14px;
}

.nav-dropdown-menu a {
  display: block;
  padding: 7px 12px;
  color: #0645ad;
  text-decoration: underline;
  font-weight: normal;
}

.nav-dropdown-menu a:hover {
  background: #fff3a3;
}