:root {
  --ink: #111827;
  --muted: #5f6876;
  --line: #d9dee8;
  --paper: #f7f8fb;
  --white: #ffffff;
  --navy: #14213d;
  --red: #c1121f;
  --green: #1f7a4d;
  --gold: #d8a21b;
  --header-h: 64px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  color: var(--white);
  background: #0c1526;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--white);
  background: var(--red);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  font-weight: 900;
  font-size: 0.88rem;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  max-width: 150px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand strong {
  font-size: 0.98rem;
  line-height: 1.1;
}

.brand small {
  margin-top: 2px;
  color: #cbd5e1;
  font-size: 0.74rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.top-nav a {
  padding: 9px 10px;
  border-radius: 6px;
  color: #dbe4f0;
  font-size: 0.88rem;
  white-space: nowrap;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
}

.scoreboard-hero {
  position: relative;
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  padding: 72px 16px 18px;
  color: var(--white);
  background:
    linear-gradient(180deg, rgba(12, 21, 38, 0.34), rgba(12, 21, 38, 0.91)),
    url("/assets/baseball-bg.jpg") center / cover no-repeat;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.scoreboard-hero .eyebrow {
  color: #f8d765;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
}

h1 {
  font-size: 2.35rem;
  font-weight: 950;
}

h2 {
  font-size: 1.35rem;
}

.hero-copy p:last-child {
  max-width: 460px;
  margin: 10px 0 0;
  color: #e5edf8;
  font-size: 1rem;
  line-height: 1.35;
}

.hero-status {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 10px;
  color: #f8fafc;
  background: rgba(12, 21, 38, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  font-size: 0.82rem;
}

.hero-status strong {
  color: #ffffff;
}

.ad-slot {
  display: grid;
  min-height: 92px;
  place-items: center;
  color: #6b7280;
  background:
    repeating-linear-gradient(
      -45deg,
      #f1f3f7 0,
      #f1f3f7 10px,
      #e5e9f0 10px,
      #e5e9f0 20px
    );
  border: 1px dashed #b8c0cc;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.ad-slot-top {
  margin: 14px 14px 0;
}

.stats-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
}

.sheet-rail,
.ad-rail {
  display: none;
}

.stats-workspace {
  min-width: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.toolbar {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.toolbar-actions {
  display: grid;
  gap: 10px;
}

.mobile-sheet-picker,
.search-box,
.page-size {
  display: grid;
  gap: 5px;
}

.mobile-sheet-picker span,
.search-box span,
.page-size span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
}

select,
input {
  min-height: 42px;
  width: 100%;
  border: 1px solid #c8cfdb;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

select {
  padding: 0 34px 0 10px;
}

input {
  padding: 0 12px;
}

select:focus,
input:focus,
button:focus-visible {
  outline: 2px solid rgba(193, 18, 31, 0.32);
  outline-offset: 2px;
}

.sheet-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}

.sheet-summary strong {
  color: var(--ink);
}

.table-frame {
  min-height: 420px;
  overflow: auto;
  background: #ffffff;
}

.stats-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}

.stats-table th,
.stats-table td {
  min-width: 86px;
  max-width: 210px;
  padding: 9px 10px;
  border-right: 1px solid #e7ebf1;
  border-bottom: 1px solid #e7ebf1;
  text-align: right;
  white-space: nowrap;
}

.stats-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  color: #f8fafc;
  background: #14213d;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stats-table th button {
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font-weight: inherit;
  text-align: inherit;
  cursor: pointer;
}

.stats-table th:first-child,
.stats-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 154px;
  max-width: 210px;
  text-align: left;
}

.stats-table th:first-child {
  z-index: 5;
}

.stats-table td:first-child {
  background: #fbfcfe;
  font-weight: 800;
}

.stats-table td.text-cell,
.stats-table th.text-cell {
  text-align: left;
}

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

.stats-table tbody tr:hover td:first-child {
  background: #fff1c2;
}

.empty-state {
  padding: 32px 14px;
  color: var(--muted);
  text-align: center;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.pager button {
  min-width: 84px;
  min-height: 40px;
  border: 1px solid #bdc5d2;
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.pager button:disabled {
  color: #9aa3b1;
  background: #eef1f5;
  cursor: default;
}

.pager span {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 24px 14px 34px;
  color: #d7dfeb;
  background: #0c1526;
  font-size: 0.85rem;
}

.site-footer span {
  flex-basis: 100%;
  text-align: center;
  color: #ffffff;
  font-weight: 900;
}

.text-page {
  width: min(760px, calc(100% - 28px));
  margin: 24px auto 48px;
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.text-page h1 {
  color: var(--navy);
  font-size: 2rem;
}

.text-page h2 {
  margin-top: 22px;
  color: var(--navy);
  font-size: 1.08rem;
}

.text-page p {
  color: #374151;
  line-height: 1.55;
}

@media (max-width: 420px) {
  .site-header {
    padding-inline: 10px;
  }

  .brand strong,
  .brand small {
    max-width: 118px;
  }

  .top-nav a {
    padding-inline: 8px;
    font-size: 0.82rem;
  }

  h1 {
    font-size: 2rem;
  }

  .scoreboard-hero {
    min-height: 248px;
  }

  .stats-table th,
  .stats-table td {
    min-width: 78px;
    padding: 8px;
  }

  .stats-table th:first-child,
  .stats-table td:first-child {
    min-width: 138px;
  }
}

@media (min-width: 760px) {
  .site-header {
    padding-inline: 24px;
  }

  .brand strong,
  .brand small {
    max-width: none;
  }

  .scoreboard-hero {
    min-height: 340px;
    padding: 92px 28px 28px;
  }

  h1 {
    font-size: 3.65rem;
  }

  .hero-copy p:last-child {
    font-size: 1.14rem;
  }

  .stats-shell {
    padding: 18px;
  }

  .toolbar {
    grid-template-columns: minmax(180px, 1fr) minmax(420px, 1.6fr);
    align-items: end;
  }

  .toolbar-actions {
    grid-template-columns: 1.15fr 1fr 96px;
    align-items: end;
  }
}

@media (min-width: 1120px) {
  .ad-slot-top {
    display: none;
  }

  .stats-shell {
    grid-template-columns: 230px minmax(0, 1fr) 180px;
    align-items: start;
    gap: 18px;
    padding: 18px 22px 28px;
  }

  .sheet-rail,
  .ad-rail {
    display: block;
  }

  .sheet-rail {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    max-height: calc(100svh - var(--header-h) - 34px);
    overflow: auto;
    padding: 12px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .rail-heading {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .rail-heading strong {
    color: var(--red);
  }

  .sheet-tabs {
    display: grid;
    gap: 5px;
  }

  .sheet-tabs button {
    width: 100%;
    min-height: 36px;
    padding: 7px 8px;
    border: 0;
    border-radius: 6px;
    color: #263244;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }

  .sheet-tabs button:hover,
  .sheet-tabs button.active {
    color: #ffffff;
    background: var(--red);
  }

  .mobile-sheet-picker {
    display: none;
  }

  .toolbar-actions {
    grid-template-columns: 1fr 96px;
  }

  .ad-rail {
    position: sticky;
    top: calc(var(--header-h) + 16px);
  }

  .ad-rail .ad-slot + .ad-slot {
    margin-top: 14px;
  }

  .ad-slot.tall {
    min-height: 320px;
  }
}
