.card-reference {
  width: min(calc(100% - 24px), 1120px);
  margin: 0 auto;
  padding: 32px 0 72px;
}

.card-reference__hero {
  padding: 30px 24px 28px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
}

.card-reference__hero .eyebrow {
  color: var(--gold);
}

.card-reference__hero h1,
.reference-heading h2,
.reference-note h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 900;
  letter-spacing: -0.05em;
}

.card-reference__hero h1 {
  font-size: clamp(2.85rem, 14vw, 5.7rem);
  line-height: 0.86;
}

.card-reference__hero > p:not(.eyebrow) {
  max-width: 600px;
  margin: 24px 0 0;
  color: rgba(244, 239, 228, 0.84);
  font-size: 0.88rem;
  line-height: 1.8;
}

.reference-back-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--gold);
  border: 1px solid var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
}

.reference-back-link:hover,
.reference-back-link:focus-visible {
  color: var(--paper);
  background: var(--teal);
  border-color: var(--teal);
}

.reference-back-link:focus-visible,
.table-scroll:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.reference-note {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 15px;
  margin-top: 20px;
  padding: 18px;
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
}

.reference-note__mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--teal);
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 900;
}

.reference-note .eyebrow {
  margin-bottom: 3px;
}

.reference-note h2,
.reference-heading h2 {
  font-size: clamp(1.55rem, 7vw, 2.35rem);
  line-height: 1.1;
}

.reference-note p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.75;
}

.summary-section,
.matchup-section {
  margin-top: 52px;
}

.reference-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.reference-heading .eyebrow {
  margin-bottom: 4px;
}

.reference-heading > p {
  max-width: 160px;
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.45;
  text-align: right;
}

.summary-table-wrap,
.table-scroll {
  overflow-x: auto;
  background: var(--paper-light);
  border: 1px solid var(--ink);
  -webkit-overflow-scrolling: touch;
}

.summary-table,
.matchup-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
}

.summary-table {
  min-width: 680px;
}

.matchup-table {
  min-width: 820px;
}

.summary-table th,
.summary-table td,
.matchup-table th,
.matchup-table td {
  padding: 12px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: nowrap;
}

.summary-table thead th,
.matchup-table thead th {
  color: var(--paper);
  background: var(--ink);
  font-family: var(--font-serif);
  font-size: 0.67rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.summary-table th:first-child,
.summary-table td:first-child,
.matchup-table th:first-child,
.matchup-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}

.summary-table thead th:first-child,
.matchup-table thead th:first-child {
  z-index: 2;
}

.summary-table tbody tr:nth-child(even),
.matchup-table tbody tr:nth-child(even) {
  background: rgba(235, 228, 214, 0.55);
}

.summary-table tbody th:first-child,
.matchup-table tbody th:first-child {
  background: var(--paper-light);
}

.summary-table tbody tr:nth-child(even) th:first-child,
.matchup-table tbody tr:nth-child(even) th:first-child {
  background: #f2ebdf;
}

.summary-table__card,
.matchup-table__batting {
  font-family: var(--font-serif);
  font-size: 1.02rem !important;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-align: left;
}

.matchup-table__bowling {
  font-weight: 900;
}

.number-cell {
  font-family: var(--font-serif);
  font-weight: 900;
  text-align: center;
}

.is-boundary {
  color: var(--teal);
}

.is-wicket {
  color: var(--red);
}

.matchup-table .is-first-in-group > * {
  border-top: 2px solid var(--ink);
}

.matchup-table tbody tr:first-child > * {
  border-top: 0;
}

.matchup-table__expected {
  background: rgba(199, 156, 66, 0.15);
}

.reference-footer-note {
  display: grid;
  gap: 8px;
  margin-top: 28px;
  padding: 16px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.reference-footer-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

.reference-footer-note strong {
  color: var(--ink);
}

@media (min-width: 700px) {
  .card-reference {
    padding-top: 48px;
    padding-bottom: 88px;
  }

  .card-reference__hero {
    padding: 52px 58px 48px;
  }

  .reference-note {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 20px;
    padding: 26px;
  }

  .reference-note__mark {
    width: 46px;
    height: 46px;
  }

  .summary-table th,
  .summary-table td,
  .matchup-table th,
  .matchup-table td {
    padding: 14px 16px;
    font-size: 0.82rem;
  }
}
